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 0A4D6A04DD; Thu, 22 Oct 2020 11:44:02 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E2F60A978; Thu, 22 Oct 2020 11:43:13 +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 EA861A961 for ; Thu, 22 Oct 2020 11:43:04 +0200 (CEST) Received: from mx1-us1.ppe-hosted.com (unknown [10.110.50.144]) by dispatch1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 8BD3B20054; Thu, 22 Oct 2020 09:43:03 +0000 (UTC) Received: from us4-mdac16-6.at1.mdlocal (unknown [10.110.49.173]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 8A59A800A4; Thu, 22 Oct 2020 09:43:03 +0000 (UTC) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us1.ppe-hosted.com (unknown [10.110.48.45]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id E6E0540070; Thu, 22 Oct 2020 09:43:02 +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 A5A7294005E; Thu, 22 Oct 2020 09:43:02 +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; Thu, 22 Oct 2020 10:42:59 +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; Thu, 22 Oct 2020 10:42:59 +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 09M9gxsL023058; Thu, 22 Oct 2020 10:42:59 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 9D9001613A9; Thu, 22 Oct 2020 10:42:59 +0100 (BST) From: Andrew Rybchenko To: Wenzhuo Lu , Beilei Xing , Bernard Iremonger , Jeff Guo , Ray Kinsella , Neil Horman , Ajit Khaparde , "Somnath Kotur" , Haiyue Wang , Ziyang Xuan , Xiaoyun Wang , Guoyang Zhou , Rasesh Mody , Shahed Shaikh , Andrew Rybchenko , Thomas Monjalon , Ferruh Yigit CC: Date: Thu, 22 Oct 2020 10:42:26 +0100 Message-ID: <1603359758-13297-4-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1603359758-13297-1-git-send-email-arybchenko@solarflare.com> References: <1603030152-13451-1-git-send-email-arybchenko@solarflare.com> <1603359758-13297-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-25740.003 X-TM-AS-Result: No-5.155300-8.000000-10 X-TMASE-MatchedRID: iCwxAcLLwNz0gpEqM7fvYXv15w39S8ARF03B4pKYOlpG7aLtT3oj+/6j 8HS3/czlthz3TgitSFEFVUurgY9KHJz3nEP4SjjATh4VSQfkIVxj8vb8BkkBZJiQXtm0V8JTjBY hGYtVark003R2T+VvjnDlPghqPnfyYlldA0POS1IaPMGCcVm9DjVfUuzvrtymLOTWSyrh/a+4XK pxkpLQENsJaQHvex3I17jUFFfYfdrxVhA9+h9R2tg26OTuHfEpIQXVF2qsdV0C/nuPl5P0FsTb/ /lo+C7RzChniH3lAV5jO2cJJWVbWyjESUGpPmz2l2fRVpVyo6Si8D/o42y/SiBFbq1oR0BmufI7 V72pGLPZfxIlRtpm46sxNZGJ2rucxB4q1/hY9HPlvSeYSYEULAM8HHgJ/SSz0SxMhOhuA0SJCCD qm0eRewpr4p4pYh/KiBiBWAF8SD5d76qOGHW5eBIRh9wkXSlFA7f8DkoYc/8gUEQTkIWiYqo6hc XA9s6k0ZDvzY8kihzrfYDk2JaSWT58xbJHDY3reJ2BzwQDOOhIq1BEJ6pINMAtnXPNjFICauPBr y+3W1F+azQmuxyxbpr4LLNNFb2NXEG1LCXlWK5bUzvsaHW6BgKflB9+9kWVfkiy7TTogYZgbnJX 7723/esjzEDT4X8ftw9p5vhqOLwzPLZX9anwtf9N7e3lwkwb4F58RPNYsrGOIsAELqL7WPWKGTh Q2qZNqS9hAGtRlePjGOEzKgJSgmDQVDIhW5mmeUiTWYHRXE9QYo4xNF42PnfG3eNeaU1ylwyWSy 8TJerO0pdSWEgFjCcZ8sQHnls3L47TD00zmvKeAiCmPx4NwBnUJ0Ek6yhjxEHRux+uk8jHUU+U0 ACZwO2xmFz4PmY4VicGJlGSsY/Ac+1/Mwq1JrD4moT40tfvnqg/VrSZEiM= X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--5.155300-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.6.1012-25740.003 X-MDID: 1603359783-KqjJRv6Fe0eq X-PPE-DISP: 1603359783;KqjJRv6Fe0eq Subject: [dpdk-dev] [PATCH v2 03/14] ethdev: remove legacy EtherType 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" Instead of EtherType 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_ETHERTYPE because of it as well. Signed-off-by: Andrew Rybchenko Acked-by: Ajit Khaparde Acked-by: Haiyue Wang --- v2: - cleanup testpmd user guide - cleanup i40e documentation (please, review carefully) app/test-pmd/cmdline.c | 115 -------------- doc/guides/nics/i40e.rst | 4 +- doc/guides/rel_notes/deprecation.rst | 2 +- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 32 ---- drivers/net/bnxt/bnxt_ethdev.c | 157 -------------------- drivers/net/e1000/igb_ethdev.c | 85 ----------- drivers/net/hinic/hinic_pmd_ethdev.h | 1 + drivers/net/i40e/i40e_ethdev.c | 45 ------ drivers/net/ixgbe/ixgbe_ethdev.c | 85 ----------- drivers/net/qede/qede_filter.c | 1 - drivers/net/sfc/sfc_ethdev.c | 3 - lib/librte_ethdev/rte_eth_ctrl.h | 19 --- lib/librte_ethdev/rte_ethdev_driver.h | 23 +++ 13 files changed, 27 insertions(+), 545 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 2d7e8bf53c..cae2444fde 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -976,11 +976,6 @@ static void cmd_help_long_parsed(void *parsed_result, "filters:\n" "--------\n\n" - "ethertype_filter (port_id) (add|del)" - " (mac_addr|mac_ignr) (mac_address) ethertype" - " (ether_type) (drop|fwd) queue (queue_id)\n" - " Add/Del an ethertype filter.\n\n" - "2tuple_filter (port_id) (add|del)" " dst_port (dst_port_value) protocol (protocol_value)" " mask (mask_value) tcp_flags (tcp_flags_value)" @@ -11069,115 +11064,6 @@ cmdline_parse_inst_t cmd_flex_filter = { /* *** Filters Control *** */ -/* *** deal with ethertype filter *** */ -struct cmd_ethertype_filter_result { - cmdline_fixed_string_t filter; - portid_t port_id; - cmdline_fixed_string_t ops; - cmdline_fixed_string_t mac; - struct rte_ether_addr mac_addr; - cmdline_fixed_string_t ethertype; - uint16_t ethertype_value; - cmdline_fixed_string_t drop; - cmdline_fixed_string_t queue; - uint16_t queue_id; -}; - -cmdline_parse_token_string_t cmd_ethertype_filter_filter = - TOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result, - filter, "ethertype_filter"); -cmdline_parse_token_num_t cmd_ethertype_filter_port_id = - TOKEN_NUM_INITIALIZER(struct cmd_ethertype_filter_result, - port_id, UINT16); -cmdline_parse_token_string_t cmd_ethertype_filter_ops = - TOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result, - ops, "add#del"); -cmdline_parse_token_string_t cmd_ethertype_filter_mac = - TOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result, - mac, "mac_addr#mac_ignr"); -cmdline_parse_token_etheraddr_t cmd_ethertype_filter_mac_addr = - TOKEN_ETHERADDR_INITIALIZER(struct cmd_ethertype_filter_result, - mac_addr); -cmdline_parse_token_string_t cmd_ethertype_filter_ethertype = - TOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result, - ethertype, "ethertype"); -cmdline_parse_token_num_t cmd_ethertype_filter_ethertype_value = - TOKEN_NUM_INITIALIZER(struct cmd_ethertype_filter_result, - ethertype_value, UINT16); -cmdline_parse_token_string_t cmd_ethertype_filter_drop = - TOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result, - drop, "drop#fwd"); -cmdline_parse_token_string_t cmd_ethertype_filter_queue = - TOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result, - queue, "queue"); -cmdline_parse_token_num_t cmd_ethertype_filter_queue_id = - TOKEN_NUM_INITIALIZER(struct cmd_ethertype_filter_result, - queue_id, UINT16); - -static void -cmd_ethertype_filter_parsed(void *parsed_result, - __rte_unused struct cmdline *cl, - __rte_unused void *data) -{ - struct cmd_ethertype_filter_result *res = parsed_result; - struct rte_eth_ethertype_filter filter; - int ret = 0; - - ret = rte_eth_dev_filter_supported(res->port_id, - RTE_ETH_FILTER_ETHERTYPE); - if (ret < 0) { - printf("ethertype filter is not supported on port %u.\n", - res->port_id); - return; - } - - memset(&filter, 0, sizeof(filter)); - if (!strcmp(res->mac, "mac_addr")) { - filter.flags |= RTE_ETHTYPE_FLAGS_MAC; - rte_memcpy(&filter.mac_addr, &res->mac_addr, - sizeof(struct rte_ether_addr)); - } - if (!strcmp(res->drop, "drop")) - filter.flags |= RTE_ETHTYPE_FLAGS_DROP; - filter.ether_type = res->ethertype_value; - filter.queue = res->queue_id; - - if (!strcmp(res->ops, "add")) - ret = rte_eth_dev_filter_ctrl(res->port_id, - RTE_ETH_FILTER_ETHERTYPE, - RTE_ETH_FILTER_ADD, - &filter); - else - ret = rte_eth_dev_filter_ctrl(res->port_id, - RTE_ETH_FILTER_ETHERTYPE, - RTE_ETH_FILTER_DELETE, - &filter); - if (ret < 0) - printf("ethertype filter programming error: (%s)\n", - strerror(-ret)); -} - -cmdline_parse_inst_t cmd_ethertype_filter = { - .f = cmd_ethertype_filter_parsed, - .data = NULL, - .help_str = "ethertype_filter add|del mac_addr|mac_ignr " - " ethertype drop|fw queue : " - "Add or delete an ethertype filter entry", - .tokens = { - (void *)&cmd_ethertype_filter_filter, - (void *)&cmd_ethertype_filter_port_id, - (void *)&cmd_ethertype_filter_ops, - (void *)&cmd_ethertype_filter_mac, - (void *)&cmd_ethertype_filter_mac_addr, - (void *)&cmd_ethertype_filter_ethertype, - (void *)&cmd_ethertype_filter_ethertype_value, - (void *)&cmd_ethertype_filter_drop, - (void *)&cmd_ethertype_filter_queue, - (void *)&cmd_ethertype_filter_queue_id, - NULL, - }, -}; - /* *** deal with flow director filter *** */ struct cmd_flow_director_result { cmdline_fixed_string_t flow_director_filter; @@ -19944,7 +19830,6 @@ cmdline_parse_ctx_t main_ctx[] = { (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_ethertype_filter, (cmdline_parse_inst_t *)&cmd_syn_filter, (cmdline_parse_inst_t *)&cmd_2tuple_filter, (cmdline_parse_inst_t *)&cmd_5tuple_filter, diff --git a/doc/guides/nics/i40e.rst b/doc/guides/nics/i40e.rst index a0b81e6695..9e96a0ea13 100644 --- a/doc/guides/nics/i40e.rst +++ b/doc/guides/nics/i40e.rst @@ -635,8 +635,8 @@ L2 Payload flow type in flow director cannot be used to classify MPLS packet as with previous firmware versions. Meanwhile, the Ethertype filter can be used to classify MPLS packet by using a command in testpmd like: - testpmd> ethertype_filter 0 add mac_ignr 00:00:00:00:00:00 ethertype \ - 0x8847 fwd queue + testpmd> flow create 0 ingress pattern eth type is 0x8847 / end \ + actions queue index / end 16 Byte RX Descriptor setting on DPDK VF ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index cdb1945c91..209223a501 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -97,7 +97,7 @@ Deprecation Notices * ethdev: the legacy filter API, including ``rte_eth_dev_filter_supported()``, ``rte_eth_dev_filter_ctrl()`` as well - as filter types ETHERTYPE, FLEXIBLE, SYN, NTUPLE, TUNNEL, FDIR, + as filter types FLEXIBLE, 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/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 28fc8cca89..cb19b50a8f 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3276,38 +3276,6 @@ This section details the available filter functions that are available. Note these functions interface the deprecated legacy filtering framework, superseded by *rte_flow*. See `Flow rules management`_. -ethertype_filter -~~~~~~~~~~~~~~~~~~~~ - -Add or delete a L2 Ethertype filter, which identify packets by their L2 Ethertype mainly assign them to a receive queue:: - - ethertype_filter (port_id) (add|del) (mac_addr|mac_ignr) (mac_address) \ - ethertype (ether_type) (drop|fwd) queue (queue_id) - -The available information parameters are: - -* ``port_id``: The port which the Ethertype filter assigned on. - -* ``mac_addr``: Compare destination mac address. - -* ``mac_ignr``: Ignore destination mac address match. - -* ``mac_address``: Destination mac address to match. - -* ``ether_type``: The EtherType value want to match, - for example 0x0806 for ARP packet. 0x0800 (IPv4) and 0x86DD (IPv6) are invalid. - -* ``queue_id``: The receive queue associated with this EtherType filter. - It is meaningless when deleting or dropping. - -Example, to add/remove an ethertype filter rule:: - - testpmd> ethertype_filter 0 add mac_ignr 00:11:22:33:44:55 \ - ethertype 0x0806 fwd queue 3 - - testpmd> ethertype_filter 0 del mac_ignr 00:11:22:33:44:55 \ - ethertype 0x0806 fwd queue 3 - 2tuple_filter ~~~~~~~~~~~~~~~~~ diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 32318cfd00..ec43f1cfde 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -2990,160 +2990,6 @@ bnxt_tx_descriptor_status_op(void *tx_queue, uint16_t offset) return RTE_ETH_TX_DESC_FULL; } -static struct bnxt_filter_info * -bnxt_match_and_validate_ether_filter(struct bnxt *bp, - struct rte_eth_ethertype_filter *efilter, - struct bnxt_vnic_info *vnic0, - struct bnxt_vnic_info *vnic, - int *ret) -{ - struct bnxt_filter_info *mfilter = NULL; - int match = 0; - *ret = 0; - - if (efilter->ether_type == RTE_ETHER_TYPE_IPV4 || - efilter->ether_type == RTE_ETHER_TYPE_IPV6) { - PMD_DRV_LOG(ERR, "invalid ether_type(0x%04x) in" - " ethertype filter.", efilter->ether_type); - *ret = -EINVAL; - goto exit; - } - if (efilter->queue >= bp->rx_nr_rings) { - PMD_DRV_LOG(ERR, "Invalid queue %d\n", efilter->queue); - *ret = -EINVAL; - goto exit; - } - - vnic0 = BNXT_GET_DEFAULT_VNIC(bp); - vnic = &bp->vnic_info[efilter->queue]; - if (vnic == NULL) { - PMD_DRV_LOG(ERR, "Invalid queue %d\n", efilter->queue); - *ret = -EINVAL; - goto exit; - } - - if (efilter->flags & RTE_ETHTYPE_FLAGS_DROP) { - STAILQ_FOREACH(mfilter, &vnic0->filter, next) { - if ((!memcmp(efilter->mac_addr.addr_bytes, - mfilter->l2_addr, RTE_ETHER_ADDR_LEN) && - mfilter->flags == - HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_FLAGS_DROP && - mfilter->ethertype == efilter->ether_type)) { - match = 1; - break; - } - } - } else { - STAILQ_FOREACH(mfilter, &vnic->filter, next) - if ((!memcmp(efilter->mac_addr.addr_bytes, - mfilter->l2_addr, RTE_ETHER_ADDR_LEN) && - mfilter->ethertype == efilter->ether_type && - mfilter->flags == - HWRM_CFA_L2_FILTER_CFG_INPUT_FLAGS_PATH_RX)) { - match = 1; - break; - } - } - - if (match) - *ret = -EEXIST; - -exit: - return mfilter; -} - -static int -bnxt_ethertype_filter(struct rte_eth_dev *dev, - enum rte_filter_op filter_op, - void *arg) -{ - struct bnxt *bp = dev->data->dev_private; - struct rte_eth_ethertype_filter *efilter = - (struct rte_eth_ethertype_filter *)arg; - struct bnxt_filter_info *bfilter, *filter1; - struct bnxt_vnic_info *vnic, *vnic0; - int ret; - - 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; - } - - vnic0 = BNXT_GET_DEFAULT_VNIC(bp); - vnic = &bp->vnic_info[efilter->queue]; - - switch (filter_op) { - case RTE_ETH_FILTER_ADD: - bnxt_match_and_validate_ether_filter(bp, efilter, - vnic0, vnic, &ret); - if (ret < 0) - return ret; - - bfilter = bnxt_get_unused_filter(bp); - if (bfilter == NULL) { - PMD_DRV_LOG(ERR, - "Not enough resources for a new filter.\n"); - return -ENOMEM; - } - bfilter->filter_type = HWRM_CFA_NTUPLE_FILTER; - memcpy(bfilter->l2_addr, efilter->mac_addr.addr_bytes, - RTE_ETHER_ADDR_LEN); - memcpy(bfilter->dst_macaddr, efilter->mac_addr.addr_bytes, - RTE_ETHER_ADDR_LEN); - bfilter->enables |= NTUPLE_FLTR_ALLOC_INPUT_EN_DST_MACADDR; - bfilter->ethertype = efilter->ether_type; - bfilter->enables |= NTUPLE_FLTR_ALLOC_INPUT_EN_ETHERTYPE; - - filter1 = bnxt_get_l2_filter(bp, bfilter, vnic0); - if (filter1 == NULL) { - ret = -EINVAL; - goto cleanup; - } - bfilter->enables |= - HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_L2_FILTER_ID; - bfilter->fw_l2_filter_id = filter1->fw_l2_filter_id; - - bfilter->dst_id = vnic->fw_vnic_id; - - if (efilter->flags & RTE_ETHTYPE_FLAGS_DROP) { - bfilter->flags = - HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_FLAGS_DROP; - } - - ret = bnxt_hwrm_set_ntuple_filter(bp, bfilter->dst_id, bfilter); - if (ret) - goto cleanup; - STAILQ_INSERT_TAIL(&vnic->filter, bfilter, next); - break; - case RTE_ETH_FILTER_DELETE: - filter1 = bnxt_match_and_validate_ether_filter(bp, efilter, - vnic0, vnic, &ret); - if (ret == -EEXIST) { - ret = bnxt_hwrm_clear_ntuple_filter(bp, filter1); - - STAILQ_REMOVE(&vnic->filter, filter1, bnxt_filter_info, - next); - bnxt_free_filter(bp, filter1); - } else if (ret == 0) { - PMD_DRV_LOG(ERR, "No matching filter found\n"); - } - break; - default: - PMD_DRV_LOG(ERR, "unsupported operation %u.", filter_op); - ret = -EINVAL; - goto error; - } - return ret; -cleanup: - bnxt_free_filter(bp, bfilter); -error: - return ret; -} - static inline int parse_ntuple_filter(struct bnxt *bp, struct rte_eth_ntuple_filter *nfilter, @@ -3818,9 +3664,6 @@ bnxt_filter_ctrl_op(struct rte_eth_dev *dev, case RTE_ETH_FILTER_NTUPLE: ret = bnxt_ntuple_filter(dev, filter_op, arg); break; - case RTE_ETH_FILTER_ETHERTYPE: - ret = bnxt_ethertype_filter(dev, filter_op, arg); - break; case RTE_ETH_FILTER_GENERIC: if (filter_op != RTE_ETH_FILTER_GET) return -EINVAL; diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index ac4b8f1123..8b18f1cb28 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -209,11 +209,6 @@ static int igb_get_ntuple_filter(struct rte_eth_dev *dev, static int igb_ntuple_filter_handle(struct rte_eth_dev *dev, enum rte_filter_op filter_op, void *arg); -static int igb_ethertype_filter_handle(struct rte_eth_dev *dev, - enum rte_filter_op filter_op, - void *arg); -static int igb_get_ethertype_filter(struct rte_eth_dev *dev, - struct rte_eth_ethertype_filter *filter); static int eth_igb_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type, enum rte_filter_op filter_op, @@ -4842,83 +4837,6 @@ igb_add_del_ethertype_filter(struct rte_eth_dev *dev, return 0; } -static int -igb_get_ethertype_filter(struct rte_eth_dev *dev, - struct rte_eth_ethertype_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); - uint32_t etqf; - int ret; - - ret = igb_ethertype_filter_lookup(filter_info, filter->ether_type); - if (ret < 0) { - PMD_DRV_LOG(ERR, "ethertype (0x%04x) filter doesn't exist.", - filter->ether_type); - return -ENOENT; - } - - etqf = E1000_READ_REG(hw, E1000_ETQF(ret)); - if (etqf & E1000_ETQF_FILTER_ENABLE) { - filter->ether_type = etqf & E1000_ETQF_ETHERTYPE; - filter->flags = 0; - filter->queue = (etqf & E1000_ETQF_QUEUE) >> - E1000_ETQF_QUEUE_SHIFT; - return 0; - } - - return -ENOENT; -} - -/* - * igb_ethertype_filter_handle - Handle operations for ethertype filter. - * @dev: pointer to rte_eth_dev structure - * @filter_op:operation will be taken. - * @arg: a pointer to specific structure corresponding to the filter_op - */ -static int -igb_ethertype_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 = igb_add_del_ethertype_filter(dev, - (struct rte_eth_ethertype_filter *)arg, - TRUE); - break; - case RTE_ETH_FILTER_DELETE: - ret = igb_add_del_ethertype_filter(dev, - (struct rte_eth_ethertype_filter *)arg, - FALSE); - break; - case RTE_ETH_FILTER_GET: - ret = igb_get_ethertype_filter(dev, - (struct rte_eth_ethertype_filter *)arg); - break; - default: - PMD_DRV_LOG(ERR, "unsupported operation %u.", filter_op); - ret = -EINVAL; - break; - } - return ret; -} - static int eth_igb_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type, @@ -4931,9 +4849,6 @@ eth_igb_filter_ctrl(struct rte_eth_dev *dev, case RTE_ETH_FILTER_NTUPLE: ret = igb_ntuple_filter_handle(dev, filter_op, arg); break; - 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; diff --git a/drivers/net/hinic/hinic_pmd_ethdev.h b/drivers/net/hinic/hinic_pmd_ethdev.h index 3f2d51d752..c7338d83be 100644 --- a/drivers/net/hinic/hinic_pmd_ethdev.h +++ b/drivers/net/hinic/hinic_pmd_ethdev.h @@ -7,6 +7,7 @@ #include #include +#include #include "base/hinic_compat.h" #include "base/hinic_pmd_cfg.h" diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index e298d7aee6..aa87ad8dd5 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -319,9 +319,6 @@ static int i40e_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, static int i40e_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, struct rte_eth_udp_tunnel *udp_tunnel); static void i40e_filter_input_set_init(struct i40e_pf *pf); -static int i40e_ethertype_filter_handle(struct rte_eth_dev *dev, - enum rte_filter_op filter_op, - void *arg); static int i40e_dev_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type, enum rte_filter_op filter_op, @@ -10449,45 +10446,6 @@ i40e_ethertype_filter_set(struct i40e_pf *pf, return ret; } -/* - * Handle operations for ethertype filter. - */ -static int -i40e_ethertype_filter_handle(struct rte_eth_dev *dev, - enum rte_filter_op filter_op, - void *arg) -{ - struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); - int ret = 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 = i40e_ethertype_filter_set(pf, - (struct rte_eth_ethertype_filter *)arg, - TRUE); - break; - case RTE_ETH_FILTER_DELETE: - ret = i40e_ethertype_filter_set(pf, - (struct rte_eth_ethertype_filter *)arg, - FALSE); - break; - default: - PMD_DRV_LOG(ERR, "unsupported operation %u", filter_op); - ret = -ENOSYS; - break; - } - return ret; -} - static int i40e_dev_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type, @@ -10507,9 +10465,6 @@ i40e_dev_filter_ctrl(struct rte_eth_dev *dev, case RTE_ETH_FILTER_HASH: ret = i40e_hash_filter_ctrl(dev, filter_op, arg); break; - case RTE_ETH_FILTER_ETHERTYPE: - ret = i40e_ethertype_filter_handle(dev, filter_op, arg); - break; case RTE_ETH_FILTER_TUNNEL: ret = i40e_tunnel_filter_handle(dev, filter_op, arg); break; diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 00101c2eec..69222ccd2d 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -314,11 +314,6 @@ static int ixgbe_ntuple_filter_handle(struct rte_eth_dev *dev, void *arg); static int ixgbe_get_ntuple_filter(struct rte_eth_dev *dev, struct rte_eth_ntuple_filter *filter); -static int ixgbe_ethertype_filter_handle(struct rte_eth_dev *dev, - enum rte_filter_op filter_op, - void *arg); -static int ixgbe_get_ethertype_filter(struct rte_eth_dev *dev, - struct rte_eth_ethertype_filter *filter); static int ixgbe_dev_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type, enum rte_filter_op filter_op, @@ -6967,83 +6962,6 @@ ixgbe_add_del_ethertype_filter(struct rte_eth_dev *dev, return 0; } -static int -ixgbe_get_ethertype_filter(struct rte_eth_dev *dev, - struct rte_eth_ethertype_filter *filter) -{ - struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct ixgbe_filter_info *filter_info = - IXGBE_DEV_PRIVATE_TO_FILTER_INFO(dev->data->dev_private); - uint32_t etqf, etqs; - int ret; - - ret = ixgbe_ethertype_filter_lookup(filter_info, filter->ether_type); - if (ret < 0) { - PMD_DRV_LOG(ERR, "ethertype (0x%04x) filter doesn't exist.", - filter->ether_type); - return -ENOENT; - } - - etqf = IXGBE_READ_REG(hw, IXGBE_ETQF(ret)); - if (etqf & IXGBE_ETQF_FILTER_EN) { - etqs = IXGBE_READ_REG(hw, IXGBE_ETQS(ret)); - filter->ether_type = etqf & IXGBE_ETQF_ETHERTYPE; - filter->flags = 0; - filter->queue = (etqs & IXGBE_ETQS_RX_QUEUE) >> - IXGBE_ETQS_RX_QUEUE_SHIFT; - return 0; - } - return -ENOENT; -} - -/* - * ixgbe_ethertype_filter_handle - Handle operations for ethertype filter. - * @dev: pointer to rte_eth_dev structure - * @filter_op:operation will be taken. - * @arg: a pointer to specific structure corresponding to the filter_op - */ -static int -ixgbe_ethertype_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_add_del_ethertype_filter(dev, - (struct rte_eth_ethertype_filter *)arg, - TRUE); - break; - case RTE_ETH_FILTER_DELETE: - ret = ixgbe_add_del_ethertype_filter(dev, - (struct rte_eth_ethertype_filter *)arg, - FALSE); - break; - case RTE_ETH_FILTER_GET: - ret = ixgbe_get_ethertype_filter(dev, - (struct rte_eth_ethertype_filter *)arg); - break; - default: - PMD_DRV_LOG(ERR, "unsupported operation %u.", filter_op); - ret = -EINVAL; - break; - } - return ret; -} - static int ixgbe_dev_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type, @@ -7056,9 +6974,6 @@ ixgbe_dev_filter_ctrl(struct rte_eth_dev *dev, case RTE_ETH_FILTER_NTUPLE: ret = ixgbe_ntuple_filter_handle(dev, filter_op, arg); break; - 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; diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c index 2e1646fe89..4d31db09fd 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_ETHERTYPE: case RTE_ETH_FILTER_FLEXIBLE: case RTE_ETH_FILTER_SYN: case RTE_ETH_FILTER_HASH: diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index a0059a8975..b9ed075c64 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -1755,9 +1755,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_ETHERTYPE: - sfc_err(sa, "EtherType filters not supported"); - break; case RTE_ETH_FILTER_FLEXIBLE: sfc_err(sa, "Flexible filters not supported"); break; diff --git a/lib/librte_ethdev/rte_eth_ctrl.h b/lib/librte_ethdev/rte_eth_ctrl.h index a3d49e0913..5690f8111a 100644 --- a/lib/librte_ethdev/rte_eth_ctrl.h +++ b/lib/librte_ethdev/rte_eth_ctrl.h @@ -56,25 +56,6 @@ enum rte_filter_op { RTE_ETH_FILTER_OP_MAX }; -/** - * Define all structures for Ethertype Filter type. - */ - -#define RTE_ETHTYPE_FLAGS_MAC 0x0001 /**< If set, compare mac */ -#define RTE_ETHTYPE_FLAGS_DROP 0x0002 /**< If set, drop packet when match */ - -/** - * A structure used to define the ethertype filter entry - * to support RTE_ETH_FILTER_ETHERTYPE with RTE_ETH_FILTER_ADD, - * RTE_ETH_FILTER_DELETE and RTE_ETH_FILTER_GET operations. - */ -struct rte_eth_ethertype_filter { - struct rte_ether_addr mac_addr; /**< Mac address to match. */ - uint16_t ether_type; /**< Ether type to match */ - uint16_t flags; /**< Flags from RTE_ETHTYPE_FLAGS_* */ - uint16_t queue; /**< Queue assigned to when match*/ -}; - #define RTE_FLEX_FILTER_MAXLEN 128 /**< bytes to use in flex filter. */ #define RTE_FLEX_FILTER_MASK_SIZE \ (RTE_ALIGN(RTE_FLEX_FILTER_MAXLEN, CHAR_BIT) / CHAR_BIT) diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h index c63b9f7eb7..67a83dacc7 100644 --- a/lib/librte_ethdev/rte_ethdev_driver.h +++ b/lib/librte_ethdev/rte_ethdev_driver.h @@ -1342,6 +1342,29 @@ int rte_eth_hairpin_queue_peer_unbind(uint16_t cur_port, uint16_t cur_queue, uint32_t direction); + +/* + * Legacy ethdev API used internally by drivers. + */ + +/** + * Define all structures for Ethertype Filter type. + */ + +#define RTE_ETHTYPE_FLAGS_MAC 0x0001 /**< If set, compare mac */ +#define RTE_ETHTYPE_FLAGS_DROP 0x0002 /**< If set, drop packet when match */ + +/** + * A structure used to define the ethertype filter entry + * to support RTE_ETH_FILTER_ETHERTYPE data representation. + */ +struct rte_eth_ethertype_filter { + struct rte_ether_addr mac_addr; /**< Mac address to match. */ + uint16_t ether_type; /**< Ether type to match */ + uint16_t flags; /**< Flags from RTE_ETHTYPE_FLAGS_* */ + uint16_t queue; /**< Queue assigned to when match*/ +}; + #ifdef __cplusplus } #endif -- 2.17.1