public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: jiri@resnulli.us, amir@vadai.me, john.fastabend@gmail.com,
	jhs@mojatatu.com, davem@davemloft.net
Cc: netdev@vger.kernel.org, jeffrey.t.kirsher@intel.com
Subject: [net-next PATCH v3 8/8] net: ixgbe: abort with cls u32 divisor groups greater than 1
Date: Tue, 16 Feb 2016 21:19:19 -0800	[thread overview]
Message-ID: <20160217051918.17139.61583.stgit@john-Precision-Tower-5810> (raw)
In-Reply-To: <20160217051418.17139.41052.stgit@john-Precision-Tower-5810>

This patch ensures ixgbe will not try to offload hash tables from the
u32 module. The device class does not currently support this so until
it is enabled just abort on these tables.

Interestingly the more flexible your hardware is the less code you
need to implement to guard against these cases.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe.h      |    1 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |   31 +++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index fc877c7..84fa28c 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -798,6 +798,7 @@ struct ixgbe_adapter {
 
 #define IXGBE_MAX_LINK_HANDLE 10
 	struct ixgbe_mat_field *jump_tables[IXGBE_MAX_LINK_HANDLE];
+	unsigned long tables;
 
 /* maximum number of RETA entries among all devices supported by ixgbe
  * driver: currently it's x550 device in non-SRIOV mode
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index abdfaea..cf4b729 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -8217,6 +8217,27 @@ static int ixgbe_delete_clsu32(struct ixgbe_adapter *adapter,
 	return err;
 }
 
+static int ixgbe_configure_clsu32_add_hnode(struct ixgbe_adapter *adapter,
+					    __be16 protocol,
+					    struct tc_cls_u32_offload *cls)
+{
+	/* This ixgbe devices do not support hash tables at the moment
+	 * so abort when given hash tables.
+	 */
+	if (cls->hnode.divisor > 0)
+		return -EINVAL;
+
+	set_bit(TC_U32_USERHTID(cls->hnode.handle), &adapter->tables);
+	return 0;
+}
+
+static int ixgbe_configure_clsu32_del_hnode(struct ixgbe_adapter *adapter,
+					    struct tc_cls_u32_offload *cls)
+{
+	clear_bit(TC_U32_USERHTID(cls->hnode.handle), &adapter->tables);
+	return 0;
+}
+
 static int ixgbe_configure_clsu32(struct ixgbe_adapter *adapter,
 				  __be16 protocol,
 				  struct tc_cls_u32_offload *cls)
@@ -8251,6 +8272,9 @@ static int ixgbe_configure_clsu32(struct ixgbe_adapter *adapter,
 		struct ixgbe_nexthdr *nexthdr = ixgbe_ipv4_jumps;
 		u32 uhtid = TC_U32_USERHTID(cls->knode.link_handle);
 
+		if (!test_bit(uhtid, &adapter->tables))
+			return -EINVAL;
+
 		for (i = 0; nexthdr[i].jump; i++) {
 			if (nexthdr->o != cls->knode.sel->offoff ||
 			    nexthdr->s != cls->knode.sel->offshift ||
@@ -8386,6 +8410,13 @@ int __ixgbe_setup_tc(struct net_device *dev, u32 handle, __be16 proto,
 						      proto, tc->cls_u32);
 		case TC_CLSU32_DELETE_KNODE:
 			return ixgbe_delete_clsu32(adapter, tc->cls_u32);
+		case TC_CLSU32_NEW_HNODE:
+		case TC_CLSU32_REPLACE_HNODE:
+			return ixgbe_configure_clsu32_add_hnode(adapter, proto,
+								tc->cls_u32);
+		case TC_CLSU32_DELETE_HNODE:
+			return ixgbe_configure_clsu32_del_hnode(adapter,
+								tc->cls_u32);
 		default:
 			return -EINVAL;
 		}

  parent reply	other threads:[~2016-02-17  5:19 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-17  5:15 [net-next PATCH v3 0/8] tc offload for cls_u32 on ixgbe John Fastabend
2016-02-17  5:16 ` [net-next PATCH v3 1/8] net: rework ndo tc op to consume additional qdisc handle parameter John Fastabend
2016-02-17 10:42   ` Jamal Hadi Salim
2016-02-17  5:16 ` [net-next PATCH v3 2/8] net: rework setup_tc ndo op to consume general tc operand John Fastabend
2016-02-17 10:42   ` Jamal Hadi Salim
2016-02-17  5:17 ` [net-next PATCH v3 3/8] net: sched: add cls_u32 offload hooks for netdevs John Fastabend
2016-02-17  7:02   ` Jiri Pirko
2016-02-17 10:59   ` Jamal Hadi Salim
2016-02-17 14:24     ` John Fastabend
2016-02-17 23:07       ` John Fastabend
2016-02-18  9:23         ` Amir Vadai"
2016-02-19  3:37           ` Simon Horman
2016-02-19  8:16           ` Or Gerlitz
2016-02-18 12:14         ` Jamal Hadi Salim
2016-02-18 15:24           ` John Fastabend
2016-02-19 12:52             ` Jamal Hadi Salim
2016-02-17  5:17 ` [net-next PATCH v3 4/8] net: add tc offload feature flag John Fastabend
2016-02-17 11:01   ` Jamal Hadi Salim
2016-02-17  5:18 ` [net-next PATCH v3 5/8] net: tc: helper functions to query action types John Fastabend
2016-02-17  7:03   ` Jiri Pirko
2016-02-17 11:02   ` Jamal Hadi Salim
2016-02-17  5:18 ` [net-next PATCH v3 6/8] net: ixgbe: add minimal parser details for ixgbe John Fastabend
2016-02-17 11:06   ` Jamal Hadi Salim
2016-02-17 15:09     ` David Miller
2016-02-17 15:14       ` John Fastabend
2016-02-17 18:01   ` Rustad, Mark D
2016-02-17 22:34     ` John Fastabend
2016-02-17  5:18 ` [net-next PATCH v3 7/8] net: ixgbe: add support for tc_u32 offload John Fastabend
2016-02-17 11:17   ` Jamal Hadi Salim
2016-02-17 11:42     ` Jiri Pirko
2016-02-17 11:47       ` Jamal Hadi Salim
2016-02-17 14:25         ` John Fastabend
2016-02-17  5:19 ` John Fastabend [this message]
2016-02-17 14:48 ` [net-next PATCH v3 0/8] tc offload for cls_u32 on ixgbe 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=20160217051918.17139.61583.stgit@john-Precision-Tower-5810 \
    --to=john.fastabend@gmail.com \
    --cc=amir@vadai.me \
    --cc=davem@davemloft.net \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --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