Some questions about if_bridge and protocol stack for L3 forwarding ?

Hi,
I want to port FreeBSD on a ethernet L3 switch.

1) For L2 forwarding, i think mac chip can forward by AISC. For some packets to cpu like arp, icmp etc, i want to pick it up to the protocol stack. How can i pick it up between the L2 packets with cpu packets? Or throw all the raw packet to protocol stack directly from NIC Driver ? Or check the ether header and ip header in the mbuf ?

2) Can I understand if_bridge as soft forwarding of the switch? If I want to use the rstp code in the if_bridge, how can I transmit packets from the MAC chip to the if_bridge of the protocol stack? Is there some flags same as M_VLANTAG for Bridge?

Maybe the packet flow chart as below:

MAC CHIP--->ether_nh_input--->BRIDGE_INPUT --->ether_demux ...

I don't know if I'm right about that. Any ideas for this ?

Thx
 
I'm unsure whether I understand your requirements right.

I believe, others were looking at working with if_bridge() but assessed this to be slow. See https://forums.freebsd.org/threads/can-a-freebsd-bridge-outperform-off-the-shelf-switches.83312/

Maybe a netgraph(4)() bridge could do the trick - have not yet tried anything like that before, however. So YMMV.
Acturally, i just wanna find a solution to offloading the L2/L3 traffic from kernel protocol stack, and i have found that Linux has a switchdev module, while i don't know now FreeBSD whether has it like this ?
 
Back
Top