[03/14] ethdev: remove legacy EtherType filter type support

Message ID 1603030152-13451-4-git-send-email-arybchenko@solarflare.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series ethdev: remove legacy filter API |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Andrew Rybchenko Oct. 18, 2020, 2:09 p.m. UTC
  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 <arybchenko@solarflare.com>
---
 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(-)
  

Comments

Ajit Khaparde Oct. 18, 2020, 10:13 p.m. UTC | #1
On Sun, Oct 18, 2020 at 7:09 AM Andrew Rybchenko
<arybchenko@solarflare.com> 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 <arybchenko@solarflare.com>
For bnxt PMD

Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

> ---
>  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 <port_id> add|del mac_addr|mac_ignr "
> -               "<mac_addr> ethertype <value> drop|fw queue <queue_id>: "
> -               "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 <rte_ethdev.h>
>  #include <rte_ethdev_core.h>
> +#include <rte_ethdev_driver.h>
>
>  #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
>
  
Wang, Haiyue Oct. 19, 2020, 6:40 a.m. UTC | #2
> -----Original Message-----
> From: Andrew Rybchenko <arybchenko@solarflare.com>
> Sent: Sunday, October 18, 2020 22:09
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Iremonger, Bernard
> <bernard.iremonger@intel.com>; Ray Kinsella <mdr@ashroe.eu>; Neil Horman <nhorman@tuxdriver.com>; Ajit
> Khaparde <ajit.khaparde@broadcom.com>; Somnath Kotur <somnath.kotur@broadcom.com>; Guo, Jia
> <jia.guo@intel.com>; Wang, Haiyue <haiyue.wang@intel.com>; Ziyang Xuan <xuanziyang2@huawei.com>;
> Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>; Guoyang Zhou <zhouguoyang@huawei.com>; Rasesh Mody
> <rmody@marvell.com>; Shahed Shaikh <shshaikh@marvell.com>; Andrew Rybchenko
> <andrew.rybchenko@oktetlabs.ru>; Thomas Monjalon <thomas@monjalon.net>; Yigit, Ferruh
> <ferruh.yigit@intel.com>
> Cc: dev@dpdk.org
> Subject: [PATCH 03/14] ethdev: remove legacy EtherType filter type support
> 
> 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 <arybchenko@solarflare.com>
> ---
>  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(-)
> 

For e1000, ixgbe PMDs

Acked-by: Haiyue Wang <haiyue.wang@intel.com>

> 2.17.1
  
Guo, Jia Oct. 21, 2020, 5:38 a.m. UTC | #3
> -----Original Message-----
> From: Andrew Rybchenko <arybchenko@solarflare.com>
> Sent: Sunday, October 18, 2020 10:09 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>; Iremonger, Bernard
> <bernard.iremonger@intel.com>; Ray Kinsella <mdr@ashroe.eu>; Neil
> Horman <nhorman@tuxdriver.com>; Ajit Khaparde
> <ajit.khaparde@broadcom.com>; Somnath Kotur
> <somnath.kotur@broadcom.com>; Guo, Jia <jia.guo@intel.com>; Wang,
> Haiyue <haiyue.wang@intel.com>; Ziyang Xuan
> <xuanziyang2@huawei.com>; Xiaoyun Wang
> <cloud.wangxiaoyun@huawei.com>; Guoyang Zhou
> <zhouguoyang@huawei.com>; Rasesh Mody <rmody@marvell.com>;
> Shahed Shaikh <shshaikh@marvell.com>; Andrew Rybchenko
> <andrew.rybchenko@oktetlabs.ru>; Thomas Monjalon
> <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>
> Cc: dev@dpdk.org
> Subject: [PATCH 03/14] ethdev: remove legacy EtherType filter type support
> 
> 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 <arybchenko@solarflare.com>
> ---
>  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(-)
> 

<...>

>  #define RTE_FLEX_FILTER_MAXLEN128/**< 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);
> 
> +
> +/*

s/*/**

> + * Legacy ethdev API used internally by drivers.
> + */
> +

I am not sure if this doc is need?

> +/**
> + * 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
>
  
Andrew Rybchenko Oct. 21, 2020, 4:12 p.m. UTC | #4
On 10/21/20 8:38 AM, Guo, Jia wrote:
> 
>> -----Original Message-----
>> From: Andrew Rybchenko <arybchenko@solarflare.com>
>> Sent: Sunday, October 18, 2020 10:09 PM
>> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Xing, Beilei
>> <beilei.xing@intel.com>; Iremonger, Bernard
>> <bernard.iremonger@intel.com>; Ray Kinsella <mdr@ashroe.eu>; Neil
>> Horman <nhorman@tuxdriver.com>; Ajit Khaparde
>> <ajit.khaparde@broadcom.com>; Somnath Kotur
>> <somnath.kotur@broadcom.com>; Guo, Jia <jia.guo@intel.com>; Wang,
>> Haiyue <haiyue.wang@intel.com>; Ziyang Xuan
>> <xuanziyang2@huawei.com>; Xiaoyun Wang
>> <cloud.wangxiaoyun@huawei.com>; Guoyang Zhou
>> <zhouguoyang@huawei.com>; Rasesh Mody <rmody@marvell.com>;
>> Shahed Shaikh <shshaikh@marvell.com>; Andrew Rybchenko
>> <andrew.rybchenko@oktetlabs.ru>; Thomas Monjalon
>> <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>
>> Cc: dev@dpdk.org
>> Subject: [PATCH 03/14] ethdev: remove legacy EtherType filter type support
>>
>> 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 <arybchenko@solarflare.com>
>> ---
>>   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(-)
>>
> 
> <...>
> 
>>   #define RTE_FLEX_FILTER_MAXLEN128/**< 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);
>>
>> +
>> +/*
> 
> s/*/**

No, it is not going to be a comment picked up by doxygen.
Otherwise it requires @group mark up etc which is not used in DPDK
as far as I know.

>> + * Legacy ethdev API used internally by drivers.
>> + */
>> +
> 
> I am not sure if this doc is need?

I think it is required to highlight that it is legacy and should
not be used by new 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
>>
>
  

Patch

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 <port_id> add|del mac_addr|mac_ignr "
-		"<mac_addr> ethertype <value> drop|fw queue <queue_id>: "
-		"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 <rte_ethdev.h>
 #include <rte_ethdev_core.h>
+#include <rte_ethdev_driver.h>
 
 #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