* [dpdk-dev] [PATCH] ixgbe/igb: integrate syn filter to new API
@ 2015-01-08 1:42 zhida zang
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 0/6] Integrate syn filter in igb/ixgbe driver " Jingjing Wu
0 siblings, 1 reply; 10+ messages in thread
From: zhida zang @ 2015-01-08 1:42 UTC (permalink / raw)
To: dev
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
Signed-off-by: Zhida Zang <zhida.zang@intel.com>
---
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(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 4c3fc76..820b3a6 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -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;
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index b102b72..10278b3 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -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)
diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index 8dd384d..14dc323 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -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 {
diff --git a/lib/librte_pmd_e1000/igb_ethdev.c b/lib/librte_pmd_e1000/igb_ethdev.c
index c13ea05..caf0cdc 100644
--- a/lib/librte_pmd_e1000/igb_ethdev.c
+++ b/lib/librte_pmd_e1000/igb_ethdev.c
@@ -140,11 +140,18 @@ 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 *reta_conf);
-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_dev_filter_ctrl(struct rte_eth_dev *dev,
+ enum rte_filter_type filter_type,
+ enum rte_filter_op filter_op,
+ void *arg);
static int eth_igb_add_ethertype_filter(struct rte_eth_dev *dev,
uint16_t index,
struct rte_ethertype_filter *filter, uint16_t rx_queue);
@@ -252,9 +259,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_ethertype_filter = eth_igb_add_ethertype_filter,
.remove_ethertype_filter = eth_igb_remove_ethertype_filter,
.get_ethertype_filter = eth_igb_get_ethertype_filter,
@@ -267,6 +271,7 @@ static struct eth_dev_ops eth_igb_ops = {
.add_5tuple_filter = eth_igb_add_5tuple_filter,
.remove_5tuple_filter = eth_igb_remove_5tuple_filter,
.get_5tuple_filter = eth_igb_get_5tuple_filter,
+ .filter_ctrl = eth_igb_dev_filter_ctrl,
};
/*
@@ -2340,100 +2345,129 @@ eth_igb_rss_reta_query(struct rte_eth_dev *dev,
return -ENOSYS;\
} 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);
-
- rfctl = E1000_READ_REG(hw, E1000_RFCTL);
- if (filter->hig_pri)
- rfctl |= E1000_RFCTL_SYNQFP;
- else
- rfctl &= ~E1000_RFCTL_SYNQFP;
+ if (add) {
+ if (synqf & E1000_SYN_FILTER_ENABLE)
+ return -EINVAL;
- E1000_WRITE_REG(hw, E1000_SYNQF(0), synqf);
- E1000_WRITE_REG(hw, E1000_RFCTL, rfctl);
- return 0;
-}
+ synqf = (uint32_t)(((filter->queue <<
+ E1000_SYN_FILTER_QUEUE_SHIFT) & E1000_SYN_FILTER_QUEUE)
+ | E1000_SYN_FILTER_ENABLE);
-/*
- * 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
+ 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 = 0;
+
+ MAC_TYPE_FILTER_SUP(hw->mac.type);
+
+ if (filter_op == RTE_ETH_FILTER_NOP)
+ return ret;
+
+ 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 = -ENOSYS;
+ break;
+ }
+
+ return ret;
+}
+
+static int
+eth_igb_dev_filter_ctrl(struct rte_eth_dev *dev,
+ enum rte_filter_type filter_type,
+ enum rte_filter_op filter_op,
+ void *arg)
+{
+ int ret = 0;
+
+ if (dev == NULL)
+ return -EINVAL;
+
+ switch (filter_type) {
+ 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);
+ ret = -EINVAL;
+ break;
+ }
+
+ return ret;
+}
+
/*
* add an ethertype filter
*
diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
index 2eb609c..0fb80f9 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -216,11 +216,18 @@ 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_dev_filter_ctrl(struct rte_eth_dev *dev,
+ enum rte_filter_type filter_type,
+ enum rte_filter_op filter_op,
+ void *arg);
static int ixgbe_add_ethertype_filter(struct rte_eth_dev *dev, uint16_t index,
struct rte_ethertype_filter *filter, uint16_t rx_queue);
static int ixgbe_remove_ethertype_filter(struct rte_eth_dev *dev,
@@ -367,15 +374,13 @@ 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_ethertype_filter = ixgbe_add_ethertype_filter,
.remove_ethertype_filter = ixgbe_remove_ethertype_filter,
.get_ethertype_filter = ixgbe_get_ethertype_filter,
.add_5tuple_filter = ixgbe_add_5tuple_filter,
.remove_5tuple_filter = ixgbe_remove_5tuple_filter,
.get_5tuple_filter = ixgbe_get_5tuple_filter,
+ .filter_ctrl = ixgbe_dev_filter_ctrl,
};
/*
@@ -3581,105 +3586,126 @@ 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 -ENOSYS;\
+} 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 (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;
+ if (filter->hig_pri)
+ synqf |= IXGBE_SYN_FILTER_SYNQFP;
+ else
+ synqf &= ~IXGBE_SYN_FILTER_SYNQFP;
+ } else
+ 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;
+ uint32_t synqf = IXGBE_READ_REG(hw, IXGBE_SYNQF);
- if (hw->mac.type != ixgbe_mac_82599EB)
- return -ENOSYS;
+ 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;
+}
- synqf = IXGBE_READ_REG(hw, IXGBE_SYNQF);
+static int
+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);
+ int ret = 0;
- synqf &= ~(IXGBE_SYN_FILTER_QUEUE | IXGBE_SYN_FILTER_ENABLE);
+ MAC_TYPE_FILTER_SUP(hw->mac.type);
- IXGBE_WRITE_REG(hw, IXGBE_SYNQF, synqf);
- return 0;
+ if (filter_op == RTE_ETH_FILTER_NOP)
+ return ret;
+
+ 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 = 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 = -ENOSYS;
+ break;
+ }
+
+ return ret;
}
-/*
- * 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_dev_filter_ctrl(struct rte_eth_dev *dev,
+ enum rte_filter_type filter_type,
+ 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 = 0;
- if (hw->mac.type != ixgbe_mac_82599EB)
- return -ENOSYS;
+ if (dev == NULL)
+ return -EINVAL;
- 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);
- return 0;
+ switch (filter_type) {
+ 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);
+ ret = -EINVAL;
+ break;
}
- return -ENOENT;
+
+ return ret;
}
/*
--
1.9.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH v2 0/6] Integrate syn filter in igb/ixgbe driver to new API
2015-01-08 1:42 [dpdk-dev] [PATCH] ixgbe/igb: integrate syn filter to new API zhida zang
@ 2015-02-11 7:51 ` Jingjing Wu
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 1/6] ethdev: define syn filter type and its structure Jingjing Wu
` (7 more replies)
0 siblings, 8 replies; 10+ messages in thread
From: Jingjing Wu @ 2015-02-11 7:51 UTC (permalink / raw)
To: dev
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH v2 1/6] ethdev: define syn filter type and its structure
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 0/6] Integrate syn filter in igb/ixgbe driver " Jingjing Wu
@ 2015-02-11 7:51 ` Jingjing Wu
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 2/6] ixgbe: new functions replace old ones for syn filter Jingjing Wu
` (6 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Jingjing Wu @ 2015-02-11 7:51 UTC (permalink / raw)
To: dev
This patch defines syn filter type RTE_ETH_FILTER_SYN and its structure rte_eth_syn_filter.
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
lib/librte_ether/rte_eth_ctrl.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index 0ce241e..21ee9e3 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -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 {
--
1.9.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH v2 2/6] ixgbe: new functions replace old ones for syn filter
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 0/6] Integrate syn filter in igb/ixgbe driver " Jingjing Wu
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 1/6] ethdev: define syn filter type and its structure Jingjing Wu
@ 2015-02-11 7:51 ` Jingjing Wu
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 3/6] e1000: " Jingjing Wu
` (5 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Jingjing Wu @ 2015-02-11 7:51 UTC (permalink / raw)
To: dev
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.
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 167 +++++++++++++++++-------------------
1 file changed, 81 insertions(+), 86 deletions(-)
diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
index b341dd0..0616c8f 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -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);
--
1.9.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH v2 3/6] e1000: new functions replace old ones for syn filter
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 0/6] Integrate syn filter in igb/ixgbe driver " Jingjing Wu
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 1/6] ethdev: define syn filter type and its structure Jingjing Wu
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 2/6] ixgbe: new functions replace old ones for syn filter Jingjing Wu
@ 2015-02-11 7:51 ` Jingjing Wu
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 4/6] testpmd: new commands " Jingjing Wu
` (4 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Jingjing Wu @ 2015-02-11 7:51 UTC (permalink / raw)
To: dev
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.
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
lib/librte_pmd_e1000/igb_ethdev.c | 152 ++++++++++++++++++++------------------
1 file changed, 81 insertions(+), 71 deletions(-)
diff --git a/lib/librte_pmd_e1000/igb_ethdev.c b/lib/librte_pmd_e1000/igb_ethdev.c
index 2a268b8..60abd91 100644
--- a/lib/librte_pmd_e1000/igb_ethdev.c
+++ b/lib/librte_pmd_e1000/igb_ethdev.c
@@ -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);
--
1.9.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH v2 4/6] testpmd: new commands for syn filter
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 0/6] Integrate syn filter in igb/ixgbe driver " Jingjing Wu
` (2 preceding siblings ...)
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 3/6] e1000: " Jingjing Wu
@ 2015-02-11 7:51 ` Jingjing Wu
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 5/6] ethdev: remove old APIs and structures of " Jingjing Wu
` (3 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Jingjing Wu @ 2015-02-11 7:51 UTC (permalink / raw)
To: dev
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)
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
app/test-pmd/cmdline.c | 143 ++++++++++++++++++++++---------------------------
app/test-pmd/config.c | 21 --------
2 files changed, 65 insertions(+), 99 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 590e427..f8d9f03 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -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,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index c40f819..10454ab 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -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;
--
1.9.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH v2 5/6] ethdev: remove old APIs and structures of syn filter
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 0/6] Integrate syn filter in igb/ixgbe driver " Jingjing Wu
` (3 preceding siblings ...)
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 4/6] testpmd: new commands " Jingjing Wu
@ 2015-02-11 7:51 ` Jingjing Wu
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 6/6] doc: commands changed in testpmd_funcs for " Jingjing Wu
` (2 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Jingjing Wu @ 2015-02-11 7:51 UTC (permalink / raw)
To: dev
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
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
lib/librte_ether/rte_ethdev.c | 50 --------------------------------
lib/librte_ether/rte_ethdev.h | 67 -------------------------------------------
2 files changed, 117 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index ea3a1fb..709ba90 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -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)
{
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 1200c1c..2ab7453 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -972,14 +972,6 @@ TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
#define TCP_FLAG_ALL 0x3F
/**
- * A structure used to define an syn filter.
- */
-struct rte_syn_filter {
- uint8_t hig_pri; /**< 1 means higher pri than 2tuple, 5tupe,
- and flex filter, 0 means lower pri. */
-};
-
-/**
* A structure used to define a 2tuple filter.
*/
struct rte_2tuple_filter {
@@ -1352,17 +1344,6 @@ typedef int32_t (*bypass_ver_show_t)(struct rte_eth_dev *dev, uint32_t *ver);
typedef int32_t (*bypass_wd_reset_t)(struct rte_eth_dev *dev);
#endif
-typedef int (*eth_add_syn_filter_t)(struct rte_eth_dev *dev,
- struct rte_syn_filter *filter, uint16_t rx_queue);
-/**< @internal add syn filter rule on an Ethernet device */
-
-typedef int (*eth_remove_syn_filter_t)(struct rte_eth_dev *dev);
-/**< @internal remove syn filter rule on an Ethernet device */
-
-typedef int (*eth_get_syn_filter_t)(struct rte_eth_dev *dev,
- struct rte_syn_filter *filter, uint16_t *rx_queue);
-/**< @internal Get syn filter rule on an Ethernet device */
-
typedef int (*eth_add_2tuple_filter_t)(struct rte_eth_dev *dev,
uint16_t index, struct rte_2tuple_filter *filter,
uint16_t rx_queue);
@@ -1506,9 +1487,6 @@ struct eth_dev_ops {
rss_hash_update_t rss_hash_update;
/** Get current RSS hash configuration. */
rss_hash_conf_get_t rss_hash_conf_get;
- eth_add_syn_filter_t add_syn_filter; /**< add syn filter. */
- eth_remove_syn_filter_t remove_syn_filter; /**< remove syn filter. */
- eth_get_syn_filter_t get_syn_filter; /**< get syn filter. */
eth_add_2tuple_filter_t add_2tuple_filter; /**< add 2tuple filter. */
eth_remove_2tuple_filter_t remove_2tuple_filter; /**< remove 2tuple filter. */
eth_get_2tuple_filter_t get_2tuple_filter; /**< get 2tuple filter. */
@@ -3401,51 +3379,6 @@ int
rte_eth_dev_udp_tunnel_delete(uint8_t port_id,
struct rte_eth_udp_tunnel *tunnel_udp);
-/**
- * add syn filter
- *
- * @param port_id
- * The port identifier of the Ethernet device.
- * @param rx_queue
- * The index of RX queue where to store RX packets matching the syn filter.
- * @param filter
- * The pointer to the structure describing the syn filter rule.
- * @return
- * - (0) if successful.
- * - (-ENOTSUP) if hardware doesn't support.
- * - (-EINVAL) if bad parameter.
- */
-int rte_eth_dev_add_syn_filter(uint8_t port_id,
- struct rte_syn_filter *filter, uint16_t rx_queue);
-
-/**
- * remove syn filter
- *
- * @param port_id
- * The port identifier of the Ethernet device.
- * @return
- * - (0) if successful.
- * - (-ENOTSUP) if hardware doesn't support.
- * - (-EINVAL) if bad parameter.
- */
-int rte_eth_dev_remove_syn_filter(uint8_t port_id);
-
-/**
- * get syn filter
- *
- * @param port_id
- * The port identifier of the Ethernet device.
- * @param filter
- * The pointer to the structure describing the syn filter.
- * @param rx_queue
- * A pointer to get the queue index of syn filter.
- * @return
- * - (0) if successful.
- * - (-ENOTSUP) if hardware doesn't support.
- * - (-EINVAL) if bad parameter.
- */
-int rte_eth_dev_get_syn_filter(uint8_t port_id,
- struct rte_syn_filter *filter, uint16_t *rx_queue);
/**
* Add a new 2tuple filter rule on an Ethernet device.
--
1.9.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH v2 6/6] doc: commands changed in testpmd_funcs for syn filter
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 0/6] Integrate syn filter in igb/ixgbe driver " Jingjing Wu
` (4 preceding siblings ...)
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 5/6] ethdev: remove old APIs and structures of " Jingjing Wu
@ 2015-02-11 7:51 ` Jingjing Wu
2015-02-12 5:41 ` [dpdk-dev] [PATCH v2 0/6] Integrate syn filter in igb/ixgbe driver to new API Wu, Jingjing
2015-02-22 2:10 ` Thomas Monjalon
7 siblings, 0 replies; 10+ messages in thread
From: Jingjing Wu @ 2015-02-11 7:51 UTC (permalink / raw)
To: dev
document of new command:
- syn_filter (port_id) (add|del) priority (high|low) queue (queue_id)
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 30 ++++-------------------------
1 file changed, 4 insertions(+), 26 deletions(-)
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 218835a..393cbea 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -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
~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/6] Integrate syn filter in igb/ixgbe driver to new API
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 0/6] Integrate syn filter in igb/ixgbe driver " Jingjing Wu
` (5 preceding siblings ...)
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 6/6] doc: commands changed in testpmd_funcs for " Jingjing Wu
@ 2015-02-12 5:41 ` Wu, Jingjing
2015-02-22 2:10 ` Thomas Monjalon
7 siblings, 0 replies; 10+ messages in thread
From: Wu, Jingjing @ 2015-02-12 5:41 UTC (permalink / raw)
To: dev
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
> -----Original Message-----
> From: Wu, Jingjing
> Sent: Wednesday, February 11, 2015 3:52 PM
> To: dev@dpdk.org
> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/6] Integrate syn filter in igb/ixgbe driver to new API
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 0/6] Integrate syn filter in igb/ixgbe driver " Jingjing Wu
` (6 preceding siblings ...)
2015-02-12 5:41 ` [dpdk-dev] [PATCH v2 0/6] Integrate syn filter in igb/ixgbe driver to new API Wu, Jingjing
@ 2015-02-22 2:10 ` Thomas Monjalon
7 siblings, 0 replies; 10+ messages in thread
From: Thomas Monjalon @ 2015-02-22 2:10 UTC (permalink / raw)
To: Jingjing Wu; +Cc: dev
> 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
Applied, thanks.
I removed the old API functions from the version map.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-02-22 2:11 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-08 1:42 [dpdk-dev] [PATCH] ixgbe/igb: integrate syn filter to new API zhida zang
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 0/6] Integrate syn filter in igb/ixgbe driver " Jingjing Wu
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 1/6] ethdev: define syn filter type and its structure Jingjing Wu
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 2/6] ixgbe: new functions replace old ones for syn filter Jingjing Wu
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 3/6] e1000: " Jingjing Wu
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 4/6] testpmd: new commands " Jingjing Wu
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 5/6] ethdev: remove old APIs and structures of " Jingjing Wu
2015-02-11 7:51 ` [dpdk-dev] [PATCH v2 6/6] doc: commands changed in testpmd_funcs for " Jingjing Wu
2015-02-12 5:41 ` [dpdk-dev] [PATCH v2 0/6] Integrate syn filter in igb/ixgbe driver to new API Wu, Jingjing
2015-02-22 2:10 ` Thomas Monjalon
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).