* [Intel-wired-lan] [PATCH v2 net-next] ixgbe: Avoid unaligned access in ixgbe_atr() for LLC packets @ 2016-03-14 17:46 ` Sowmini Varadhan 0 siblings, 0 replies; 10+ messages in thread From: Sowmini Varadhan @ 2016-03-14 17:46 UTC (permalink / raw) To: intel-wired-lan For LLC based protocols like lldp, stp etc., the ethernet header is an 802.3 header with a h_proto that is not 0x800, 0x86dd, or even 0x806. In this world, the skb_network_header() points at the DSAP/SSAP/.. and is not likely to be NET_IP_ALIGNed in ixgbe_atr(). With LLC, drivers are not likely to correctly find IPVERSION, or "6", at hdr.ipv4->version, but will instead just needlessly trigger an unaligned access. (IPv4/IPv6 over LLC is almost never implemented). The unaligned access is thus avoidable: bail out quickly after examining first->protocol. Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com> --- v2: Alexander Duyck comments. drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 4d6223d..b25e603 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -7574,6 +7574,11 @@ static void ixgbe_atr(struct ixgbe_ring *ring, if (!ring->atr_sample_rate) return; + if (first->protocol != htons(ETH_P_IP) && + first->protocol != htons(ETH_P_IPV6) && + first->protocol != htons(ETH_P_ARP)) + return; + ring->atr_count++; /* snag network header to get L4 type and address */ -- 1.7.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 net-next] ixgbe: Avoid unaligned access in ixgbe_atr() for LLC packets @ 2016-03-14 17:46 ` Sowmini Varadhan 0 siblings, 0 replies; 10+ messages in thread From: Sowmini Varadhan @ 2016-03-14 17:46 UTC (permalink / raw) To: intel-wired-lan, netdev Cc: sowmini.varadhan, alexander.duyck, jeffrey.t.kirsher, jesse.brandeburg, shannon.nelson, carolyn.wyborny, donald.c.skidmore, bruce.w.allan, john.ronciak, mitch.a.williams For LLC based protocols like lldp, stp etc., the ethernet header is an 802.3 header with a h_proto that is not 0x800, 0x86dd, or even 0x806. In this world, the skb_network_header() points at the DSAP/SSAP/.. and is not likely to be NET_IP_ALIGNed in ixgbe_atr(). With LLC, drivers are not likely to correctly find IPVERSION, or "6", at hdr.ipv4->version, but will instead just needlessly trigger an unaligned access. (IPv4/IPv6 over LLC is almost never implemented). The unaligned access is thus avoidable: bail out quickly after examining first->protocol. Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com> --- v2: Alexander Duyck comments. drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 4d6223d..b25e603 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -7574,6 +7574,11 @@ static void ixgbe_atr(struct ixgbe_ring *ring, if (!ring->atr_sample_rate) return; + if (first->protocol != htons(ETH_P_IP) && + first->protocol != htons(ETH_P_IPV6) && + first->protocol != htons(ETH_P_ARP)) + return; + ring->atr_count++; /* snag network header to get L4 type and address */ -- 1.7.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Intel-wired-lan] [PATCH v2 net-next] ixgbe: Avoid unaligned access in ixgbe_atr() for LLC packets 2016-03-14 17:46 ` Sowmini Varadhan @ 2016-03-14 17:55 ` Alexander Duyck -1 siblings, 0 replies; 10+ messages in thread From: Alexander Duyck @ 2016-03-14 17:55 UTC (permalink / raw) To: intel-wired-lan On Mon, Mar 14, 2016 at 10:46 AM, Sowmini Varadhan <sowmini.varadhan@oracle.com> wrote: > > For LLC based protocols like lldp, stp etc., the ethernet header > is an 802.3 header with a h_proto that is not 0x800, 0x86dd, or > even 0x806. In this world, the skb_network_header() points at > the DSAP/SSAP/.. and is not likely to be NET_IP_ALIGNed in > ixgbe_atr(). > > With LLC, drivers are not likely to correctly find IPVERSION, > or "6", at hdr.ipv4->version, but will instead just needlessly > trigger an unaligned access. (IPv4/IPv6 over LLC is almost never > implemented). > > The unaligned access is thus avoidable: bail out quickly after > examining first->protocol. > > Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com> > --- > v2: Alexander Duyck comments. > > drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 5 +++++ > 1 files changed, 5 insertions(+), 0 deletions(-) > > diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c > index 4d6223d..b25e603 100644 > --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c > +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c > @@ -7574,6 +7574,11 @@ static void ixgbe_atr(struct ixgbe_ring *ring, > if (!ring->atr_sample_rate) > return; > > + if (first->protocol != htons(ETH_P_IP) && > + first->protocol != htons(ETH_P_IPV6) && > + first->protocol != htons(ETH_P_ARP)) > + return; > + One other thing I forgot to mention is that we don't support ARP so that check could be dropped. The ATR code only supports IPv4 or IPv6 with TCP. - Alex ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 net-next] ixgbe: Avoid unaligned access in ixgbe_atr() for LLC packets @ 2016-03-14 17:55 ` Alexander Duyck 0 siblings, 0 replies; 10+ messages in thread From: Alexander Duyck @ 2016-03-14 17:55 UTC (permalink / raw) To: Sowmini Varadhan Cc: intel-wired-lan, Netdev, Jeff Kirsher, Brandeburg, Jesse, shannon nelson, Carolyn Wyborny, Skidmore, Donald C, Bruce W Allan, John Ronciak, Mitch Williams On Mon, Mar 14, 2016 at 10:46 AM, Sowmini Varadhan <sowmini.varadhan@oracle.com> wrote: > > For LLC based protocols like lldp, stp etc., the ethernet header > is an 802.3 header with a h_proto that is not 0x800, 0x86dd, or > even 0x806. In this world, the skb_network_header() points at > the DSAP/SSAP/.. and is not likely to be NET_IP_ALIGNed in > ixgbe_atr(). > > With LLC, drivers are not likely to correctly find IPVERSION, > or "6", at hdr.ipv4->version, but will instead just needlessly > trigger an unaligned access. (IPv4/IPv6 over LLC is almost never > implemented). > > The unaligned access is thus avoidable: bail out quickly after > examining first->protocol. > > Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com> > --- > v2: Alexander Duyck comments. > > drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 5 +++++ > 1 files changed, 5 insertions(+), 0 deletions(-) > > diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c > index 4d6223d..b25e603 100644 > --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c > +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c > @@ -7574,6 +7574,11 @@ static void ixgbe_atr(struct ixgbe_ring *ring, > if (!ring->atr_sample_rate) > return; > > + if (first->protocol != htons(ETH_P_IP) && > + first->protocol != htons(ETH_P_IPV6) && > + first->protocol != htons(ETH_P_ARP)) > + return; > + One other thing I forgot to mention is that we don't support ARP so that check could be dropped. The ATR code only supports IPv4 or IPv6 with TCP. - Alex ^ permalink raw reply [flat|nested] 10+ messages in thread
* [Intel-wired-lan] [PATCH v2 net-next] ixgbe: Avoid unaligned access in ixgbe_atr() for LLC packets 2016-03-14 17:55 ` Alexander Duyck @ 2016-03-14 17:59 ` Sowmini Varadhan -1 siblings, 0 replies; 10+ messages in thread From: Sowmini Varadhan @ 2016-03-14 17:59 UTC (permalink / raw) To: intel-wired-lan On (03/14/16 10:55), Alexander Duyck wrote: > > One other thing I forgot to mention is that we don't support ARP so > that check could be dropped. The ATR code only supports IPv4 or IPv6 > with TCP. I did notice that, but I left it in place because (a) it comes down the stack with the NET_IP_ALIGNment and (b) ARP is only sent over Ethernet II (there is no LLC SAP for ARP, which is a big reason why ipv4 is not sent over llc, despite rfc 1042). I figured it would not hurt to pass it down, in case we decide to do something clever with it in the future. --Sowmini ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 net-next] ixgbe: Avoid unaligned access in ixgbe_atr() for LLC packets @ 2016-03-14 17:59 ` Sowmini Varadhan 0 siblings, 0 replies; 10+ messages in thread From: Sowmini Varadhan @ 2016-03-14 17:59 UTC (permalink / raw) To: Alexander Duyck Cc: intel-wired-lan, Netdev, Jeff Kirsher, Brandeburg, Jesse, shannon nelson, Carolyn Wyborny, Skidmore, Donald C, Bruce W Allan, John Ronciak, Mitch Williams On (03/14/16 10:55), Alexander Duyck wrote: > > One other thing I forgot to mention is that we don't support ARP so > that check could be dropped. The ATR code only supports IPv4 or IPv6 > with TCP. I did notice that, but I left it in place because (a) it comes down the stack with the NET_IP_ALIGNment and (b) ARP is only sent over Ethernet II (there is no LLC SAP for ARP, which is a big reason why ipv4 is not sent over llc, despite rfc 1042). I figured it would not hurt to pass it down, in case we decide to do something clever with it in the future. --Sowmini ^ permalink raw reply [flat|nested] 10+ messages in thread
* [Intel-wired-lan] [PATCH v2 net-next] ixgbe: Avoid unaligned access in ixgbe_atr() for LLC packets 2016-03-14 17:59 ` Sowmini Varadhan @ 2016-03-14 19:20 ` Alexander Duyck -1 siblings, 0 replies; 10+ messages in thread From: Alexander Duyck @ 2016-03-14 19:20 UTC (permalink / raw) To: intel-wired-lan On Mon, Mar 14, 2016 at 10:59 AM, Sowmini Varadhan <sowmini.varadhan@oracle.com> wrote: > On (03/14/16 10:55), Alexander Duyck wrote: >> >> One other thing I forgot to mention is that we don't support ARP so >> that check could be dropped. The ATR code only supports IPv4 or IPv6 >> with TCP. > > I did notice that, but I left it in place because (a) it comes down > the stack with the NET_IP_ALIGNment and (b) ARP is only sent over > Ethernet II (there is no LLC SAP for ARP, which is a big reason > why ipv4 is not sent over llc, despite rfc 1042). > > I figured it would not hurt to pass it down, in case we decide > to do something clever with it in the future. I figure it is better to just drop it since we don't need to be trying to parse ARP packets anyway. - Alex ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 net-next] ixgbe: Avoid unaligned access in ixgbe_atr() for LLC packets @ 2016-03-14 19:20 ` Alexander Duyck 0 siblings, 0 replies; 10+ messages in thread From: Alexander Duyck @ 2016-03-14 19:20 UTC (permalink / raw) To: Sowmini Varadhan Cc: intel-wired-lan, Netdev, Jeff Kirsher, Brandeburg, Jesse, shannon nelson, Carolyn Wyborny, Skidmore, Donald C, Bruce W Allan, John Ronciak, Mitch Williams On Mon, Mar 14, 2016 at 10:59 AM, Sowmini Varadhan <sowmini.varadhan@oracle.com> wrote: > On (03/14/16 10:55), Alexander Duyck wrote: >> >> One other thing I forgot to mention is that we don't support ARP so >> that check could be dropped. The ATR code only supports IPv4 or IPv6 >> with TCP. > > I did notice that, but I left it in place because (a) it comes down > the stack with the NET_IP_ALIGNment and (b) ARP is only sent over > Ethernet II (there is no LLC SAP for ARP, which is a big reason > why ipv4 is not sent over llc, despite rfc 1042). > > I figured it would not hurt to pass it down, in case we decide > to do something clever with it in the future. I figure it is better to just drop it since we don't need to be trying to parse ARP packets anyway. - Alex ^ permalink raw reply [flat|nested] 10+ messages in thread
* [Intel-wired-lan] [PATCH v2 net-next] ixgbe: Avoid unaligned access in ixgbe_atr() for LLC packets 2016-03-14 19:20 ` Alexander Duyck @ 2016-03-14 19:32 ` Sowmini Varadhan -1 siblings, 0 replies; 10+ messages in thread From: Sowmini Varadhan @ 2016-03-14 19:32 UTC (permalink / raw) To: intel-wired-lan On (03/14/16 12:20), Alexander Duyck wrote: > I figure it is better to just drop it since we don't need to be trying > to parse ARP packets anyway. Ok, let me send out v3. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 net-next] ixgbe: Avoid unaligned access in ixgbe_atr() for LLC packets @ 2016-03-14 19:32 ` Sowmini Varadhan 0 siblings, 0 replies; 10+ messages in thread From: Sowmini Varadhan @ 2016-03-14 19:32 UTC (permalink / raw) To: Alexander Duyck Cc: intel-wired-lan, Netdev, Jeff Kirsher, Brandeburg, Jesse, shannon nelson, Carolyn Wyborny, Skidmore, Donald C, Bruce W Allan, John Ronciak, Mitch Williams On (03/14/16 12:20), Alexander Duyck wrote: > I figure it is better to just drop it since we don't need to be trying > to parse ARP packets anyway. Ok, let me send out v3. ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-03-14 19:33 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-03-14 17:46 [Intel-wired-lan] [PATCH v2 net-next] ixgbe: Avoid unaligned access in ixgbe_atr() for LLC packets Sowmini Varadhan 2016-03-14 17:46 ` Sowmini Varadhan 2016-03-14 17:55 ` [Intel-wired-lan] " Alexander Duyck 2016-03-14 17:55 ` Alexander Duyck 2016-03-14 17:59 ` [Intel-wired-lan] " Sowmini Varadhan 2016-03-14 17:59 ` Sowmini Varadhan 2016-03-14 19:20 ` [Intel-wired-lan] " Alexander Duyck 2016-03-14 19:20 ` Alexander Duyck 2016-03-14 19:32 ` [Intel-wired-lan] " Sowmini Varadhan 2016-03-14 19:32 ` Sowmini Varadhan
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.