Skip to contentSkip to conversation

ixgbe/igb: integrate syn filter to new API

PATCH New zhida zang 3 participants 10 messages Jan 8, 2015 – Feb 22, 2015 2 messages not in the archive

lore
Share & tools
lore

zhida zang

author
#0 lore raw

PATCH 1/1 ixgbe/igb: integrate syn filter to new API

This patch integrates syn filter to new API in ixgbe/igb driver.

changes:
ixgbe: remove old functions that deal with syn filter
ixgbe: add new functions that deal with syn filter (fit for filter_ctrl API)
e1000: remove old functions that deal with syn filter
e1000: add new functions that deal with syn filter (fit for filter_ctrl API)
testpmd: change the entry for syn filter in cmdline
testpmd: change function call to get syn filter in config

---
 app/test-pmd/cmdline.c              | 179 ++++++++++++++++++++---------------
 app/test-pmd/config.c               |  10 +-
 lib/librte_ether/rte_eth_ctrl.h     |  12 +++
 lib/librte_pmd_e1000/igb_ethdev.c   | 176 ++++++++++++++++++++--------------
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 182 ++++++++++++++++++++----------------
 5 files changed, 331 insertions(+), 228 deletions(-)
app/test-pmd/cmdline.c +104 -75
index 4c3fc76..820b3a6 100644
@@ -665,13 +665,13 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"get_5tuple_filter (port_id) index (idx)\n"
 			"    get info of a 5tuple filter.\n\n"
 
-			"add_syn_filter (port_id) priority (high|low) queue (queue_id)"
+			"syn_filter add (port_id) priority (high|low) queue (queue_id)"
 			"    add syn filter.\n\n"
 
-			"remove_syn_filter (port_id)"
+			"syn_filter del (port_id)"
 			"    remove syn filter.\n\n"
 
-			"get_syn_filter (port_id) "
+			"syn_filter get (port_id) "
 			"    get syn filter info.\n\n"
 
 			"add_flex_filter (port_id) len (len_value) bytes (bytes_string) mask (mask_value)"
@@ -7044,101 +7044,130 @@ cmdline_parse_inst_t cmd_get_ethertype_filter = {
 	},
 };
 
-/* *** set SYN filter *** */
-struct cmd_set_syn_filter_result {
+/* *** Add/Del/Get syn filter *** */
+struct cmd_syn_filter_result {
 	cmdline_fixed_string_t filter;
+	cmdline_fixed_string_t  ops;
 	uint8_t port_id;
 	cmdline_fixed_string_t priority;
 	cmdline_fixed_string_t high;
 	cmdline_fixed_string_t queue;
-	uint16_t  queue_id;
+	uint16_t queue_id;
 };
 
-static void
-cmd_set_syn_filter_parsed(void *parsed_result,
-			__attribute__((unused)) struct cmdline *cl,
-			__attribute__((unused)) void *data)
-{
-	int ret = 0;
-	struct cmd_set_syn_filter_result *res = parsed_result;
-	struct rte_syn_filter filter;
-
-	if (!strcmp(res->filter, "add_syn_filter")) {
-		if (!strcmp(res->high, "high"))
-			filter.hig_pri = 1;
-		else
-			filter.hig_pri = 0;
-		ret = rte_eth_dev_add_syn_filter(res->port_id,
-				&filter, res->queue_id);
-	} else if (!strcmp(res->filter, "remove_syn_filter"))
-		ret = rte_eth_dev_remove_syn_filter(res->port_id);
-	else if (!strcmp(res->filter, "get_syn_filter"))
-		get_syn_filter(res->port_id);
-	if (ret < 0)
-		printf("syn filter setting error: (%s)\n", strerror(-ret));
-
-}
-cmdline_parse_token_num_t cmd_syn_filter_portid =
-	TOKEN_NUM_INITIALIZER(struct cmd_set_syn_filter_result,
-				port_id, UINT8);
+cmdline_parse_token_string_t cmd_syn_filter_filter =
+	TOKEN_STRING_INITIALIZER(struct cmd_syn_filter_result,
+	filter, "syn_filter");
+cmdline_parse_token_string_t cmd_syn_filter_add =
+	TOKEN_STRING_INITIALIZER(struct cmd_syn_filter_result,
+	ops, "add");
+cmdline_parse_token_string_t cmd_syn_filter_del =
+	TOKEN_STRING_INITIALIZER(struct cmd_syn_filter_result,
+	ops, "del");
+cmdline_parse_token_string_t cmd_syn_filter_get =
+	TOKEN_STRING_INITIALIZER(struct cmd_syn_filter_result,
+	ops, "get");
+cmdline_parse_token_num_t cmd_syn_filter_port_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_syn_filter_result,
+	port_id, UINT8);
 cmdline_parse_token_string_t cmd_syn_filter_priority =
-	TOKEN_STRING_INITIALIZER(struct cmd_set_syn_filter_result,
+	TOKEN_STRING_INITIALIZER(struct cmd_syn_filter_result,
 				priority, "priority");
 cmdline_parse_token_string_t cmd_syn_filter_high =
-	TOKEN_STRING_INITIALIZER(struct cmd_set_syn_filter_result,
+	TOKEN_STRING_INITIALIZER(struct cmd_syn_filter_result,
 				high, "high#low");
 cmdline_parse_token_string_t cmd_syn_filter_queue =
-	TOKEN_STRING_INITIALIZER(struct cmd_set_syn_filter_result,
+	TOKEN_STRING_INITIALIZER(struct cmd_syn_filter_result,
 				queue, "queue");
 cmdline_parse_token_num_t cmd_syn_filter_queue_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_set_syn_filter_result,
+	TOKEN_NUM_INITIALIZER(struct cmd_syn_filter_result,
 				queue_id, UINT16);
-cmdline_parse_token_string_t cmd_syn_filter_add_filter =
-	TOKEN_STRING_INITIALIZER(struct cmd_set_syn_filter_result,
-				filter, "add_syn_filter");
-cmdline_parse_token_string_t cmd_syn_filter_remove_filter =
-	TOKEN_STRING_INITIALIZER(struct cmd_set_syn_filter_result,
-				filter, "remove_syn_filter");
+static void
+cmd_syn_filter_parsed(void *parsed_result, struct cmdline *cl,
+				void *data);
+
 cmdline_parse_inst_t cmd_add_syn_filter = {
-		.f = cmd_set_syn_filter_parsed,
-		.data = NULL,
-		.help_str = "add syn filter",
-		.tokens = {
-			(void *)&cmd_syn_filter_add_filter,
-			(void *)&cmd_syn_filter_portid,
-			(void *)&cmd_syn_filter_priority,
-			(void *)&cmd_syn_filter_high,
-			(void *)&cmd_syn_filter_queue,
-			(void *)&cmd_syn_filter_queue_id,
-			NULL,
-		},
+	.f = cmd_syn_filter_parsed,
+	.data = (void *)&cmd_add_syn_filter,
+	.help_str = "add syn filter",
+	.tokens = {
+		(void *)&cmd_syn_filter_filter,
+		(void *)&cmd_syn_filter_add,
+		(void *)&cmd_syn_filter_port_id,
+		(void *)&cmd_syn_filter_priority,
+		(void *)&cmd_syn_filter_high,
+		(void *)&cmd_syn_filter_queue,
+		(void *)&cmd_syn_filter_queue_id,
+		NULL,
+	},
 };
 cmdline_parse_inst_t cmd_remove_syn_filter = {
-		.f = cmd_set_syn_filter_parsed,
-		.data = NULL,
-		.help_str = "remove syn filter",
-		.tokens = {
-			(void *)&cmd_syn_filter_remove_filter,
-			(void *)&cmd_syn_filter_portid,
-			NULL,
-		},
+	.f = cmd_syn_filter_parsed,
+	.data = (void *)&cmd_remove_syn_filter,
+	.help_str = "remove syn filter",
+	.tokens = {
+		(void *)&cmd_syn_filter_filter,
+		(void *)&cmd_syn_filter_del,
+		(void *)&cmd_syn_filter_port_id,
+		NULL,
+	},
 };
 
-cmdline_parse_token_string_t cmd_syn_filter_get_filter =
-	TOKEN_STRING_INITIALIZER(struct cmd_set_syn_filter_result,
-				filter, "get_syn_filter");
-
 cmdline_parse_inst_t cmd_get_syn_filter = {
-		.f = cmd_set_syn_filter_parsed,
-		.data = NULL,
-		.help_str = "get syn filter",
-		.tokens = {
-			(void *)&cmd_syn_filter_get_filter,
-			(void *)&cmd_syn_filter_portid,
-			NULL,
-		},
+	.f = cmd_syn_filter_parsed,
+	.data = (void *)&cmd_get_syn_filter,
+	.help_str = "get syn filter",
+	.tokens = {
+		(void *)&cmd_syn_filter_filter,
+		(void *)&cmd_syn_filter_get,
+		(void *)&cmd_syn_filter_port_id,
+		NULL,
+	},
 };
 
+static void
+cmd_syn_filter_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_syn_filter_result *res = parsed_result;
+	struct rte_eth_syn_filter syn_filter;
+	int ret = 0;
+
+	ret = rte_eth_dev_filter_supported(res->port_id,
+					RTE_ETH_FILTER_SYN);
+	if (ret < 0) {
+		printf("syn filter is not supported on port %u.\n",
+				res->port_id);
+		return;
+	}
+
+	memset(&syn_filter, 0, sizeof(syn_filter));
+
+	if (!strcmp(res->ops, "add")) {
+		if (!strcmp(res->high, "high"))
+			syn_filter.hig_pri = 1;
+		else
+			syn_filter.hig_pri = 0;
+
+		syn_filter.queue = res->queue_id;
+		ret = rte_eth_dev_filter_ctrl(res->port_id,
+						RTE_ETH_FILTER_SYN,
+						RTE_ETH_FILTER_ADD,
+						&syn_filter);
+	} else if (!strcmp(res->ops, "del"))
+		ret = rte_eth_dev_filter_ctrl(res->port_id,
+						RTE_ETH_FILTER_SYN,
+						RTE_ETH_FILTER_DELETE,
+						&syn_filter);
+	else
+		get_syn_filter(res->port_id);
+
+	if (ret < 0)
+		printf("syn filter programming error: (%s)\n",
+				strerror(-ret));
+}
+
 /* *** ADD/REMOVE A 2tuple FILTER *** */
 struct cmd_2tuple_filter_result {
 	cmdline_fixed_string_t filter;
app/test-pmd/config.c +6 -4
index b102b72..10278b3 100644
@@ -2020,12 +2020,14 @@ get_ethertype_filter(uint8_t port_id, uint16_t index)
 void
 get_syn_filter(uint8_t port_id)
 {
-	struct rte_syn_filter filter;
+	struct rte_eth_syn_filter filter;
 	int ret = 0;
-	uint16_t rx_queue;
 
 	memset(&filter, 0, sizeof(filter));
-	ret = rte_eth_dev_get_syn_filter(port_id, &filter, &rx_queue);
+	ret = rte_eth_dev_filter_ctrl(port_id,
+			RTE_ETH_FILTER_SYN,
+			RTE_ETH_FILTER_GET,
+			&filter);
 
 	if (ret < 0) {
 		if (ret == (-ENOENT))
@@ -2036,7 +2038,7 @@ get_syn_filter(uint8_t port_id)
 	}
 	printf("syn filter: priority: %s, queue: %d\n",
 		filter.hig_pri ? "high" : "low",
-		rx_queue);
+		filter.queue);
 }
 void
 get_2tuple_filter(uint8_t port_id, uint16_t index)
lib/librte_ether/rte_eth_ctrl.h +12 -0
index 8dd384d..14dc323 100644
@@ -53,6 +53,7 @@ enum rte_filter_type {
 	RTE_ETH_FILTER_NONE = 0,
 	RTE_ETH_FILTER_MACVLAN,
 	RTE_ETH_FILTER_TUNNEL,
+	RTE_ETH_FILTER_SYN,
 	RTE_ETH_FILTER_MAX
 };
 
@@ -96,6 +97,17 @@ struct rte_eth_mac_filter {
 };
 
 /**
+ * A structure used to define the sync filter entry
+ * to support RTE_ETH_FILTER_SYN with RTE_ETH_FILTER_ADD,
+ * RTE_ETH_FILTER_DELETE and RTE_ETH_FILTER_GET operations.
+ */
+struct rte_eth_syn_filter {
+	uint8_t hig_pri;	/**< 1 means higher pri than 2tuple,5tuple,
+				and flex filter, 0 means lower pri.*/
+	uint16_t queue;		/**< Queue assigned to when match*/
+};
+
+/**
  * Tunneled type.
  */
 enum rte_eth_tunnel_type {
lib/librte_pmd_e1000/igb_ethdev.c +105 -71

231 lines not on this page · raw message

lib/librte_pmd_ixgbe/ixgbe_ethdev.c +104 -78

235 lines not on this page · raw message

Signature · 1 line
1.9.3

A message that is not in the archive (sent off-list or not yet received): 1420681358-24809-1-git-send-email-zhida.zang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#2 lore raw

v2 cover Integrate syn filter in igb/ixgbe driver to new API

v2 changes:
- split one patch to patch series
- change the command's format in testpmd.
- return -ENOENT when deleting a disabled syn filter.
- add doc changes in testpmd_funcs.rst
- correct the errors reported by checkpatch.pl

The patch set uses new filter_ctrl API to replace old syn filter APIs. It uses new functions and structure to replace old ones in igb/ixgbe driver, new commands to replace old ones in testpmd, and removes the old APIs.

Jingjing Wu (6):
ethdev: define syn filter type and its structure
ixgbe: new functions replace old ones for syn filter
e1000: new functions replace old ones for syn filter
testpmd: new commands for syn filter
ethdev: remove old APIs and structures of syn filter
doc: commands changed in testpmd_funcs for syn filter

 app/test-pmd/cmdline.c                      | 143 +++++++++++-------------
 app/test-pmd/config.c                       |  21 ----
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  30 +----
 lib/librte_ether/rte_eth_ctrl.h             |  12 ++
 lib/librte_ether/rte_ethdev.c               |  50 ---------
 lib/librte_ether/rte_ethdev.h               |  67 -----------
 lib/librte_pmd_e1000/igb_ethdev.c           | 152 +++++++++++++------------
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c         | 167 ++++++++++++++--------------
 8 files changed, 243 insertions(+), 399 deletions(-)
Signature · 1 line
1.9.3

A message that is not in the archive (sent off-list or not yet received): 1423641110-658-1-git-send-email-jingjing.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#4 lore raw

PATCH v2 1/6 ethdev: define syn filter type and its structure

This patch defines syn filter type RTE_ETH_FILTER_SYN and its structure rte_eth_syn_filter.

---
 lib/librte_ether/rte_eth_ctrl.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
lib/librte_ether/rte_eth_ctrl.h +12 -0
index 0ce241e..21ee9e3 100644
@@ -53,6 +53,7 @@ enum rte_filter_type {
 	RTE_ETH_FILTER_NONE = 0,
 	RTE_ETH_FILTER_MACVLAN,
 	RTE_ETH_FILTER_ETHERTYPE,
+	RTE_ETH_FILTER_SYN,
 	RTE_ETH_FILTER_TUNNEL,
 	RTE_ETH_FILTER_FDIR,
 	RTE_ETH_FILTER_HASH,
@@ -117,6 +118,17 @@ struct rte_eth_ethertype_filter {
 };
 
 /**
+ * A structure used to define the TCP syn filter entry
+ * to support RTE_ETH_FILTER_SYN with RTE_ETH_FILTER_ADD,
+ * RTE_ETH_FILTER_DELETE and RTE_ETH_FILTER_GET operations.
+ */
+struct rte_eth_syn_filter {
+	uint8_t hig_pri;     /**< 1 - higher priority than other filters,
+				  0 - lower priority. */
+	uint16_t queue;      /**< Queue assigned to when match */
+};
+
+/**
  * Tunneled type.
  */
 enum rte_eth_tunnel_type {
Signature · 1 line
1.9.3
#5 lore raw

PATCH v2 2/6 ixgbe: new functions replace old ones for syn filter

In reply to a message not in the archive

This patch defines new functions dealing with syn filter. It removes old functions which deal with syn filter. Syn filter is dealt with through entrance ixgbe_dev_filter_ctrl.

---
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 167 +++++++++++++++++-------------------
 1 file changed, 81 insertions(+), 86 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +81 -86
index b341dd0..0616c8f 100644
@@ -226,11 +226,14 @@ static void ixgbevf_add_mac_addr(struct rte_eth_dev *dev,
 				 struct ether_addr *mac_addr,
 				 uint32_t index, uint32_t pool);
 static void ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index);
-static int ixgbe_add_syn_filter(struct rte_eth_dev *dev,
-			struct rte_syn_filter *filter, uint16_t rx_queue);
-static int ixgbe_remove_syn_filter(struct rte_eth_dev *dev);
-static int ixgbe_get_syn_filter(struct rte_eth_dev *dev,
-			struct rte_syn_filter *filter, uint16_t *rx_queue);
+static int ixgbe_syn_filter_set(struct rte_eth_dev *dev,
+			struct rte_eth_syn_filter *filter,
+			bool add);
+static int ixgbe_syn_filter_get(struct rte_eth_dev *dev,
+			struct rte_eth_syn_filter *filter);
+static int ixgbe_syn_filter_handle(struct rte_eth_dev *dev,
+			enum rte_filter_op filter_op,
+			void *arg);
 static int ixgbe_add_5tuple_filter(struct rte_eth_dev *dev, uint16_t index,
 			struct rte_5tuple_filter *filter, uint16_t rx_queue);
 static int ixgbe_remove_5tuple_filter(struct rte_eth_dev *dev,
@@ -383,9 +386,6 @@ static struct eth_dev_ops ixgbe_eth_dev_ops = {
 #endif /* RTE_NIC_BYPASS */
 	.rss_hash_update      = ixgbe_dev_rss_hash_update,
 	.rss_hash_conf_get    = ixgbe_dev_rss_hash_conf_get,
-	.add_syn_filter	         = ixgbe_add_syn_filter,
-	.remove_syn_filter       = ixgbe_remove_syn_filter,
-	.get_syn_filter          = ixgbe_get_syn_filter,
 	.add_5tuple_filter       = ixgbe_add_5tuple_filter,
 	.remove_5tuple_filter    = ixgbe_remove_5tuple_filter,
 	.get_5tuple_filter       = ixgbe_get_5tuple_filter,
@@ -3682,107 +3682,105 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index)
 	}
 }
 
-/*
- * add syn filter
- *
- * @param
- * dev: Pointer to struct rte_eth_dev.
- * filter: ponter to the filter that will be added.
- * rx_queue: the queue id the filter assigned to.
- *
- * @return
- *    - On success, zero.
- *    - On failure, a negative value.
- */
+
+#define MAC_TYPE_FILTER_SUP(type)    do {\
+	if ((type) != ixgbe_mac_82599EB && (type) != ixgbe_mac_X540 &&\
+		(type) != ixgbe_mac_X550)\
+		return -ENOTSUP;\
+} while (0)
+
 static int
-ixgbe_add_syn_filter(struct rte_eth_dev *dev,
-			struct rte_syn_filter *filter, uint16_t rx_queue)
+ixgbe_syn_filter_set(struct rte_eth_dev *dev,
+			struct rte_eth_syn_filter *filter,
+			bool add)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	uint32_t synqf;
 
-	if (hw->mac.type != ixgbe_mac_82599EB)
-		return -ENOSYS;
-
-	if (rx_queue >= IXGBE_MAX_RX_QUEUE_NUM)
+	if (filter->queue >= IXGBE_MAX_RX_QUEUE_NUM)
 		return -EINVAL;
 
 	synqf = IXGBE_READ_REG(hw, IXGBE_SYNQF);
 
-	if (synqf & IXGBE_SYN_FILTER_ENABLE)
-		return -EINVAL;
-
-	synqf = (uint32_t)(((rx_queue << IXGBE_SYN_FILTER_QUEUE_SHIFT) &
-		IXGBE_SYN_FILTER_QUEUE) | IXGBE_SYN_FILTER_ENABLE);
-
-	if (filter->hig_pri)
-		synqf |= IXGBE_SYN_FILTER_SYNQFP;
-	else
-		synqf &= ~IXGBE_SYN_FILTER_SYNQFP;
+	if (add) {
+		if (synqf & IXGBE_SYN_FILTER_ENABLE)
+			return -EINVAL;
+		synqf = (uint32_t)(((filter->queue << IXGBE_SYN_FILTER_QUEUE_SHIFT) &
+			IXGBE_SYN_FILTER_QUEUE) | IXGBE_SYN_FILTER_ENABLE);
 
+		if (filter->hig_pri)
+			synqf |= IXGBE_SYN_FILTER_SYNQFP;
+		else
+			synqf &= ~IXGBE_SYN_FILTER_SYNQFP;
+	} else {
+		if (!(synqf & IXGBE_SYN_FILTER_ENABLE))
+			return -ENOENT;
+		synqf &= ~(IXGBE_SYN_FILTER_QUEUE | IXGBE_SYN_FILTER_ENABLE);
+	}
 	IXGBE_WRITE_REG(hw, IXGBE_SYNQF, synqf);
+	IXGBE_WRITE_FLUSH(hw);
 	return 0;
 }
 
-/*
- * remove syn filter
- *
- * @param
- * dev: Pointer to struct rte_eth_dev.
- *
- * @return
- *    - On success, zero.
- *    - On failure, a negative value.
- */
 static int
-ixgbe_remove_syn_filter(struct rte_eth_dev *dev)
+ixgbe_syn_filter_get(struct rte_eth_dev *dev,
+			struct rte_eth_syn_filter *filter)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	uint32_t synqf;
-
-	if (hw->mac.type != ixgbe_mac_82599EB)
-		return -ENOSYS;
+	uint32_t synqf = IXGBE_READ_REG(hw, IXGBE_SYNQF);
 
-	synqf = IXGBE_READ_REG(hw, IXGBE_SYNQF);
-
-	synqf &= ~(IXGBE_SYN_FILTER_QUEUE | IXGBE_SYN_FILTER_ENABLE);
-
-	IXGBE_WRITE_REG(hw, IXGBE_SYNQF, synqf);
-	return 0;
+	if (synqf & IXGBE_SYN_FILTER_ENABLE) {
+		filter->hig_pri = (synqf & IXGBE_SYN_FILTER_SYNQFP) ? 1 : 0;
+		filter->queue = (uint16_t)((synqf & IXGBE_SYN_FILTER_QUEUE) >> 1);
+		return 0;
+	}
+	return -ENOENT;
 }
 
-/*
- * get the syn filter's info
- *
- * @param
- * dev: Pointer to struct rte_eth_dev.
- * filter: ponter to the filter that returns.
- * *rx_queue: pointer to the queue id the filter assigned to.
- *
- * @return
- *    - On success, zero.
- *    - On failure, a negative value.
- */
 static int
-ixgbe_get_syn_filter(struct rte_eth_dev *dev,
-			struct rte_syn_filter *filter, uint16_t *rx_queue)
-
+ixgbe_syn_filter_handle(struct rte_eth_dev *dev,
+			enum rte_filter_op filter_op,
+			void *arg)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	uint32_t synqf;
+	int ret;
 
-	if (hw->mac.type != ixgbe_mac_82599EB)
-		return -ENOSYS;
+	MAC_TYPE_FILTER_SUP(hw->mac.type);
 
-	synqf = IXGBE_READ_REG(hw, IXGBE_SYNQF);
-	if (synqf & IXGBE_SYN_FILTER_ENABLE) {
-		filter->hig_pri = (synqf & IXGBE_SYN_FILTER_SYNQFP) ? 1 : 0;
-		*rx_queue = (uint16_t)((synqf & IXGBE_SYN_FILTER_QUEUE) >> 1);
+	if (filter_op == RTE_ETH_FILTER_NOP)
 		return 0;
+
+	if (arg == NULL) {
+		PMD_DRV_LOG(ERR, "arg shouldn't be NULL for operation %u",
+			    filter_op);
+		return -EINVAL;
 	}
-	return -ENOENT;
+
+	switch (filter_op) {
+	case RTE_ETH_FILTER_ADD:
+		ret = ixgbe_syn_filter_set(dev,
+				(struct rte_eth_syn_filter *)arg,
+				TRUE);
+		break;
+	case RTE_ETH_FILTER_DELETE:
+		ret = ixgbe_syn_filter_set(dev,
+				(struct rte_eth_syn_filter *)arg,
+				FALSE);
+		break;
+	case RTE_ETH_FILTER_GET:
+		ret = ixgbe_syn_filter_get(dev,
+				(struct rte_eth_syn_filter *)arg);
+		break;
+	default:
+		PMD_DRV_LOG(ERR, "unsupported operation %u\n", filter_op);
+		ret = -EINVAL;
+		break;
+	}
+
+	return ret;
 }
 
+
 static inline enum ixgbe_5tuple_protocol
 convert_protocol_type(uint8_t protocol_value)
 {
@@ -4009,12 +4007,6 @@ ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 	return 0;
 }
 
-#define MAC_TYPE_FILTER_SUP(type)    do {\
-	if ((type) != ixgbe_mac_82599EB && (type) != ixgbe_mac_X540 &&\
-		(type) != ixgbe_mac_X550)\
-		return -ENOTSUP;\
-} while (0)
-
 static inline int
 ixgbe_ethertype_filter_lookup(struct ixgbe_filter_info *filter_info,
 			uint16_t ethertype)
@@ -4213,6 +4205,9 @@ ixgbe_dev_filter_ctrl(struct rte_eth_dev *dev,
 	case RTE_ETH_FILTER_ETHERTYPE:
 		ret = ixgbe_ethertype_filter_handle(dev, filter_op, arg);
 		break;
+	case RTE_ETH_FILTER_SYN:
+		ret = ixgbe_syn_filter_handle(dev, filter_op, arg);
+		break;
 	default:
 		PMD_DRV_LOG(WARNING, "Filter type (%d) not supported",
 							filter_type);
Signature · 1 line
1.9.3
#6 lore raw

PATCH v2 3/6 e1000: new functions replace old ones for syn filter

In reply to a message not in the archive

This patch defines new functions dealing with syn filter. It removes old functions of syn filter in igb driver. Syn filter is dealt with through entrance eth_igb_filter_ctrl.

---
 lib/librte_pmd_e1000/igb_ethdev.c | 152 ++++++++++++++++++++------------------
 1 file changed, 81 insertions(+), 71 deletions(-)
lib/librte_pmd_e1000/igb_ethdev.c +81 -71
index 2a268b8..60abd91 100644
@@ -149,11 +149,15 @@ static int eth_igb_rss_reta_update(struct rte_eth_dev *dev,
 static int eth_igb_rss_reta_query(struct rte_eth_dev *dev,
 				  struct rte_eth_rss_reta_entry64 *reta_conf,
 				  uint16_t reta_size);
-static int eth_igb_add_syn_filter(struct rte_eth_dev *dev,
-			struct rte_syn_filter *filter, uint16_t rx_queue);
-static int eth_igb_remove_syn_filter(struct rte_eth_dev *dev);
-static int eth_igb_get_syn_filter(struct rte_eth_dev *dev,
-			struct rte_syn_filter *filter, uint16_t *rx_queue);
+
+static int eth_igb_syn_filter_set(struct rte_eth_dev *dev,
+			struct rte_eth_syn_filter *filter,
+			bool add);
+static int eth_igb_syn_filter_get(struct rte_eth_dev *dev,
+			struct rte_eth_syn_filter *filter);
+static int eth_igb_syn_filter_handle(struct rte_eth_dev *dev,
+			enum rte_filter_op filter_op,
+			void *arg);
 static int eth_igb_add_2tuple_filter(struct rte_eth_dev *dev,
 			uint16_t index,
 			struct rte_2tuple_filter *filter, uint16_t rx_queue);
@@ -265,9 +269,6 @@ static struct eth_dev_ops eth_igb_ops = {
 	.reta_query           = eth_igb_rss_reta_query,
 	.rss_hash_update      = eth_igb_rss_hash_update,
 	.rss_hash_conf_get    = eth_igb_rss_hash_conf_get,
-	.add_syn_filter          = eth_igb_add_syn_filter,
-	.remove_syn_filter       = eth_igb_remove_syn_filter,
-	.get_syn_filter          = eth_igb_get_syn_filter,
 	.add_2tuple_filter       = eth_igb_add_2tuple_filter,
 	.remove_2tuple_filter    = eth_igb_remove_2tuple_filter,
 	.get_2tuple_filter       = eth_igb_get_2tuple_filter,
@@ -2392,100 +2393,106 @@ eth_igb_rss_reta_query(struct rte_eth_dev *dev,
 		return -ENOTSUP;\
 } while (0)
 
-/*
- * add the syn filter
- *
- * @param
- * dev: Pointer to struct rte_eth_dev.
- * filter: ponter to the filter that will be added.
- * rx_queue: the queue id the filter assigned to.
- *
- * @return
- *    - On success, zero.
- *    - On failure, a negative value.
- */
 static int
-eth_igb_add_syn_filter(struct rte_eth_dev *dev,
-			struct rte_syn_filter *filter, uint16_t rx_queue)
+eth_igb_syn_filter_set(struct rte_eth_dev *dev,
+			struct rte_eth_syn_filter *filter,
+			bool add)
 {
 	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	uint32_t synqf, rfctl;
 
-	MAC_TYPE_FILTER_SUP(hw->mac.type);
-
-	if (rx_queue >= IGB_MAX_RX_QUEUE_NUM)
+	if (filter->queue >= IGB_MAX_RX_QUEUE_NUM)
 		return -EINVAL;
 
 	synqf = E1000_READ_REG(hw, E1000_SYNQF(0));
-	if (synqf & E1000_SYN_FILTER_ENABLE)
-		return -EINVAL;
 
-	synqf = (uint32_t)(((rx_queue << E1000_SYN_FILTER_QUEUE_SHIFT) &
-		E1000_SYN_FILTER_QUEUE) | E1000_SYN_FILTER_ENABLE);
+	if (add) {
+		if (synqf & E1000_SYN_FILTER_ENABLE)
+			return -EINVAL;
 
-	rfctl = E1000_READ_REG(hw, E1000_RFCTL);
-	if (filter->hig_pri)
-		rfctl |= E1000_RFCTL_SYNQFP;
-	else
-		rfctl &= ~E1000_RFCTL_SYNQFP;
+		synqf = (uint32_t)(((filter->queue << E1000_SYN_FILTER_QUEUE_SHIFT) &
+			E1000_SYN_FILTER_QUEUE) | E1000_SYN_FILTER_ENABLE);
 
-	E1000_WRITE_REG(hw, E1000_SYNQF(0), synqf);
-	E1000_WRITE_REG(hw, E1000_RFCTL, rfctl);
-	return 0;
-}
-
-/*
- * remove the syn filter
- *
- * @param
- * dev: Pointer to struct rte_eth_dev.
- *
- * @return
- *    - On success, zero.
- *    - On failure, a negative value.
- */
-static int
-eth_igb_remove_syn_filter(struct rte_eth_dev *dev)
-{
-	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+		rfctl = E1000_READ_REG(hw, E1000_RFCTL);
+		if (filter->hig_pri)
+			rfctl |= E1000_RFCTL_SYNQFP;
+		else
+			rfctl &= ~E1000_RFCTL_SYNQFP;
 
-	MAC_TYPE_FILTER_SUP(hw->mac.type);
+		E1000_WRITE_REG(hw, E1000_RFCTL, rfctl);
+	} else {
+		if (!(synqf & E1000_SYN_FILTER_ENABLE))
+			return -ENOENT;
+		synqf = 0;
+	}
 
-	E1000_WRITE_REG(hw, E1000_SYNQF(0), 0);
+	E1000_WRITE_REG(hw, E1000_SYNQF(0), synqf);
+	E1000_WRITE_FLUSH(hw);
 	return 0;
 }
 
-/*
- * get the syn filter's info
- *
- * @param
- * dev: Pointer to struct rte_eth_dev.
- * filter: ponter to the filter that returns.
- * *rx_queue: pointer to the queue id the filter assigned to.
- *
- * @return
- *    - On success, zero.
- *    - On failure, a negative value.
- */
 static int
-eth_igb_get_syn_filter(struct rte_eth_dev *dev,
-			struct rte_syn_filter *filter, uint16_t *rx_queue)
+eth_igb_syn_filter_get(struct rte_eth_dev *dev,
+			struct rte_eth_syn_filter *filter)
 {
 	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	uint32_t synqf, rfctl;
 
-	MAC_TYPE_FILTER_SUP(hw->mac.type);
 	synqf = E1000_READ_REG(hw, E1000_SYNQF(0));
 	if (synqf & E1000_SYN_FILTER_ENABLE) {
 		rfctl = E1000_READ_REG(hw, E1000_RFCTL);
 		filter->hig_pri = (rfctl & E1000_RFCTL_SYNQFP) ? 1 : 0;
-		*rx_queue = (uint8_t)((synqf & E1000_SYN_FILTER_QUEUE) >>
+		filter->queue = (uint8_t)((synqf & E1000_SYN_FILTER_QUEUE) >>
 				E1000_SYN_FILTER_QUEUE_SHIFT);
 		return 0;
 	}
+
 	return -ENOENT;
 }
 
+static int
+eth_igb_syn_filter_handle(struct rte_eth_dev *dev,
+			enum rte_filter_op filter_op,
+			void *arg)
+{
+	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	int ret;
+
+	MAC_TYPE_FILTER_SUP(hw->mac.type);
+
+	if (filter_op == RTE_ETH_FILTER_NOP)
+		return 0;
+
+	if (arg == NULL) {
+		PMD_DRV_LOG(ERR, "arg shouldn't be NULL for operation %u",
+			    filter_op);
+		return -EINVAL;
+	}
+
+	switch (filter_op) {
+	case RTE_ETH_FILTER_ADD:
+		ret = eth_igb_syn_filter_set(dev,
+				(struct rte_eth_syn_filter *)arg,
+				TRUE);
+		break;
+	case RTE_ETH_FILTER_DELETE:
+		ret = eth_igb_syn_filter_set(dev,
+				(struct rte_eth_syn_filter *)arg,
+				FALSE);
+		break;
+	case RTE_ETH_FILTER_GET:
+		ret = eth_igb_syn_filter_get(dev,
+				(struct rte_eth_syn_filter *)arg);
+		break;
+	default:
+		PMD_DRV_LOG(ERR, "unsupported operation %u\n", filter_op);
+		ret = -EINVAL;
+		break;
+	}
+
+	return ret;
+}
+
 #define MAC_TYPE_FILTER_SUP_EXT(type)    do {\
 	if ((type) != e1000_82580 && (type) != e1000_i350)\
 		return -ENOSYS; \
@@ -3237,6 +3244,9 @@ eth_igb_filter_ctrl(struct rte_eth_dev *dev,
 	case RTE_ETH_FILTER_ETHERTYPE:
 		ret = igb_ethertype_filter_handle(dev, filter_op, arg);
 		break;
+	case RTE_ETH_FILTER_SYN:
+		ret = eth_igb_syn_filter_handle(dev, filter_op, arg);
+		break;
 	default:
 		PMD_DRV_LOG(WARNING, "Filter type (%d) not supported",
 							filter_type);
Signature · 1 line
1.9.3
#7 lore raw

PATCH v2 4/6 testpmd: new commands for syn filter

In reply to a message not in the archive

Following commands of syn filter are removed:
- add_syn_filter (port_id) priority (high|low) queue (queue_id)
- remove_syn_filter (port_id)
- get_syn_filter (port_id)
New command is added for syn filter by using filter_ctrl API and new syn filter structure:
- syn_filter (port_id) (add|del) priority (high|low) queue (queue_id)

---
 app/test-pmd/cmdline.c | 143 ++++++++++++++++++++++---------------------------
 app/test-pmd/config.c  |  21 --------
 2 files changed, 65 insertions(+), 99 deletions(-)
app/test-pmd/cmdline.c +65 -78
index 590e427..f8d9f03 100644
@@ -683,14 +683,8 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"get_5tuple_filter (port_id) index (idx)\n"
 			"    get info of a 5tuple filter.\n\n"
 
-			"add_syn_filter (port_id) priority (high|low) queue (queue_id)"
-			"    add syn filter.\n\n"
-
-			"remove_syn_filter (port_id)"
-			"    remove syn filter.\n\n"
-
-			"get_syn_filter (port_id) "
-			"    get syn filter info.\n\n"
+			"syn_filter (port_id) (add|del) priority (high|low) queue (queue_id)"
+			"    Add/Del syn filter.\n\n"
 
 			"add_flex_filter (port_id) len (len_value) bytes (bytes_string) mask (mask_value)"
 			" priority (prio_value) queue (queue_id) index (idx)\n"
@@ -7275,99 +7269,94 @@ cmdline_parse_inst_t cmd_dump_one = {
 	},
 };
 
-/* *** set SYN filter *** */
-struct cmd_set_syn_filter_result {
+/* *** Add/Del syn filter *** */
+struct cmd_syn_filter_result {
 	cmdline_fixed_string_t filter;
 	uint8_t port_id;
+	cmdline_fixed_string_t ops;
 	cmdline_fixed_string_t priority;
 	cmdline_fixed_string_t high;
 	cmdline_fixed_string_t queue;
-	uint16_t  queue_id;
+	uint16_t queue_id;
 };
 
 static void
-cmd_set_syn_filter_parsed(void *parsed_result,
+cmd_syn_filter_parsed(void *parsed_result,
 			__attribute__((unused)) struct cmdline *cl,
 			__attribute__((unused)) void *data)
 {
+	struct cmd_syn_filter_result *res = parsed_result;
+	struct rte_eth_syn_filter syn_filter;
 	int ret = 0;
-	struct cmd_set_syn_filter_result *res = parsed_result;
-	struct rte_syn_filter filter;
 
-	if (!strcmp(res->filter, "add_syn_filter")) {
+	ret = rte_eth_dev_filter_supported(res->port_id,
+					RTE_ETH_FILTER_SYN);
+	if (ret < 0) {
+		printf("syn filter is not supported on port %u.\n",
+				res->port_id);
+		return;
+	}
+
+	memset(&syn_filter, 0, sizeof(syn_filter));
+
+	if (!strcmp(res->ops, "add")) {
 		if (!strcmp(res->high, "high"))
-			filter.hig_pri = 1;
+			syn_filter.hig_pri = 1;
 		else
-			filter.hig_pri = 0;
-		ret = rte_eth_dev_add_syn_filter(res->port_id,
-				&filter, res->queue_id);
-	} else if (!strcmp(res->filter, "remove_syn_filter"))
-		ret = rte_eth_dev_remove_syn_filter(res->port_id);
-	else if (!strcmp(res->filter, "get_syn_filter"))
-		get_syn_filter(res->port_id);
-	if (ret < 0)
-		printf("syn filter setting error: (%s)\n", strerror(-ret));
+			syn_filter.hig_pri = 0;
+
+		syn_filter.queue = res->queue_id;
+		ret = rte_eth_dev_filter_ctrl(res->port_id,
+						RTE_ETH_FILTER_SYN,
+						RTE_ETH_FILTER_ADD,
+						&syn_filter);
+	} else
+		ret = rte_eth_dev_filter_ctrl(res->port_id,
+						RTE_ETH_FILTER_SYN,
+						RTE_ETH_FILTER_DELETE,
+						&syn_filter);
 
+	if (ret < 0)
+		printf("syn filter programming error: (%s)\n",
+				strerror(-ret));
 }
-cmdline_parse_token_num_t cmd_syn_filter_portid =
-	TOKEN_NUM_INITIALIZER(struct cmd_set_syn_filter_result,
-				port_id, UINT8);
+
+cmdline_parse_token_string_t cmd_syn_filter_filter =
+	TOKEN_STRING_INITIALIZER(struct cmd_syn_filter_result,
+	filter, "syn_filter");
+cmdline_parse_token_num_t cmd_syn_filter_port_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_syn_filter_result,
+	port_id, UINT8);
+cmdline_parse_token_string_t cmd_syn_filter_ops =
+	TOKEN_STRING_INITIALIZER(struct cmd_syn_filter_result,
+	ops, "add#del");
 cmdline_parse_token_string_t cmd_syn_filter_priority =
-	TOKEN_STRING_INITIALIZER(struct cmd_set_syn_filter_result,
+	TOKEN_STRING_INITIALIZER(struct cmd_syn_filter_result,
 				priority, "priority");
 cmdline_parse_token_string_t cmd_syn_filter_high =
-	TOKEN_STRING_INITIALIZER(struct cmd_set_syn_filter_result,
+	TOKEN_STRING_INITIALIZER(struct cmd_syn_filter_result,
 				high, "high#low");
 cmdline_parse_token_string_t cmd_syn_filter_queue =
-	TOKEN_STRING_INITIALIZER(struct cmd_set_syn_filter_result,
+	TOKEN_STRING_INITIALIZER(struct cmd_syn_filter_result,
 				queue, "queue");
 cmdline_parse_token_num_t cmd_syn_filter_queue_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_set_syn_filter_result,
+	TOKEN_NUM_INITIALIZER(struct cmd_syn_filter_result,
 				queue_id, UINT16);
-cmdline_parse_token_string_t cmd_syn_filter_add_filter =
-	TOKEN_STRING_INITIALIZER(struct cmd_set_syn_filter_result,
-				filter, "add_syn_filter");
-cmdline_parse_token_string_t cmd_syn_filter_remove_filter =
-	TOKEN_STRING_INITIALIZER(struct cmd_set_syn_filter_result,
-				filter, "remove_syn_filter");
-cmdline_parse_inst_t cmd_add_syn_filter = {
-		.f = cmd_set_syn_filter_parsed,
-		.data = NULL,
-		.help_str = "add syn filter",
-		.tokens = {
-			(void *)&cmd_syn_filter_add_filter,
-			(void *)&cmd_syn_filter_portid,
-			(void *)&cmd_syn_filter_priority,
-			(void *)&cmd_syn_filter_high,
-			(void *)&cmd_syn_filter_queue,
-			(void *)&cmd_syn_filter_queue_id,
-			NULL,
-		},
-};
-cmdline_parse_inst_t cmd_remove_syn_filter = {
-		.f = cmd_set_syn_filter_parsed,
-		.data = NULL,
-		.help_str = "remove syn filter",
-		.tokens = {
-			(void *)&cmd_syn_filter_remove_filter,
-			(void *)&cmd_syn_filter_portid,
-			NULL,
-		},
-};
-
-cmdline_parse_token_string_t cmd_syn_filter_get_filter =
-	TOKEN_STRING_INITIALIZER(struct cmd_set_syn_filter_result,
-				filter, "get_syn_filter");
 
-cmdline_parse_inst_t cmd_get_syn_filter = {
-		.f = cmd_set_syn_filter_parsed,
-		.data = NULL,
-		.help_str = "get syn filter",
-		.tokens = {
-			(void *)&cmd_syn_filter_get_filter,
-			(void *)&cmd_syn_filter_portid,
-			NULL,
-		},
+cmdline_parse_inst_t cmd_syn_filter = {
+	.f = cmd_syn_filter_parsed,
+	.data = NULL,
+	.help_str = "add/delete syn filter",
+	.tokens = {
+		(void *)&cmd_syn_filter_filter,
+		(void *)&cmd_syn_filter_port_id,
+		(void *)&cmd_syn_filter_ops,
+		(void *)&cmd_syn_filter_priority,
+		(void *)&cmd_syn_filter_high,
+		(void *)&cmd_syn_filter_queue,
+		(void *)&cmd_syn_filter_queue_id,
+		NULL,
+	},
 };
 
 /* *** ADD/REMOVE A 2tuple FILTER *** */
@@ -9118,9 +9107,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_dump,
 	(cmdline_parse_inst_t *)&cmd_dump_one,
 	(cmdline_parse_inst_t *)&cmd_ethertype_filter,
-	(cmdline_parse_inst_t *)&cmd_add_syn_filter,
-	(cmdline_parse_inst_t *)&cmd_remove_syn_filter,
-	(cmdline_parse_inst_t *)&cmd_get_syn_filter,
+	(cmdline_parse_inst_t *)&cmd_syn_filter,
 	(cmdline_parse_inst_t *)&cmd_add_2tuple_filter,
 	(cmdline_parse_inst_t *)&cmd_remove_2tuple_filter,
 	(cmdline_parse_inst_t *)&cmd_get_2tuple_filter,
app/test-pmd/config.c +0 -21
index c40f819..10454ab 100644
@@ -2166,27 +2166,6 @@ set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk)
 }
 
 void
-get_syn_filter(uint8_t port_id)
-{
-	struct rte_syn_filter filter;
-	int ret = 0;
-	uint16_t rx_queue;
-
-	memset(&filter, 0, sizeof(filter));
-	ret = rte_eth_dev_get_syn_filter(port_id, &filter, &rx_queue);
-
-	if (ret < 0) {
-		if (ret == (-ENOENT))
-			printf("syn filter is not enabled\n");
-		else
-			printf("get syn filter fails(%s)\n", strerror(-ret));
-		return;
-	}
-	printf("syn filter: priority: %s, queue: %d\n",
-		filter.hig_pri ? "high" : "low",
-		rx_queue);
-}
-void
 get_2tuple_filter(uint8_t port_id, uint16_t index)
 {
 	struct rte_2tuple_filter filter;
Signature · 1 line
1.9.3
#8 lore raw

PATCH v2 5/6 ethdev: remove old APIs and structures of syn filter

In reply to a message not in the archive

Structure rte_syn_filter is removed.
Following APIs are removed:
- rte_eth_dev_add_syn_filter
- rte_eth_dev_remove_syn_filter
- rte_eth_dev_get_syn_filter

---
 lib/librte_ether/rte_ethdev.c | 50 --------------------------------
 lib/librte_ether/rte_ethdev.h | 67 -------------------------------------------
 2 files changed, 117 deletions(-)
lib/librte_ether/rte_ethdev.c +0 -50
index ea3a1fb..709ba90 100644
@@ -3006,56 +3006,6 @@ rte_eth_dev_bypass_wd_reset(uint8_t port_id)
 #endif
 
 int
-rte_eth_dev_add_syn_filter(uint8_t port_id,
-			struct rte_syn_filter *filter, uint16_t rx_queue)
-{
-	struct rte_eth_dev *dev;
-
-	if (port_id >= nb_ports) {
-		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
-		return -ENODEV;
-	}
-
-	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->add_syn_filter, -ENOTSUP);
-	return (*dev->dev_ops->add_syn_filter)(dev, filter, rx_queue);
-}
-
-int
-rte_eth_dev_remove_syn_filter(uint8_t port_id)
-{
-	struct rte_eth_dev *dev;
-
-	if (port_id >= nb_ports) {
-		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
-		return -ENODEV;
-	}
-
-	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->remove_syn_filter, -ENOTSUP);
-	return (*dev->dev_ops->remove_syn_filter)(dev);
-}
-
-int
-rte_eth_dev_get_syn_filter(uint8_t port_id,
-			struct rte_syn_filter *filter, uint16_t *rx_queue)
-{
-	struct rte_eth_dev *dev;
-
-	if (filter == NULL || rx_queue == NULL)
-		return -EINVAL;
-
-	if (port_id >= nb_ports) {
-		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
-		return -ENODEV;
-	}
-
-	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_syn_filter, -ENOTSUP);
-	return (*dev->dev_ops->get_syn_filter)(dev, filter, rx_queue);
-}
-
-int
 rte_eth_dev_add_2tuple_filter(uint8_t port_id, uint16_t index,
 			struct rte_2tuple_filter *filter, uint16_t rx_queue)
 {
lib/librte_ether/rte_ethdev.h +0 -67

91 lines not on this page · raw message

Signature · 1 line
1.9.3
#9 lore raw

PATCH v2 6/6 doc: commands changed in testpmd_funcs for syn filter

In reply to a message not in the archive

document of new command:
- syn_filter (port_id) (add|del) priority (high|low) queue (queue_id)

---
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 30 ++++-------------------------
 1 file changed, 4 insertions(+), 26 deletions(-)
doc/guides/testpmd_app_ug/testpmd_funcs.rst +4 -26
index 218835a..393cbea 100644
@@ -1550,12 +1550,12 @@ Example:
         protocol: 0x06 mask: 1
         priority: 3 flags: 0x00 queue: 3
 
-add_syn_filter
+syn_filter
 ~~~~~~~~~~~~~~
 
-Add SYN filter, which can forward TCP packets whose *SYN* flag is set into a separate queue.
+By SYN filter, TCP packets whose *SYN* flag is set can be forwarded to a separate queue.
 
-add_syn_filter (port_id) priority (high|low) queue (queue_id)
+syn_filter (port_id) (add|del) priority (high|low) queue (queue_id)
 
 The available information parameters are:
 
@@ -1571,29 +1571,7 @@ Example:
 
 .. code-block:: console
 
-    testpmd> add_syn_filter 0 priority high queue 3,
-
-remove_syn_filter
-~~~~~~~~~~~~~~~~~
-
-Remove SYN filter
-
-remove_syn_filter (port_id)
-
-get_syn_filter
-~~~~~~~~~~~~~~
-
-Get and display SYN filter
-
-get_syn_filter (port_id)
-
-Example:
-
-.. code-block:: console
-
-    testpmd> get_syn_filter 0
-
-    syn filter: on, priority: high, queue: 3
+    testpmd> syn_filter 0 add priority high queue 3
 
 add_flex_filter
 ~~~~~~~~~~~~~~~
Signature · 1 line
1.9.3
#10 lore raw

Re: [PATCH v2 0/6] Integrate syn filter in igb/ixgbe driver to new API

In reply to a message not in the archive

Because the first version of the patch is sent by Zhida, and he is on a long vacation now, I have no right to change the old patch's status in patch work. Sorry for the inconvenience.

Thanks
Jingjing

Quoted 39 lines

-----Original Message-----
From: Wu, Jingjing
Sent: Wednesday, February 11, 2015 3:52 PM
To: [email protected]
Cc: Wu, Jingjing; Cao, Min; Xu, HuilongX; Liu, Jijiang; Zang, Zhida
Subject: [PATCH v2 0/6] Integrate syn filter in igb/ixgbe driver to new API

v2 changes:
- split one patch to patch series
- change the command's format in testpmd.
- return -ENOENT when deleting a disabled syn filter.
- add doc changes in testpmd_funcs.rst
- correct the errors reported by checkpatch.pl

The patch set uses new filter_ctrl API to replace old syn filter APIs. It uses new functions and structure to replace old ones in igb/ixgbe driver, new commands to replace old ones in testpmd, and removes the old APIs.

Jingjing Wu (6):
ethdev: define syn filter type and its structure
ixgbe: new functions replace old ones for syn filter
e1000: new functions replace old ones for syn filter
testpmd: new commands for syn filter
ethdev: remove old APIs and structures of syn filter
doc: commands changed in testpmd_funcs for syn filter

 app/test-pmd/cmdline.c                      | 143 +++++++++++-------------
 app/test-pmd/config.c                       |  21 ----
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  30 +----
 lib/librte_ether/rte_eth_ctrl.h             |  12 ++
 lib/librte_ether/rte_ethdev.c               |  50 ---------
 lib/librte_ether/rte_ethdev.h               |  67 -----------
 lib/librte_pmd_e1000/igb_ethdev.c           | 152 +++++++++++++------------
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c         | 167 ++++++++++++++------------
--
 8 files changed, 243 insertions(+), 399 deletions(-)

--
1.9.3

#11 lore raw

Re: [PATCH v2 0/6] Integrate syn filter in igb/ixgbe driver to new API

In reply to a message not in the archive
Quoted 11 lines

v2 changes:
- split one patch to patch series
- change the command's format in testpmd.
- return -ENOENT when deleting a disabled syn filter.
- add doc changes in testpmd_funcs.rst
- correct the errors reported by checkpatch.pl

The patch set uses new filter_ctrl API to replace old syn filter APIs. It uses new functions and structure to replace old ones in igb/ixgbe driver, new commands to replace old ones in testpmd, and removes the old APIs.

Quoted 7 lines

Jingjing Wu (6):
ethdev: define syn filter type and its structure
ixgbe: new functions replace old ones for syn filter
e1000: new functions replace old ones for syn filter
testpmd: new commands for syn filter
ethdev: remove old APIs and structures of syn filter
doc: commands changed in testpmd_funcs for syn filter

Applied, thanks.
I removed the old API functions from the version map.