From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1B9ACA04B0; Sun, 18 Oct 2020 16:10:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 791B0CA08; Sun, 18 Oct 2020 16:09:30 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id 79670C87A for ; Sun, 18 Oct 2020 16:09:26 +0200 (CEST) Received: from mx1-us1.ppe-hosted.com (unknown [10.110.50.150]) by dispatch1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 1754F20087; Sun, 18 Oct 2020 14:09:25 +0000 (UTC) Received: from us4-mdac16-62.at1.mdlocal (unknown [10.110.50.155]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 155E0800A3; Sun, 18 Oct 2020 14:09:25 +0000 (UTC) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us1.ppe-hosted.com (unknown [10.110.50.12]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 87F64100061; Sun, 18 Oct 2020 14:09:24 +0000 (UTC) Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 4DFAF4005B; Sun, 18 Oct 2020 14:09:24 +0000 (UTC) Received: from ukex01.SolarFlarecom.com (10.17.10.4) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 18 Oct 2020 15:09:19 +0100 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sun, 18 Oct 2020 15:09:19 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id 09IE9Jlj002033; Sun, 18 Oct 2020 15:09:19 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 31D8F1613A9; Sun, 18 Oct 2020 15:09:19 +0100 (BST) From: Andrew Rybchenko To: Wenzhuo Lu , Beilei Xing , Bernard Iremonger , Ray Kinsella , Neil Horman , Jeff Guo , Haiyue Wang , Rasesh Mody , Shahed Shaikh , Andrew Rybchenko CC: Date: Sun, 18 Oct 2020 15:09:01 +0100 Message-ID: <1603030152-13451-5-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1603030152-13451-1-git-send-email-arybchenko@solarflare.com> References: <1603030152-13451-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.6.1012-25732.003 X-TM-AS-Result: No-17.078900-8.000000-10 X-TMASE-MatchedRID: WZ4RUs49kiDXhaZsZZP8sDahjZPEodkXY/L2/AZJAWSYkF7ZtFfCU0I9 0U6XYOu38XVI39JCRnRuL3ESIrARlyHhSBQfglfsA9lly13c/gHYuVu0X/rOkJGhAvBSa2i/Ceg a5Z7JsDGRbYgMp8kCH7FjRXmWmjfVcqDeIxo3t8hPs79gcmEg0HE01tKb2rARVI7KaIl9Nhdo8w ucTFrANc2yqQsaXQic1575LJbEh7B+kzNEKbXWo+Pwk3jODTrZnyQFaVgMM2Ag2yVdj3LAROLSd VP2tZn5gjiRDGW7Bcy2MJS2H4HaNtGZBRXICgnt6GyDR2ZB+cai8D/o42y/SuQ45nVtPqmx1SNB BkEOrj5PJKNFvY5r+b6oBTCBl4wcBZdQz2rkVg5FeAr5guIYJrto11mU6Hl8x5B+7qLBJ+xwcpE 9NiP9Xav7P7uHsnluOvlrxAcLL1fDJQPapbvuAihJ5tvbfbyL3FYvKmZiVnMB3LgzIBkuA4O5Tf SzrxQ7XIP6Tr+fSxOyc/zO2GdYPJOA1IVKiSC+oS0guoV6SZexq37CBjJNbJsoi2XrUn/JUTdY/ mdfTXtJKW4mDlJsMbxAi7jPoeEQftwZ3X11IV0= X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--17.078900-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.6.1012-25732.003 X-MDID: 1603030165-0bIt2C3Jfzmz X-PPE-DISP: 1603030165;0bIt2C3Jfzmz Subject: [dpdk-dev] [PATCH 04/14] ethdev: remove legacy flexible filter type support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" RTE flow API should be used for filtering. Temporarily preserve helper defines in public interface. Signed-off-by: Andrew Rybchenko --- app/test-pmd/cmdline.c | 195 --------------------------- doc/guides/rel_notes/deprecation.rst | 2 +- drivers/net/e1000/igb_ethdev.c | 104 -------------- drivers/net/qede/qede_filter.c | 1 - drivers/net/sfc/sfc_ethdev.c | 3 - 5 files changed, 1 insertion(+), 304 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index f0fe97fb9c..e7e85cf304 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -993,11 +993,6 @@ static void cmd_help_long_parsed(void *parsed_result, "syn_filter (port_id) (add|del) priority (high|low) queue (queue_id)" " Add/Del syn filter.\n\n" - "flex_filter (port_id) (add|del) len (len_value)" - " bytes (bytes_value) mask (mask_value)" - " priority (prio_value) queue (queue_id)\n" - " Add/Del a flex 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)" @@ -10873,195 +10868,6 @@ cmdline_parse_inst_t cmd_5tuple_filter = { }, }; -/* *** ADD/REMOVE A flex FILTER *** */ -struct cmd_flex_filter_result { - cmdline_fixed_string_t filter; - cmdline_fixed_string_t ops; - portid_t port_id; - cmdline_fixed_string_t len; - uint8_t len_value; - cmdline_fixed_string_t bytes; - cmdline_fixed_string_t bytes_value; - cmdline_fixed_string_t mask; - cmdline_fixed_string_t mask_value; - cmdline_fixed_string_t priority; - uint8_t priority_value; - cmdline_fixed_string_t queue; - uint16_t queue_id; -}; - -static int xdigit2val(unsigned char c) -{ - int val; - if (isdigit(c)) - val = c - '0'; - else if (isupper(c)) - val = c - 'A' + 10; - else - val = c - 'a' + 10; - return val; -} - -static void -cmd_flex_filter_parsed(void *parsed_result, - __rte_unused struct cmdline *cl, - __rte_unused void *data) -{ - int ret = 0; - struct rte_eth_flex_filter filter; - struct cmd_flex_filter_result *res = parsed_result; - char *bytes_ptr, *mask_ptr; - uint16_t len, i, j = 0; - char c; - int val; - uint8_t byte = 0; - - if (res->len_value > RTE_FLEX_FILTER_MAXLEN) { - printf("the len exceed the max length 128\n"); - return; - } - memset(&filter, 0, sizeof(struct rte_eth_flex_filter)); - filter.len = res->len_value; - filter.priority = res->priority_value; - filter.queue = res->queue_id; - bytes_ptr = res->bytes_value; - mask_ptr = res->mask_value; - - /* translate bytes string to array. */ - if (bytes_ptr[0] == '0' && ((bytes_ptr[1] == 'x') || - (bytes_ptr[1] == 'X'))) - bytes_ptr += 2; - len = strnlen(bytes_ptr, res->len_value * 2); - if (len == 0 || (len % 8 != 0)) { - printf("please check len and bytes input\n"); - return; - } - for (i = 0; i < len; i++) { - c = bytes_ptr[i]; - if (isxdigit(c) == 0) { - /* invalid characters. */ - printf("invalid input\n"); - return; - } - val = xdigit2val(c); - if (i % 2) { - byte |= val; - filter.bytes[j] = byte; - printf("bytes[%d]:%02x ", j, filter.bytes[j]); - j++; - byte = 0; - } else - byte |= val << 4; - } - printf("\n"); - /* translate mask string to uint8_t array. */ - if (mask_ptr[0] == '0' && ((mask_ptr[1] == 'x') || - (mask_ptr[1] == 'X'))) - mask_ptr += 2; - len = strnlen(mask_ptr, (res->len_value + 3) / 4); - if (len == 0) { - printf("invalid input\n"); - return; - } - j = 0; - byte = 0; - for (i = 0; i < len; i++) { - c = mask_ptr[i]; - if (isxdigit(c) == 0) { - /* invalid characters. */ - printf("invalid input\n"); - return; - } - val = xdigit2val(c); - if (i % 2) { - byte |= val; - filter.mask[j] = byte; - printf("mask[%d]:%02x ", j, filter.mask[j]); - j++; - byte = 0; - } else - byte |= val << 4; - } - printf("\n"); - - if (!strcmp(res->ops, "add")) - ret = rte_eth_dev_filter_ctrl(res->port_id, - RTE_ETH_FILTER_FLEXIBLE, - RTE_ETH_FILTER_ADD, - &filter); - else - ret = rte_eth_dev_filter_ctrl(res->port_id, - RTE_ETH_FILTER_FLEXIBLE, - RTE_ETH_FILTER_DELETE, - &filter); - - if (ret < 0) - printf("flex filter setting error: (%s)\n", strerror(-ret)); -} - -cmdline_parse_token_string_t cmd_flex_filter_filter = - TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result, - filter, "flex_filter"); -cmdline_parse_token_num_t cmd_flex_filter_port_id = - TOKEN_NUM_INITIALIZER(struct cmd_flex_filter_result, - port_id, UINT16); -cmdline_parse_token_string_t cmd_flex_filter_ops = - TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result, - ops, "add#del"); -cmdline_parse_token_string_t cmd_flex_filter_len = - TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result, - len, "len"); -cmdline_parse_token_num_t cmd_flex_filter_len_value = - TOKEN_NUM_INITIALIZER(struct cmd_flex_filter_result, - len_value, UINT8); -cmdline_parse_token_string_t cmd_flex_filter_bytes = - TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result, - bytes, "bytes"); -cmdline_parse_token_string_t cmd_flex_filter_bytes_value = - TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result, - bytes_value, NULL); -cmdline_parse_token_string_t cmd_flex_filter_mask = - TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result, - mask, "mask"); -cmdline_parse_token_string_t cmd_flex_filter_mask_value = - TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result, - mask_value, NULL); -cmdline_parse_token_string_t cmd_flex_filter_priority = - TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result, - priority, "priority"); -cmdline_parse_token_num_t cmd_flex_filter_priority_value = - TOKEN_NUM_INITIALIZER(struct cmd_flex_filter_result, - priority_value, UINT8); -cmdline_parse_token_string_t cmd_flex_filter_queue = - TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result, - queue, "queue"); -cmdline_parse_token_num_t cmd_flex_filter_queue_id = - TOKEN_NUM_INITIALIZER(struct cmd_flex_filter_result, - queue_id, UINT16); -cmdline_parse_inst_t cmd_flex_filter = { - .f = cmd_flex_filter_parsed, - .data = NULL, - .help_str = "flex_filter add|del len bytes " - " mask priority queue : " - "Add/Del a flex filter", - .tokens = { - (void *)&cmd_flex_filter_filter, - (void *)&cmd_flex_filter_port_id, - (void *)&cmd_flex_filter_ops, - (void *)&cmd_flex_filter_len, - (void *)&cmd_flex_filter_len_value, - (void *)&cmd_flex_filter_bytes, - (void *)&cmd_flex_filter_bytes_value, - (void *)&cmd_flex_filter_mask, - (void *)&cmd_flex_filter_mask_value, - (void *)&cmd_flex_filter_priority, - (void *)&cmd_flex_filter_priority_value, - (void *)&cmd_flex_filter_queue, - (void *)&cmd_flex_filter_queue_id, - NULL, - }, -}; - /* *** Filters Control *** */ /* *** deal with flow director filter *** */ @@ -19833,7 +19639,6 @@ cmdline_parse_ctx_t main_ctx[] = { (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_flex_filter, (cmdline_parse_inst_t *)&cmd_add_del_ip_flow_director, (cmdline_parse_inst_t *)&cmd_add_del_udp_flow_director, (cmdline_parse_inst_t *)&cmd_add_del_sctp_flow_director, diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index f655fc06ac..4ed78809c0 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -108,7 +108,7 @@ Deprecation Notices * ethdev: the legacy filter API, including ``rte_eth_dev_filter_supported()``, ``rte_eth_dev_filter_ctrl()`` as well - as filter types FLEXIBLE, SYN, NTUPLE, TUNNEL, FDIR, + as filter types SYN, 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. diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index 8b18f1cb28..7f99b76e48 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -195,11 +195,6 @@ 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, struct rte_eth_ntuple_filter *ntuple_filter); -static int eth_igb_get_flex_filter(struct rte_eth_dev *dev, - struct rte_eth_flex_filter *filter); -static int eth_igb_flex_filter_handle(struct rte_eth_dev *dev, - enum rte_filter_op filter_op, - void *arg); static int igb_add_5tuple_filter_82576(struct rte_eth_dev *dev, struct rte_eth_ntuple_filter *ntuple_filter); static int igb_remove_5tuple_filter_82576(struct rte_eth_dev *dev, @@ -4127,102 +4122,6 @@ eth_igb_add_del_flex_filter(struct rte_eth_dev *dev, return 0; } -static int -eth_igb_get_flex_filter(struct rte_eth_dev *dev, - struct rte_eth_flex_filter *filter) -{ - struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct e1000_filter_info *filter_info = - E1000_DEV_PRIVATE_TO_FILTER_INFO(dev->data->dev_private); - struct e1000_flex_filter flex_filter, *it; - uint32_t wufc, queueing, wufc_en = 0; - - memset(&flex_filter, 0, sizeof(struct e1000_flex_filter)); - flex_filter.filter_info.len = filter->len; - flex_filter.filter_info.priority = filter->priority; - memcpy(flex_filter.filter_info.dwords, filter->bytes, filter->len); - memcpy(flex_filter.filter_info.mask, filter->mask, - RTE_ALIGN(filter->len, CHAR_BIT) / CHAR_BIT); - - it = eth_igb_flex_filter_lookup(&filter_info->flex_list, - &flex_filter.filter_info); - if (it == NULL) { - PMD_DRV_LOG(ERR, "filter doesn't exist."); - return -ENOENT; - } - - wufc = E1000_READ_REG(hw, E1000_WUFC); - wufc_en = E1000_WUFC_FLEX_HQ | (E1000_WUFC_FLX0 << it->index); - - if ((wufc & wufc_en) == wufc_en) { - uint32_t reg_off = 0; - if (it->index < E1000_MAX_FHFT) - reg_off = E1000_FHFT(it->index); - else - reg_off = E1000_FHFT_EXT(it->index - E1000_MAX_FHFT); - - queueing = E1000_READ_REG(hw, - reg_off + E1000_FHFT_QUEUEING_OFFSET); - filter->len = queueing & E1000_FHFT_QUEUEING_LEN; - filter->priority = (queueing & E1000_FHFT_QUEUEING_PRIO) >> - E1000_FHFT_QUEUEING_PRIO_SHIFT; - filter->queue = (queueing & E1000_FHFT_QUEUEING_QUEUE) >> - E1000_FHFT_QUEUEING_QUEUE_SHIFT; - return 0; - } - return -ENOENT; -} - -static int -eth_igb_flex_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); - struct rte_eth_flex_filter *filter; - int ret = 0; - - MAC_TYPE_FILTER_SUP_EXT(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; - } - - filter = (struct rte_eth_flex_filter *)arg; - if (filter->len == 0 || filter->len > E1000_MAX_FLEX_FILTER_LEN - || filter->len % sizeof(uint64_t) != 0) { - PMD_DRV_LOG(ERR, "filter's length is out of range"); - return -EINVAL; - } - if (filter->priority > E1000_MAX_FLEX_FILTER_PRI) { - PMD_DRV_LOG(ERR, "filter's priority is out of range"); - return -EINVAL; - } - - switch (filter_op) { - case RTE_ETH_FILTER_ADD: - ret = eth_igb_add_del_flex_filter(dev, filter, TRUE); - break; - case RTE_ETH_FILTER_DELETE: - ret = eth_igb_add_del_flex_filter(dev, filter, FALSE); - break; - case RTE_ETH_FILTER_GET: - ret = eth_igb_get_flex_filter(dev, filter); - 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_5tuple_filter_info*/ static inline int ntuple_filter_to_5tuple_82576(struct rte_eth_ntuple_filter *filter, @@ -4852,9 +4751,6 @@ eth_igb_filter_ctrl(struct rte_eth_dev *dev, case RTE_ETH_FILTER_SYN: ret = eth_igb_syn_filter_handle(dev, filter_op, arg); break; - case RTE_ETH_FILTER_FLEXIBLE: - ret = eth_igb_flex_filter_handle(dev, filter_op, arg); - break; case RTE_ETH_FILTER_GENERIC: if (filter_op != RTE_ETH_FILTER_GET) return -EINVAL; diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c index 4d31db09fd..28dc9d2234 100644 --- a/drivers/net/qede/qede_filter.c +++ b/drivers/net/qede/qede_filter.c @@ -1561,7 +1561,6 @@ int qede_dev_filter_ctrl(struct rte_eth_dev *eth_dev, *(const void **)arg = &qede_flow_ops; return 0; - case RTE_ETH_FILTER_FLEXIBLE: case RTE_ETH_FILTER_SYN: case RTE_ETH_FILTER_HASH: case RTE_ETH_FILTER_L2_TUNNEL: diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 75f3a2f3d3..d976a57f2a 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -1748,9 +1748,6 @@ sfc_dev_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type, case RTE_ETH_FILTER_NONE: sfc_err(sa, "Global filters configuration not supported"); break; - case RTE_ETH_FILTER_FLEXIBLE: - sfc_err(sa, "Flexible filters not supported"); - break; case RTE_ETH_FILTER_SYN: sfc_err(sa, "SYN filters not supported"); break; -- 2.17.1