Re: net_rx_action, ptype_all and dropped packets

From: Andi Kleen (
Date: Fri Jun 02 2000 - 18:01:31 EST

On Fri, Jun 02, 2000 at 11:51:05AM -0500, Noah Romer wrote:
> Andi Kleen wrote:
> >
> > On Thu, Jun 01, 2000 at 11:41:49AM -0500, Noah Romer wrote:
> > > Here's the setup, I'm writing a LAN driver for a Fibre Channel host adapter
> > > and am running into a slight problem w/ received packets. I can transmit
> > > just fine, at least ARP's, I can't get past that due to the fact that all
> > > incoming packets get dropped by net_rx_action (in net/core/dev.c). As far
> > > as I can tell, the necessary ptype_all values aren't getting set, so
> > > net_rx_action just drops them (I have confirmed that it's making the
> > > kfree_skb call found at line 1194 of dev.c).
> >
> > You need to setup skb->protocol and skb->pkt_type correctly in your network
> > driver before you pass up to netif_rx. How you do that is up to you, most
> > ethernet drivers use the standard eth_type_trans() function for that.
> Ok, that is being done by an fc_type_trans function that I nabbed from the
> existing fibre channel code. I just tried using eth_type_trans (didn't
> figure it'd work, since the board is most definitely not ethernet, but . .
> .), w/o any change in behavior in net_rx_action. The packet's are
> apparently passing the "if(ntohs(eth->h_proto) >= 1536)" test in
> eth_type_trans and it's returning eth->h_proto.

Not hitting ptype_all is ok, ptype_all is only used for packet taps.

If you want to have e.g. a IP packet delivered to the stack
skb->protocol should contain htons(0x800) (ETH_P_IP) and skb->pkt_type
should contain PKT_HOST. How you get to that is up to your, but it should
match the payload in the skb if possible :-)

> > >
> > > My question is: where, when and how should the setup for FC devices be done
> > > in the ptype_all array? I've got fibre channel support turned on, and all
> > > outgoing packets appear to meet the spec in RFC 2625. I've tried turning on
> > > the experimental LLC support (which is only listed for X.25) since it's the
> > > only way to compile net/802/p8022.c, and that looked related (what w/ the
> > > FC stuff I've found claiming ptype of ETH_P_8022), but that didn't do any
> > > good.
> >
> > The LLC layer in the current tree is broken and won't do much good.
> > If you really need working 802.2 (as opposed to plain 802.3) you could
> > coordinate with the Linux/SNA project, they apparently have fixed it
> Hmmm. May have to do that. I tried having the fc_type_trans function
> return 802.3, instead of 802.2, just to see what would happen, but I still
> didn't get any change in net_rx_action that I can see. I'm not very
> familiar w/ what the standard ethernet frames look like, but as I remember,
> they don't have a LLC/SNAP header on them, which FC traffic most definitely
> does.

net_rx_action does not care. skb->data should just point past your LL header
when you hand it up.

To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to

This archive was generated by hypermail 2b29 : Wed Jun 07 2000 - 21:00:32 EST