Instead of SYN filter RTE flow API should be used.
Move corresponding definitions to ethdev internal driver API
since it is used by drivers internally.
Preserve RTE_ETH_FILTER_SYN because of it as well.
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
" priority (prio_value) queue (queue_id)\n"
" Add/Del a 5tuple filter.\n\n"
- "syn_filter (port_id) (add|del) priority (high|low) queue (queue_id)"
- " Add/Del syn filter.\n\n"
-
"flow_director_filter (port_id) mode IP (add|del|update)"
" flow (ipv4-other|ipv4-frag|ipv6-other|ipv6-frag)"
" src (src_ip_address) dst (dst_ip_address)"
},
};
-/* *** Add/Del syn filter *** */
-struct cmd_syn_filter_result {
- cmdline_fixed_string_t filter;
- portid_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;
-};
-
-static void
-cmd_syn_filter_parsed(void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_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
- 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_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, UINT16);
-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_syn_filter_result,
- priority, "priority");
-cmdline_parse_token_string_t cmd_syn_filter_high =
- 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_syn_filter_result,
- queue, "queue");
-cmdline_parse_token_num_t cmd_syn_filter_queue_id =
- TOKEN_NUM_INITIALIZER(struct cmd_syn_filter_result,
- queue_id, UINT16);
-
-cmdline_parse_inst_t cmd_syn_filter = {
- .f = cmd_syn_filter_parsed,
- .data = NULL,
- .help_str = "syn_filter <port_id> add|del priority high|low queue "
- "<queue_id>: 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,
- },
-};
-
/* *** queue region set *** */
struct cmd_queue_region_result {
cmdline_fixed_string_t set;
(cmdline_parse_inst_t *)&cmd_config_rss_hash_key,
(cmdline_parse_inst_t *)&cmd_dump,
(cmdline_parse_inst_t *)&cmd_dump_one,
- (cmdline_parse_inst_t *)&cmd_syn_filter,
(cmdline_parse_inst_t *)&cmd_2tuple_filter,
(cmdline_parse_inst_t *)&cmd_5tuple_filter,
(cmdline_parse_inst_t *)&cmd_add_del_ip_flow_director,
* ethdev: the legacy filter API, including
``rte_eth_dev_filter_supported()``, ``rte_eth_dev_filter_ctrl()`` as well
- as filter types SYN, NTUPLE, TUNNEL, FDIR,
+ as filter types NTUPLE, TUNNEL, FDIR,
HASH and L2_TUNNEL, is superseded by the generic flow API (rte_flow) in
PMDs that implement the latter.
The legacy API will be removed in DPDK 20.11.
dst_port 64 src_port 32 protocol 0x06 mask 0x1F \
flags 0x0 priority 3 queue 3
-syn_filter
-~~~~~~~~~~
-
-Using the SYN filter, TCP packets whose *SYN* flag is set can be forwarded to a separate queue::
-
- syn_filter (port_id) (add|del) priority (high|low) queue (queue_id)
-
-The available information parameters are:
-
-* ``port_id``: The port which the SYN filter assigned on.
-
-* ``high``: This SYN filter has higher priority than other filters.
-
-* ``low``: This SYN filter has lower priority than other filters.
-
-* ``queue_id``: The receive queue associated with this SYN filter
-
-Example::
-
- testpmd> syn_filter 0 add priority high queue 3
-
.. _testpmd_flow_director:
flow_director_filter
struct rte_eth_rss_reta_entry64 *reta_conf,
uint16_t reta_size);
-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 igb_add_2tuple_filter(struct rte_eth_dev *dev,
struct rte_eth_ntuple_filter *ntuple_filter);
static int igb_remove_2tuple_filter(struct rte_eth_dev *dev,
return 0;
}
-static int
-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;
-
- 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;
- 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", filter_op);
- ret = -EINVAL;
- break;
- }
-
- return ret;
-}
-
/* translate elements in struct rte_eth_ntuple_filter to struct e1000_2tuple_filter_info*/
static inline int
ntuple_filter_to_2tuple(struct rte_eth_ntuple_filter *filter,
case RTE_ETH_FILTER_NTUPLE:
ret = igb_ntuple_filter_handle(dev, filter_op, arg);
break;
- case RTE_ETH_FILTER_SYN:
- ret = eth_igb_syn_filter_handle(dev, filter_op, arg);
- break;
case RTE_ETH_FILTER_GENERIC:
if (filter_op != RTE_ETH_FILTER_GET)
return -EINVAL;
static void ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index);
static int ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev,
struct rte_ether_addr *mac_addr);
-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,
struct ixgbe_5tuple_filter *filter);
static void ixgbe_remove_5tuple_filter(struct rte_eth_dev *dev,
return 0;
}
-static int
-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 = IXGBE_READ_REG(hw, IXGBE_SYNQF);
-
- 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;
-}
-
-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;
-
- 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 = 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", filter_op);
- ret = -EINVAL;
- break;
- }
-
- return ret;
-}
-
static inline enum ixgbe_5tuple_protocol
convert_protocol_type(uint8_t protocol_value)
case RTE_ETH_FILTER_NTUPLE:
ret = ixgbe_ntuple_filter_handle(dev, filter_op, arg);
break;
- case RTE_ETH_FILTER_SYN:
- ret = ixgbe_syn_filter_handle(dev, filter_op, arg);
- break;
case RTE_ETH_FILTER_FDIR:
ret = ixgbe_fdir_ctrl_func(dev, filter_op, arg);
break;
*(const void **)arg = &qede_flow_ops;
return 0;
- case RTE_ETH_FILTER_SYN:
case RTE_ETH_FILTER_HASH:
case RTE_ETH_FILTER_L2_TUNNEL:
case RTE_ETH_FILTER_MAX:
case RTE_ETH_FILTER_NONE:
sfc_err(sa, "Global filters configuration not supported");
break;
- case RTE_ETH_FILTER_SYN:
- sfc_err(sa, "SYN filters not supported");
- break;
case RTE_ETH_FILTER_NTUPLE:
sfc_err(sa, "NTUPLE filters not supported");
break;
RTE_ETH_FILTER_OP_MAX
};
-/**
- * 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 */
-};
-
/**
* Define all structures for ntuple Filter type.
*/
uint16_t queue; /**< Queue assigned to when match*/
};
+/**
+ * A structure used to define the TCP syn filter entry
+ * to support RTE_ETH_FILTER_SYN data representation.
+ */
+struct rte_eth_syn_filter {
+ /** 1 - higher priority than other filters, 0 - lower priority. */
+ uint8_t hig_pri;
+ uint16_t queue; /**< Queue assigned to when match */
+};
+
#ifdef __cplusplus
}
#endif