Message ID | 4bdabd4670b726348cdcdc0d2d635dd660671ee3.1368229353.git.luto@amacapital.net |
---|---|
State | Awaiting Upstream, archived |
Delegated to: | David Miller |
Headers | show |
On Fri, 2013-05-10 at 16:51 -0700, Andy Lutomirski wrote: > As far as I know, the hardware doesn't support matching on both IP > fields and vlan tag, but it can at least match on the vlan tag. > > Signed-off-by: Andy Lutomirski <luto@amacapital.net> > --- > > Tested on the OpenOnload version of the driver, but the patch is the same > other than some offset. This looks correct, but I'll have to actually test it. So I'll queue this up and re-submit along with other sfc patches later on, OK? > With this patch, accelerated RFS works for me. (Oddly, some packets end > up on otherwise idle cores, even when those cores have weight zero in > ethtool --set-rxfh-indir; I'm not sure what's going on there.) Some packets, or some interrupts? TX completions and wake-up events (if you use user-level networking) are of course not affected by the RX flow hash indirection table.. You might find it useful to dump the complete RX filter table by running 'ethtool -d'. ('ethtool -n' only shows the manually controlled filters.) Ben. > drivers/net/ethernet/sfc/filter.c | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/sfc/filter.c b/drivers/net/ethernet/sfc/filter.c > index 8af42cd..5313ffe 100644 > --- a/drivers/net/ethernet/sfc/filter.c > +++ b/drivers/net/ethernet/sfc/filter.c > @@ -1076,8 +1076,21 @@ int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, > > nhoff = skb_network_offset(skb); > > - if (skb->protocol != htons(ETH_P_IP)) > + if (skb->protocol == htons(ETH_P_8021Q)) { > + EFX_BUG_ON_PARANOID(skb_headlen(skb) < > + nhoff + sizeof(struct vlan_hdr)); > + if (((const struct vlan_hdr *)skb->data + nhoff)-> > + h_vlan_encapsulated_proto != htons(ETH_P_IP)) > + return -EPROTONOSUPPORT; > + > + /* This is IP over 802.1q VLAN. We can't filter on the > + * IP 5-tuple and the vlan together, so just strip the > + * vlan header and filter on the IP part. > + */ > + nhoff += sizeof(struct vlan_hdr); > + } else if (skb->protocol != htons(ETH_P_IP)) { > return -EPROTONOSUPPORT; > + } > > /* RFS must validate the IP header length before calling us */ > EFX_BUG_ON_PARANOID(skb_headlen(skb) < nhoff + sizeof(*ip));
On Thu, May 16, 2013 at 11:38 AM, Ben Hutchings <bhutchings@solarflare.com> wrote: > On Fri, 2013-05-10 at 16:51 -0700, Andy Lutomirski wrote: >> As far as I know, the hardware doesn't support matching on both IP >> fields and vlan tag, but it can at least match on the vlan tag. >> >> Signed-off-by: Andy Lutomirski <luto@amacapital.net> >> --- >> >> Tested on the OpenOnload version of the driver, but the patch is the same >> other than some offset. > > This looks correct, but I'll have to actually test it. So I'll queue > this up and re-submit along with other sfc patches later on, OK? Fine with me. (Is there a combined vlan + IP filter that I don't know about?) When you resubmit it, it might be worth fixing the blatant typo (vlan tag -> IP fields) in the description, though :/ > >> With this patch, accelerated RFS works for me. (Oddly, some packets end >> up on otherwise idle cores, even when those cores have weight zero in >> ethtool --set-rxfh-indir; I'm not sure what's going on there.) > > Some packets, or some interrupts? TX completions and wake-up events (if > you use user-level networking) are of course not affected by the RX flow > hash indirection table.. It's TX completions -- I figured that out after I sent this patch. > > You might find it useful to dump the complete RX filter table by running > 'ethtool -d'. ('ethtool -n' only shows the manually controlled > filters.) Thanks -- that's useful. --Andy -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, 2013-05-16 at 12:45 -0700, Andy Lutomirski wrote: > On Thu, May 16, 2013 at 11:38 AM, Ben Hutchings > <bhutchings@solarflare.com> wrote: > > On Fri, 2013-05-10 at 16:51 -0700, Andy Lutomirski wrote: > >> As far as I know, the hardware doesn't support matching on both IP > >> fields and vlan tag, but it can at least match on the vlan tag. > >> > >> Signed-off-by: Andy Lutomirski <luto@amacapital.net> > >> --- > >> > >> Tested on the OpenOnload version of the driver, but the patch is the same > >> other than some offset. > > > > This looks correct, but I'll have to actually test it. So I'll queue > > this up and re-submit along with other sfc patches later on, OK? > > Fine with me. (Is there a combined vlan + IP filter that I don't know about?) Not in current hardware. > When you resubmit it, it might be worth fixing the blatant typo (vlan > tag -> IP fields) in the description, though :/ [...] Good point! Ben.
diff --git a/drivers/net/ethernet/sfc/filter.c b/drivers/net/ethernet/sfc/filter.c index 8af42cd..5313ffe 100644 --- a/drivers/net/ethernet/sfc/filter.c +++ b/drivers/net/ethernet/sfc/filter.c @@ -1076,8 +1076,21 @@ int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, nhoff = skb_network_offset(skb); - if (skb->protocol != htons(ETH_P_IP)) + if (skb->protocol == htons(ETH_P_8021Q)) { + EFX_BUG_ON_PARANOID(skb_headlen(skb) < + nhoff + sizeof(struct vlan_hdr)); + if (((const struct vlan_hdr *)skb->data + nhoff)-> + h_vlan_encapsulated_proto != htons(ETH_P_IP)) + return -EPROTONOSUPPORT; + + /* This is IP over 802.1q VLAN. We can't filter on the + * IP 5-tuple and the vlan together, so just strip the + * vlan header and filter on the IP part. + */ + nhoff += sizeof(struct vlan_hdr); + } else if (skb->protocol != htons(ETH_P_IP)) { return -EPROTONOSUPPORT; + } /* RFS must validate the IP header length before calling us */ EFX_BUG_ON_PARANOID(skb_headlen(skb) < nhoff + sizeof(*ip));
As far as I know, the hardware doesn't support matching on both IP fields and vlan tag, but it can at least match on the vlan tag. Signed-off-by: Andy Lutomirski <luto@amacapital.net> --- Tested on the OpenOnload version of the driver, but the patch is the same other than some offset. With this patch, accelerated RFS works for me. (Oddly, some packets end up on otherwise idle cores, even when those cores have weight zero in ethtool --set-rxfh-indir; I'm not sure what's going on there.) drivers/net/ethernet/sfc/filter.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)