Re: asio and kqueue (2nd trye) (was: RE: (boost::)asio and kqueue problem)

2016-10-14 Thread Scott Mitchell
Patch generally lgtm ... just 1 nit comment:


+   } else {
+   if (sbavail(&so->so_rcv) >= so->so_rcv.sb_lowat)
+   return 1;
+   }


Collapse the else and the block inside to just make it an `else if`
for less branching.


On Fri, Oct 14, 2016 at 5:03 AM, Konstantin Belousov 
wrote:

> On Fri, Oct 14, 2016 at 09:21:52AM +, hartmut.bra...@dlr.de wrote:
> > Hi all,
> >
> > here is the 2nd try taking into account the comments I received. Since
> I'm not familiar with the locking in the sockets area I ask somebody with
> that knowledge to check it before I commit it.
>
> I have only style notes, the factual code changes in the patch look good
> to me.
>
> Index: uipc_socket.c
> ===
> --- uipc_socket.c   (revision 307091)
> +++ uipc_socket.c   (working copy)
> @@ -159,15 +159,9 @@
>  static int filt_soread(struct knote *kn, long hint);
>  static voidfilt_sowdetach(struct knote *kn);
>  static int filt_sowrite(struct knote *kn, long hint);
> -static int filt_solisten(struct knote *kn, long hint);
>  static int inline hhook_run_socket(struct socket *so, void *hctx, int32_t
> h_id);
>  fo_kqfilter_t  soo_kqfilter;
>
> -static struct filterops solisten_filtops = {
> -   .f_isfd = 1,
> -   .f_detach = filt_sordetach,
> -   .f_event = filt_solisten,
> -};
>  static struct filterops soread_filtops = {
> .f_isfd = 1,
> .f_detach = filt_sordetach,
> @@ -3075,10 +3069,7 @@
>
> switch (kn->kn_filter) {
> case EVFILT_READ:
> -   if (so->so_options & SO_ACCEPTCONN)
> -   kn->kn_fop = &solisten_filtops;
> -   else
> -   kn->kn_fop = &soread_filtops;
> +   kn->kn_fop = &soread_filtops;
> sb = &so->so_rcv;
> break;
> case EVFILT_WRITE:
> @@ -3282,29 +3273,34 @@
>  static int
>  filt_soread(struct knote *kn, long hint)
>  {
> -   struct socket *so;
> +   struct socket *so = kn->kn_fp->f_data;
> Style is against mixing declaration and initialization.  Please keep the
> next removed line instead.
>
> -   so = kn->kn_fp->f_data;
> This one.
>
> -   SOCKBUF_LOCK_ASSERT(&so->so_rcv);
> +   if (so->so_options & SO_ACCEPTCONN) {
> +   kn->kn_data = so->so_qlen;
> +   return (!TAILQ_EMPTY(&so->so_comp));
>
> -   kn->kn_data = sbavail(&so->so_rcv) - so->so_rcv.sb_ctl;
> -   if (so->so_rcv.sb_state & SBS_CANTRCVMORE) {
> -   kn->kn_flags |= EV_EOF;
> -   kn->kn_fflags = so->so_error;
> -   return (1);
> -   } else if (so->so_error)/* temporary udp error */
> -   return (1);
> +   } else {
> You do not need else {} block, 'then' branch ends with return(). If you
> remove else, you do not need additional indent for the old filt_soread()
> function' body.
>
> +   SOCKBUF_LOCK_ASSERT(&so->so_rcv);
>
> -   if (kn->kn_sfflags & NOTE_LOWAT) {
> -   if (kn->kn_data >= kn->kn_sdata)
> -   return 1;
> -   } else {
> -   if (sbavail(&so->so_rcv) >= so->so_rcv.sb_lowat)
> -   return 1;
> +   kn->kn_data = sbavail(&so->so_rcv) - so->so_rcv.sb_ctl;
> +   if (so->so_rcv.sb_state & SBS_CANTRCVMORE) {
> +   kn->kn_flags |= EV_EOF;
> +   kn->kn_fflags = so->so_error;
> +   return (1);
> +   } else if (so->so_error)/* temporary udp error */
> +   return (1);
> +
> +   if (kn->kn_sfflags & NOTE_LOWAT) {
> +   if (kn->kn_data >= kn->kn_sdata)
> +   return 1;
> return (1);
> since you change the line anyway.
>
> +   } else {
> +   if (sbavail(&so->so_rcv) >= so->so_rcv.sb_lowat)
> +   return 1;
> Same.
>
> +   }
> +
> +   /* This hook returning non-zero indicates an event, not
> error */
> +   return (hhook_run_socket(so, NULL, HHOOK_FILT_SOREAD));
> }
> -
> -   /* This hook returning non-zero indicates an event, not error */
> -   return (hhook_run_socket(so, NULL, HHOOK_FILT_SOREAD));
>  }
>
>  static void
> @@ -3346,16 +3342,6 @@
> return (kn->kn_data >= so->so_snd.sb_lowat);
>  }
>
> -/*ARGSUSED*/
> -static int
> -filt_solisten(struct knote *kn, long hint)
> -{
> -   struct socket *so = kn->kn_fp->f_data;
> -
> -   kn->kn_data = so->so_qlen;
> -   return (!TAILQ_EMPTY(&so->so_comp));
> -}
> -
>  int
>  socheckuid(struct socket *so, uid_t uid)
>  {
>
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any ma

(boost::)asio and kqueue problem

2016-10-13 Thread Scott Mitchell
I am not using boost but I have also encountered this unexpected behavior
when calling listen after kevent. Is their any update on the approach to
merge filt_soread and filt_solisten?

FYI - MacOS does not have this unexpected behavior. Read events are not
"missed" if the listen is done after the kevent *EVFILT_READ *change is
registered.

Thanks,
-Scott
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Xircom pccard couldn't load/attach (with uname -a info)

2003-11-29 Thread Scott Mitchell
On Sat, Nov 29, 2003 at 02:20:24PM +0100, Ronald Klop wrote:
> On Sat, 29 Nov 2003 14:17:01 +0100, Ronald Klop 
> <[EMAIL PROTECTED]> wrote:
> 
> >Hello,
> >
> >This card doesn't attach well. Other Xircom cards do.
> >
> >Nov 29 13:47:24 laptop kernel: xe0:  >+ Modem 56> at port 0x2e8-0x2ef irq 11 function 0 config 39 on pccard0
> >Nov 29 13:47:24 laptop kernel: device_probe_and_attach: xe0 attach 
> >returned 12
> >
> >Mail me if more info is needed.
> 
> uname -a
> FreeBSD laptop 5.2-BETA FreeBSD 5.2-BETA #0: Sun Nov 23 22:09:51 CET 
> 2003 [EMAIL PROTECTED]:/usr/obj/usr/src/sys/LAPTOP  i386

Hi Ronald,

Could you try setting sysctl hw.xe.debug=1 and post the output?  Also, are
you using OLDCARD or NEWCARD?  A full dmesg might be useful too...
I suspect there's a problem with the driver not knowing all the card IDs
that Xircom ever used, as well as probing some cards differently when run
under NEWCARD vs. OLDCARD. 

Cheers,

    Scott

-- 
===
Scott Mitchell   | PGP Key ID | "Eagles may soar, but weasels
Cambridge, England   | 0x54B171B9 |  don't get sucked into jet engines"
scott at fishballoon.org | 0xAA775B8B |  -- Anon
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: cant compile GENERIC kernel from today source

2003-11-05 Thread Scott Mitchell
On Wed, Nov 05, 2003 at 11:02:02AM +0200, Putinas wrote:
> Hi,
> I just cvsuped and when I do
> make buildkernel I get this:

Yeah, my bad :-(

It's been fixed - cvsup again and all should be well.

Scott

-- 
=======
Scott Mitchell   | PGP Key ID | "Eagles may soar, but weasels
Cambridge, England   | 0x54B171B9 |  don't get sucked into jet engines"
scott at fishballoon.org | 0xAA775B8B |  -- Anon
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: cardbus and xircom ethernet problem

2003-06-23 Thread Scott Mitchell
On Mon, Jun 23, 2003 at 07:31:09PM +0100, Matt wrote:
> 
> Will Saxon said:
> >
> > Do try loading if_dc.ko or compiling that in again.
> >
> > -Will
> >
> 
> Sorry yeah I have already added dc and various other's that I have seen
> could belong to these xircom cards. It hasn't made a difference. I
> actually believe it is xe though as when I remove the card it says this:
> 
> holly pccard[172]: xe-1: Xircom (CreditCard Ethernet 10/100 + Modem 56)
> removed.
> 
> The xe-1 part suggests xe driver I guess?
> 
> Matt.

Yes, all the 16-bit Xircom Ethernet cards are handled (for some definition
of handled) by the xe driver.  Their 32-bit (Cardbus) products used very
different hardware that is understood by the dc driver.

As for your card, it looks like some resource required by the driver isn't
being allocated.  Try booting in verbose mode (boot -v) again -- I think
that turns on the right debug output in the pccard driver.  Full 'dmesg'
output would also be useful (I realise you have no network on this machine
yet - can you maybe put it on a floppy and mail it from another machine?)

    Scott

-- 
===
Scott Mitchell   | PGP Key ID | "Eagles may soar, but weasels
Cambridge, England   | 0x54B171B9 |  don't get sucked into jet engines"
scott at fishballoon.org | 0xAA775B8B |  -- Anon
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: cardbus and xircom ethernet problem

2003-06-22 Thread Scott Mitchell
On Sun, Jun 22, 2003 at 09:00:35AM +0100, Matt wrote:
> 
> M. Warner Losh said:
> >
> > This means that there are problems reading the CIS.
> 
> Any idea how I can go about trying to get it working? I have never used a
> laptop with freebsd before and obviously it just "works" in windows so I'm
> not even aware of what a "CIS" is. I've tried all the stuff mentioned in
> the archives such as hw.cbb.start_memory=(tried various things here), and
> hw.pci.allow_unsupported_io_range=1 as this seems to be the most common
> problem but it hasn't made a difference.
> 
> So is there anything else I can do? Or is it simply a case that this
> hardware does not work under fbsd?

Well, the card itself is supported by the xe driver, but the errors you're
seeing are coming from the generic cardbus/pccard code.  I'm not sure it's
even getting as far as deciding to use the xe driver for the card...

Can you try another card in this machine?  It will probably throw up the
same error, but it's worth trying if you can.

You could also try adding the following lines to /boot/loader.conf to get
some extra debug output:

hw.cbb.debug=1
hw.cardbus.debug=1
hw.cardbus.cis_debug=1
hw.pccard.debug=1
hw.pccard.cis_debug=1

You'll have to reboot for those to take effect.  Probably also worth
booting in verbose mode (hit space when the 'boot countdown' starts, then
type 'boot -v').

That said, the CEM56 is a slightly odd beast that needs special handling to
enable the Ethernet part (a straightforward walk through the CIS would lead
you to believe it's a modem-only card).  I haven't been able to test the xe
driver on a NEWCARD machine yet, so I have no idea how well it works, if at
all.  I suppose you could try booting the OLDCARD kernel on your laptop,
but it might barf on the Cardbus controller.

Scott

-- 
===
Scott Mitchell   | PGP Key ID | "Eagles may soar, but weasels
Cambridge, England   | 0x54B171B9 |  don't get sucked into jet engines"
scott at fishballoon.org | 0xAA775B8B |  -- Anon
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[EMAIL PROTECTED]"