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 A825AA04B0; Mon, 19 Oct 2020 00:13:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 34528BA98; Mon, 19 Oct 2020 00:13:48 +0200 (CEST) Received: from mail-ot1-f65.google.com (mail-ot1-f65.google.com [209.85.210.65]) by dpdk.org (Postfix) with ESMTP id 6C99DBA96 for ; Mon, 19 Oct 2020 00:13:46 +0200 (CEST) Received: by mail-ot1-f65.google.com with SMTP id f37so8634621otf.12 for ; Sun, 18 Oct 2020 15:13:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=swHSjlKxH9SazgS3qCWLUpFIkiDI+5W028vFiilaEtI=; b=Wl6WUOZrEdEY41uxVtH1SLxbYWpSTogEmL0MA6lZmMh1+cTCLNR7gG522CPFISeKwL FxFjpJ/FPjFFlkW9sHe4X6lXzRQfYsfi14xk8B2lUqf1W2QVhQPSCLa924FzoBGCr/M3 H9thDGpHrtgnENiDrk47PhTKEiNaYvlmdxNVc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=swHSjlKxH9SazgS3qCWLUpFIkiDI+5W028vFiilaEtI=; b=kmvSHtlBfEPPZn4g7LbrpMyjCQkd3i71/1aHIW6sUVsIdjPMpQFrr92RVu6oDgD9L3 m9y35kn+R8GO384xeaR5BlII9HwMVmvZ1RLc+B+/BHC7igGBN6/YalFC1EahbOTgqL/B QClm9HUuCpV7ttQpJ/cHHdic3H5c1IXKYd4Yh7ZZAjxLUXBjaEmxInTRIxM//k2XpOBe RvyzF3miH9MH/T0KBFYUMPZ0aepusTjfwQP28LeDsUCdX1i0VRMZ7GozQ6mqSC9eeaxS /OOXNq54qF6mKMlyGklzXWXmfTRdWp4R1ox8SC/pPuzE4QIdse+Q6ioS4jYAYdjNcIb2 G29w== X-Gm-Message-State: AOAM531kbfYd64i8qMJmlkRgYJTtQlA/ORoUMXhxKQ5heNKYmkOD39xR kINQdVuxIwZt7JtHQe/p0H2OVC6lm72HFnox73J8mw== X-Google-Smtp-Source: ABdhPJxLPRr9WQWj90Zg59fUnIKyQoaxgzrRxaqE8rpNZQLMkqOE0npEw8bkxH1ap9Ye4aQ8ic2YT8XRK3RlvUDEUKs= X-Received: by 2002:a9d:6acc:: with SMTP id m12mr9309052otq.95.1603059224220; Sun, 18 Oct 2020 15:13:44 -0700 (PDT) MIME-Version: 1.0 References: <1603030152-13451-1-git-send-email-arybchenko@solarflare.com> <1603030152-13451-4-git-send-email-arybchenko@solarflare.com> In-Reply-To: <1603030152-13451-4-git-send-email-arybchenko@solarflare.com> From: Ajit Khaparde Date: Sun, 18 Oct 2020 15:13:28 -0700 Message-ID: To: Andrew Rybchenko Cc: Wenzhuo Lu , Beilei Xing , Bernard Iremonger , Ray Kinsella , Neil Horman , Somnath Kotur , Jeff Guo , Haiyue Wang , Ziyang Xuan , Xiaoyun Wang , Guoyang Zhou , Rasesh Mody , Shahed Shaikh , Andrew Rybchenko , Thomas Monjalon , Ferruh Yigit , dpdk-dev Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH 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" On Sun, Oct 18, 2020 at 7:09 AM Andrew Rybchenko wrote: > > RTE flow API should be used for filtering. > > 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 For bnxt PMD Acked-by: Ajit Khaparde > --- > app/test-pmd/cmdline.c | 115 ------------------- > doc/guides/rel_notes/deprecation.rst | 2 +- > 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 ++++ > 11 files changed, 25 insertions(+), 511 deletions(-) > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c > index bb0be8cf42..f0fe97fb9c 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/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst > index 223ff7661f..f655fc06ac 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 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/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c > index 6c1236953a..12bc3288e5 100644 > --- a/drivers/net/bnxt/bnxt_ethdev.c > +++ b/drivers/net/bnxt/bnxt_ethdev.c > @@ -2987,160 +2987,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, > @@ -3815,9 +3661,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 14a254ab74..28a088a71b 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 1abf05a80c..75f3a2f3d3 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_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 >