[Click] Little hack to improve performance in userlevel fromdevice.cc element in BSD (Mac OS X)

Eddie Kohler kohler at cs.ucla.edu
Fri Jul 8 11:00:38 EDT 2011


Thank you very much, Dmitriy!  The actual fix is now checked in.

Eddie


On 11/22/2010 04:15 PM, Bubnov Dmitriy wrote:
> Hi all,
>
> I am using Click on Mac OS X in userlevel mode, and have found a poor prfomance in FromDevice element for that mode.
>
> The problem is in missing actual call to ioctl with BIOCIMMEDIATE on pcap file descriptor at runtime, and without that ioctl pcap_fd left in buffered mode.
>
> Here is a patched section of elements/userlevel/fromdevice.cc. First line is line 260 in original file:
>
>
>
> //# if defined(BIOCIMMEDIATE)&&  !defined(__sun) // pcap/bpf ioctl, not in DLPI/bufmod
> 	{
> 	    int r, yes = 1;
> 	    if ((r = ioctl(pcap_fd, /*BIOCIMMEDIATE*/_IOW('B',112, u_int),&yes)) == -1)
> 		return errh->error("%s: BIOCIMMEDIATE: %s", ifname, strerror(errno));
> 	    /*else if (r != 0)
> 		  errh->warning("%s: BIOCIMMEDIATE returns %d", ifname, r);*/
> 	    errh->warning("%s: BIOCIMMEDIATE returns %d", ifname, r);
> 	}
> //# endif
>
>
>
> To force put pcap_fd in unbuffered mode, I commented out "#if defined" directives and insert a "_IOW('B',112, u_int)" instead of "BIOCIMMEDIATE" in "ioctl" to avoid include files conflicts.
>
> It is just quick hack, not a solution!
> Hope that will be helpful for somebody.
>
> --
> Regards,
> Dmitriy Bubnov
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click


More information about the click mailing list