> On 11 Jan 2018, at 8:58 pm, Martin Pieuchot <m...@openbsd.org> wrote:
> 
> On 11/01/18(Thu) 11:50, David Gwynne wrote:
>> while we were working on making the various pseudo interfaces you
>> stack on top of ethernet mpsafe, we split their input processing
>> off so they could be attacked one by one. they're all mpsafe now,
>> so this separation is not strictly necessary anymore.
> 
> Well at that time we weren't sure how to split the work between
> CPUs.  The current design allow to have multiple tasks doing some
> part of the work and, like we are pushing now, process all the
> incoming packets in the same context.

yes.

now though we assign interfaces to softnettqs, no matter what their 
relationship to each other is. a physical interface could be on tq 0, and it's 
child vlan on 1, which goes against the goal of processing all incoming packets 
in the same context.

> 
>> this moves carp and vlan input back into ether_input. [...]
> 
> It does much more than that.  It's also doing a conversion from mbuf to
> mbuf_list, it contains some IFF_RUNNING "fixes",  it breaks carp(4)
> balancing, it breaks vlan/carp on top of trunk(4)...

it doesnt replace mbufs with mbuf_lists, it gets rid of the cookies for vlan 
and carp input and gives them the list to requeue their packets on for input.

wrt to IFF_RUNNING, if we agree that we should be looking at it to know if an 
interface is functional i can make a bunch of those fixes without oks.

when you say i break carp balancing, are you talking about the removal of the 
PACKET_TAG_CARP_BAL_IP tagging? PACKET_TAG_CARP_BAL_IP is only used in 
carp_lsdrop to clear the M_MCAST flag on the mbuf. M_MCAST wont be set on 
packets destined for the carp interface because we check ac_enaddr before 
checking if the packet is multicast or broadcast.

are you sure? carp and vlan on top of trunk should still function. however, 
trunk or bridge/switch on vlan is broken though :(

> 
>> this diff also gets rid of the use of the pseudo interfaces input
>> queues, it processes their packets off an mbuf list for each real
>> ethernet packet. if we can tie all the work done on behalf of a
>> physical ring to a single task it makes rx ring moderation for
>> physical interfaces a lot easier to implement.
> 
> This needs to be done.  But please don't mix that with a rewrite of
> the input handlers.  I believe that's the easiest way to do that is
> to modify if_input() do process the packets directly if `ifp' is a
> pseudo-interface:
> 
>       if (ISSET(ifp->if_xflags, IFXF_CLONED) {
>               struct ifih *ifih;
>               struct srp_ref sr;
> 
>               NET_ASSERT_LOCKED();
> 
>                SRPL_FOREACH(ifih, &sr, &ifp->if_inputs, ifih_next) {
>                        if ((*ifih->ifih_input)(ifp, m, ifih->ifih_cookie))
>                                break;
>                }
>                SRPL_LEAVE(&sr)
>       } else
>               ifiq_input(&ifp->if_rcv, ml, 2048);
> 
> If if_input() is called on a pseudo-interface we know we're already in
> a softnet process.

or a syscall.

the code above has pseudo interfaces recurse, where they'd loop either on ifih 
or at the task level. probably not a huge concern though.

> 
> We could also think of doing something similar for if_enqueue() and call
> if_start() directly for pseudo-interface.

ill think about that. ive had some other experiments in that area we could look 
at too.

> 
>> note that trunk and bridge/switch are still implemented using
>> interface input handlers at the moment.
> 
> If you want to get rid of the input handlers, I'd suggest doing it in
> the beginning of a release cycle and for all pseudo drivers at once.

considering the trunk and bridge/switch issue, it probably is best to do them 
all at once.

Reply via email to