netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2 net 1/2] fm10k: Check tunnel header length in encap offload
@ 2014-11-13 23:36 Joe Stringer
  2014-11-13 23:36 ` [PATCHv2 net 2/2] fm10k: Implement ndo_gso_check() Joe Stringer
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Joe Stringer @ 2014-11-13 23:36 UTC (permalink / raw)
  To: netdev
  Cc: matthew.vick, jeffrey.t.kirsher, linux.nics, therbert, gerlitz.or,
	alexander.duyck, linux-kernel

fm10k supports up to 184 bytes of inner+outer headers. Add an initial
check to fail encap offload if these are too large.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
---
Matthew, I didn't see the equivalent patch on netdev so I went ahead and
created it. If I've missed this somewhere, then please disregard.

v2: First post.
---
 drivers/net/ethernet/intel/fm10k/fm10k_main.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
index e645af4..3a85291 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
@@ -732,6 +732,12 @@ static __be16 fm10k_tx_encap_offload(struct sk_buff *skb)
 	struct ethhdr *eth_hdr;
 	u8 l4_hdr = 0;
 
+/* fm10k supports 184 octets of outer+inner headers. Minus 20 for inner L4. */
+#define FM10K_MAX_ENCAP_TRANSPORT_OFFSET	164
+	if (skb_inner_transport_header(skb) - skb_mac_header(skb) >
+	    FM10K_MAX_ENCAP_TRANSPORT_OFFSET)
+		return 0;
+
 	switch (vlan_get_protocol(skb)) {
 	case htons(ETH_P_IP):
 		l4_hdr = ip_hdr(skb)->protocol;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-11-14  0:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-13 23:36 [PATCHv2 net 1/2] fm10k: Check tunnel header length in encap offload Joe Stringer
2014-11-13 23:36 ` [PATCHv2 net 2/2] fm10k: Implement ndo_gso_check() Joe Stringer
2014-11-13 23:41   ` Jeff Kirsher
2014-11-13 23:52     ` Joe Stringer
2014-11-14  0:12       ` Jeff Kirsher
2014-11-14  0:29         ` Joe Stringer
2014-11-13 23:41 ` [PATCHv2 net 1/2] fm10k: Check tunnel header length in encap offload Jeff Kirsher
2014-11-14  0:41 ` Vick, Matthew
2014-11-14  0:54   ` Joe Stringer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).