netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Joe Stringer <joestringer@nicira.com>,
	netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
	jogreene@redhat.com, Jesse Gross <jesse@nicira.com>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 01/16] i40e: Implement ndo_features_check()
Date: Mon, 13 Jul 2015 02:08:22 -0700	[thread overview]
Message-ID: <1436778517-16254-2-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1436778517-16254-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Joe Stringer <joestringer@nicira.com>

i40e supports UDP tunnel headers up to 80 bytes in length, so
this adds a check to ensure that it doesn't try to offload
packets that exceed that.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 48a52b3..b44eb35 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -8099,6 +8099,25 @@ static int i40e_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
 }
 #endif /* HAVE_BRIDGE_ATTRIBS */
 
+#define I40E_MAX_TUNNEL_HDR_LEN 80
+/**
+ * i40e_features_check - Validate encapsulated packet conforms to limits
+ * @skb: skb buff
+ * @netdev: This physical port's netdev
+ * @features: Offload features that the stack believes apply
+ **/
+static netdev_features_t i40e_features_check(struct sk_buff *skb,
+					     struct net_device *dev,
+					     netdev_features_t features)
+{
+	if (skb->encapsulation &&
+	    (skb_inner_mac_header(skb) - skb_transport_header(skb) >
+	     I40E_MAX_TUNNEL_HDR_LEN))
+		return features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK);
+
+	return features;
+}
+
 static const struct net_device_ops i40e_netdev_ops = {
 	.ndo_open		= i40e_open,
 	.ndo_stop		= i40e_close,
@@ -8133,6 +8152,7 @@ static const struct net_device_ops i40e_netdev_ops = {
 #endif
 	.ndo_get_phys_port_id	= i40e_get_phys_port_id,
 	.ndo_fdb_add		= i40e_ndo_fdb_add,
+	.ndo_features_check	= i40e_features_check,
 #ifdef HAVE_BRIDGE_ATTRIBS
 	.ndo_bridge_getlink	= i40e_ndo_bridge_getlink,
 	.ndo_bridge_setlink	= i40e_ndo_bridge_setlink,
-- 
2.4.3

  reply	other threads:[~2015-07-13  9:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-13  9:08 [net-next 00/16][pull request] Intel Wired LAN Driver Updates 2015-07-13 Jeff Kirsher
2015-07-13  9:08 ` Jeff Kirsher [this message]
2015-07-13  9:08 ` [net-next 02/16] i40e/i40evf: Add stats to track FD ATR and SB dynamic enable state Jeff Kirsher
2015-07-13  9:08 ` [net-next 03/16] i40e/i40evf: Update Flex-10 related device/function capabilities Jeff Kirsher
2015-07-13  9:08 ` [net-next 04/16] i40e/i40evf: improve Tx performance with a small tweak Jeff Kirsher
2015-07-13  9:08 ` [net-next 05/16] i40evf: Allow for an abundance of vectors Jeff Kirsher
2015-07-13  9:08 ` [net-next 06/16] i40e: ignore duplicate port VLAN requests Jeff Kirsher
2015-07-13  9:08 ` [net-next 07/16] i40e: Remove incorrect #ifdef's Jeff Kirsher
2015-07-13  9:08 ` [net-next 08/16] i40e/i40evf: Update the admin queue command header Jeff Kirsher
2015-07-13  9:08 ` [net-next 09/16] i40e: correctly program filters for VFs Jeff Kirsher
2015-07-13  9:08 ` [net-next 10/16] i40e: do a proper reset when disabling a VF Jeff Kirsher
2015-07-13  9:08 ` [net-next 11/16] i40e: un-disable VF after reset Jeff Kirsher
2015-07-13  9:08 ` [net-next 12/16] i40evf: don't delete all the filters Jeff Kirsher
2015-07-13 12:51   ` Sergei Shtylyov
2015-07-13  9:08 ` [net-next 13/16] i40evf: add MAC address filter in open, not init Jeff Kirsher
2015-07-13  9:08 ` [net-next 14/16] i40e/i40evf: Add support for pre-allocated pages for PD Jeff Kirsher
2015-07-13  9:08 ` [net-next 15/16] i40e: Refine an error message to avoid confusion Jeff Kirsher
2015-07-13  9:08 ` [net-next 16/16] i40e/i40evf: Bump version to 1.3.6 for i40e and 1.3.2 for i40evf Jeff Kirsher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1436778517-16254-2-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=davem@davemloft.net \
    --cc=jesse@nicira.com \
    --cc=joestringer@nicira.com \
    --cc=jogreene@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@redhat.com \
    --cc=sassmann@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).