Hello,

Samuel Thibault, le mar. 03 nov. 2026 07:25:42 +0100, a ecrit:
> David Gwynne, le mar. 03 nov. 2026 14:10:29 +1000, a ecrit:
> > the diff below tries to fix the M_FLOWID setting in aggr_port_input(),
> > and adds a link0 flag that enables packet parsing/hashing in a similar
> > style to what trunk(4) did. you'll have to "ifconfig aggr0 link0" to
> > enable it.
> 
> This looks like what I was looking for, indeed!

I could build and test the kernel, the outgoing trafic indeed now gets
balanced, thanks!

Interestingly, with the fixing of aggr_port_input() setting the flowid
to if_index << AGGR_FLOWID_SHIFT instead of just if_index (which gets
eaten by aggr_transmit()'s ph_flowid >> AGGR_FLOWID_SHIFT), even without
the link0 the outgoing trafic is balanced, according to the incoming
balance :)

I however had to do this:

Index: sys/net/if_aggr.c
===================================================================
--- sys.orig/net/if_aggr.c
+++ sys/net/if_aggr.c
@@ -747,7 +747,7 @@ aggr_transmit(struct aggr_softc *sc, con
        }

        flowid >>= AGGR_FLOWID_SHIFT;
-       ifp0 = map->m_ifp0s[flowid % AGGR_MAX_PORTS];
+       ifp0 = map->m_ifp0s[((uint16_t)flowid) % AGGR_MAX_PORTS];

        if (if_enqueue(ifp0, m) != 0)
                counters_inc(ifp->if_counters, ifc_oerrors);

Otherwise very early at boot I was getting:

fatal page fault in supervisor mode                                         
trap type 6 code 10 rip 0 cs 8 rflags 10246 cr2 0 cpl 0 rsp ffff80003966b5c8
gsbase 0xffff8000314e4ff0  kgsbase 0x0                                      
panic: trap type 6, code=10, pc=0     
Starting stack trace...          
panic(ffffffff826a020f) at panic+0x170
kerntrap(ffff80003966b510) at kerntrap+0x15d
alltraps_kern_meltdown() at alltraps_kern_meltdown+0x7b
0(ffff800000551000,ffff8000005515b8,fffffd80ce6cd200,ffff800000551000,c770249840
aggr_enqueue(ffff800000551000,fffffd80ce6cd200) at aggr_enqueue+0x98           
vlan_transmit(ffff8000011b4000,ffff800000551000,fffffd80ce6cd200) at vlan_transd
vlan_enqueue(ffff8000011b4000,fffffd80ce6cd200) at vlan_enqueue+0xc7           
ether_output(ffff8000011b4000,fffffd80ce6cd200,ffff80003966b798,0) at ether_outd
in_arpinput(ffff8000011b4000,fffffd80ce6cd200) at in_arpinput+0x40f            
arpintr() at arpintr+0xb7                                          
if_netisr(0) at if_netisr+0xd5
taskq_thread(ffff80000002f000) at taskq_thread+0x129
end trace frame: 0x0, count: 245                    
End of stack trace.             

I guess somehow with the various shifts flowid got negative, thus
accessing map->m_ifp0s with negative index.

Samuel

Reply via email to