Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Aug 1997 16:20:15 -0500
From:      Prashant Dongre <pdongre@opentech.stpn.soft.net>
To:        ETX-B-SL Martti Kuparinen <erakupa@kk.etx.ericsson.se>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: poll() for ethernet devices
Message-ID:  <33FB5F8E.DBAE6CFB@opentech.stpn.soft.net>
References:  <199708200928.LAA12825@kk662.kk.etx.ericsson.se>

next in thread | previous in thread | raw e-mail | index | archive | help
ETX-B-SL Martti Kuparinen wrote:

> Ok, seems like my description was not clear enough... I try to make
> a better story now :-)
>
> > > I am running FreeBSD 2.2.2 on a PPro 200 MHz PC. I have created a
> > > loadable kernel module which will schedule IP-packets on user-defineable
> > > interfaces and priorities.
>
> So I have a router which is able to prioritize outgoing packets
> based on {address, port, protocol}-decision. To achieve this I have
> two different tables in memory:
>
>         addresstable:   { address, port, protocol, priority }
>         interfacetable: list of interfaces which are scheduled
>
> So the user is able to type e.g.
>
>         schconfig attach fxp0 fxp1 fxp2 fxp3
>         schconfig add 192.168.100.200 icmp high
>         schconfig add \* \* \* low
>
>         (schconfig is a user-space control program like ifconfig to
>          modify the scheduler at run-time)
>
> This means that icmp packets (e.g. ping) to 192.168.100.200 have the
> high priority whereas all other packets are low priority traffic. These
> actions take effect on fxp[0-3] interfaces.
>
> I have modified ether_output() to put the packet in to the correct
> position inside the if_snd queue. The position is calculated from
> { address, port, protocol, priority }-information.
>
> In order to do the prioritity queueing one must always read packets
> from interfaces before writing them out. So inside ether_output()
> I want to force the kernel to execute ether_input().
>
> My version work great (checking the priority and the position
> in the queue for every packet) expect that it is always writing
> someting out from ether_output. As a "minor" side effect packets
> are not prioritized :-('So I need to check if there is more packets
> to read from any of the attached interfaces. Of course I have a "timeout"
> mechanism to prevent the system from not writing anything out...
>
> Any ideas how to check for new incoming packets on all interfaces in
> the system?
>
> /Martti

Hi,

Have you checked code in 'if_ethersubr.c' in directory '/usr/src/sys/net'  ????.

Check ether_input() function. Here you can directly read ethernet packets from
all the interfaces attached. But here you need to check for wheather the packet
is IP, ARP (from ether_header) stc. etc. and you may also incorporate routing
mechanism, as you need to schedule incoming packet to the right interface queue.

I think, the trick is, hijacking the packet off the ether interface before it
reaches IP level.

Let me know if this is what you were looking for.

Good luck !!

Prashant.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?33FB5F8E.DBAE6CFB>