From: Manish Chopra <manish.chopra@qlogic.com>
To: <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <Yuval.Mintz@qlogic.com>,
Manish Chopra <manish.chopra@caviumnetworks.com>
Subject: [PATCH v3 net-next 3/7] qede: Prevent GSO on long Geneve headers
Date: Fri, 14 Oct 2016 05:19:19 -0400 [thread overview]
Message-ID: <1476436763-5274-4-git-send-email-manish.chopra@qlogic.com> (raw)
In-Reply-To: <1476436763-5274-1-git-send-email-manish.chopra@qlogic.com>
From: Manish Chopra <manish.chopra@caviumnetworks.com>
Due to hardware limitation, when transmitting a geneve-encapsulated
packet with more than 32 bytes worth of geneve options the hardware
would not be able to crack the packet and consider it a regular UDP
packet.
This implements the ndo_features_check() in qede in order to prevent
GSO on said transmitted packets.
Signed-off-by: Manish Chopra <manish.chopra@caviumnetworks.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
---
drivers/net/ethernet/qlogic/qede/qede_main.c | 35 ++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c
index 7d5dc1e..6c2b09c 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_main.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_main.c
@@ -2240,6 +2240,40 @@ static void qede_udp_tunnel_del(struct net_device *dev,
schedule_delayed_work(&edev->sp_task, 0);
}
+/* 8B udp header + 8B base tunnel header + 32B option length */
+#define QEDE_MAX_TUN_HDR_LEN 48
+
+static netdev_features_t qede_features_check(struct sk_buff *skb,
+ struct net_device *dev,
+ netdev_features_t features)
+{
+ if (skb->encapsulation) {
+ u8 l4_proto = 0;
+
+ switch (vlan_get_protocol(skb)) {
+ case htons(ETH_P_IP):
+ l4_proto = ip_hdr(skb)->protocol;
+ break;
+ case htons(ETH_P_IPV6):
+ l4_proto = ipv6_hdr(skb)->nexthdr;
+ break;
+ default:
+ return features;
+ }
+
+ /* Disable offloads for geneve tunnels, as HW can't parse
+ * the geneve header which has option length greater than 32B.
+ */
+ if ((l4_proto == IPPROTO_UDP) &&
+ ((skb_inner_mac_header(skb) -
+ skb_transport_header(skb)) > QEDE_MAX_TUN_HDR_LEN))
+ return features & ~(NETIF_F_CSUM_MASK |
+ NETIF_F_GSO_MASK);
+ }
+
+ return features;
+}
+
static const struct net_device_ops qede_netdev_ops = {
.ndo_open = qede_open,
.ndo_stop = qede_close,
@@ -2264,6 +2298,7 @@ static const struct net_device_ops qede_netdev_ops = {
#endif
.ndo_udp_tunnel_add = qede_udp_tunnel_add,
.ndo_udp_tunnel_del = qede_udp_tunnel_del,
+ .ndo_features_check = qede_features_check,
};
/* -------------------------------------------------------------------------
--
2.7.2
next prev parent reply other threads:[~2016-10-14 10:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-14 9:19 [PATCH v3 net-next 0/7] qed*: driver updates Manish Chopra
2016-10-14 9:19 ` [PATCH v3 net-next 1/7] qed: Pass MAC hints to VFs Manish Chopra
2016-10-14 9:19 ` [PATCH v3 net-next 2/7] qede: GSO support for tunnels with outer csum Manish Chopra
2016-10-14 9:19 ` Manish Chopra [this message]
2016-10-14 9:19 ` [PATCH v3 net-next 4/7] qed*: Allow unicast filtering Manish Chopra
2016-10-14 9:19 ` [PATCH v3 net-next 5/7] qed: Allow chance for fast ramrod completions Manish Chopra
2016-10-14 9:19 ` [PATCH v3 net-next 6/7] qed: Handle malicious VFs events Manish Chopra
2016-10-14 9:19 ` [PATCH v3 net-next 7/7] qed: Fix possible race when reading firmware return code Manish Chopra
2016-10-14 16:00 ` [PATCH v3 net-next 0/7] qed*: driver updates David Miller
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=1476436763-5274-4-git-send-email-manish.chopra@qlogic.com \
--to=manish.chopra@qlogic.com \
--cc=Yuval.Mintz@qlogic.com \
--cc=davem@davemloft.net \
--cc=manish.chopra@caviumnetworks.com \
--cc=netdev@vger.kernel.org \
/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).