From patchwork Thu Oct 22 10:06:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 81783 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D7AB2A04DD; Thu, 22 Oct 2020 12:07:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 14FBCA9C4; Thu, 22 Oct 2020 12:06:47 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id 14EB4A9A1 for ; Thu, 22 Oct 2020 12:06:37 +0200 (CEST) Received: from mx1-us1.ppe-hosted.com (unknown [10.110.50.137]) by dispatch1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id A2D8120061; Thu, 22 Oct 2020 10:06:35 +0000 (UTC) Received: from us4-mdac16-63.at1.mdlocal (unknown [10.110.50.156]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id A1A676009B; Thu, 22 Oct 2020 10:06:35 +0000 (UTC) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us1.ppe-hosted.com (unknown [10.110.49.32]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 2514B220064; Thu, 22 Oct 2020 10:06:35 +0000 (UTC) Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id E186E280064; Thu, 22 Oct 2020 10:06:34 +0000 (UTC) Received: from ukex01.SolarFlarecom.com (10.17.10.4) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 22 Oct 2020 11:06:30 +0100 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 22 Oct 2020 11:06:30 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id 09MA6Uw8016255; Thu, 22 Oct 2020 11:06:30 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 9C64F1613A9; Thu, 22 Oct 2020 11:06:30 +0100 (BST) From: Andrew Rybchenko To: Jeff Guo , Haiyue Wang , "Thomas Monjalon" , Ferruh Yigit , Andrew Rybchenko CC: Date: Thu, 22 Oct 2020 11:06:20 +0100 Message-ID: <1603361181-21556-4-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1603361181-21556-1-git-send-email-arybchenko@solarflare.com> References: <1603361181-21556-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.6.1012-25740.003 X-TM-AS-Result: No-1.732800-8.000000-10 X-TMASE-MatchedRID: rfk8EwZrOGm/kNGHVZrslklR2DE0NRdaeXZz1at5bOyKsTAa7Oe+YljI 3zmoXKKDIH2zryPqfYNw5T4Iaj538mJZXQNDzktSIAjxomarSPDYuVu0X/rOkBgxf9+T3i9bMFd dv+pLbreyiHjoKzXSzd5KdQvCHJZD5P8SrHH0jQTGL//8mlodAzB4tWHctlhIIYP4Wne9kdSi8Q AEcW7yzPTN0R3MdTGf8RldOeM/YZtY1B7Vsu7x2bixxDRpftwPx+jrF7TzRS0UE18jzz932mXge MJEe5CmDGa/pWDW//LhB5Iilm/06R8TzIzimOwPC24oEZ6SpSlR8RAUGq/SZw6lMloQ7G5h/UqU lKCT/t7MqMlNBsbqQn/bhc6YWDmRUh74nilwu20l7lxpy+ppNnu5mF0Ni82eV2enmgmQuBZhrvp bMU1/eOQDw6tgd3AMZ9iVj/KhX/RSnoQc5vb5zuQdkM7ndBLCO8/z8zQ+NO3AvpLE+mvX8g== X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10-1.732800-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.6.1012-25740.003 X-MDID: 1603361195-9aQq-fQSOWQD X-PPE-DISP: 1603361195;9aQq-fQSOWQD Subject: [dpdk-dev] [PATCH 3/3] ethdev: move L2 tunnel config structure to ixgbe driver 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" net/ixgbe driver is the only user of the struct rte_eth_l2_tunnel_conf. Move it to the driver and use ixgbe_ prefix instead of rte_eth_. Signed-off-by: Andrew Rybchenko Acked-by: Haiyue Wang --- drivers/net/ixgbe/ixgbe_ethdev.c | 12 ++++----- drivers/net/ixgbe/ixgbe_ethdev.h | 16 ++++++++++-- drivers/net/ixgbe/ixgbe_flow.c | 42 ++++++++++++++++---------------- lib/librte_ethdev/rte_eth_ctrl.h | 11 --------- 4 files changed, 41 insertions(+), 40 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 9c91b8cde8..23baa5e9c5 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -7550,7 +7550,7 @@ ixgbe_e_tag_enable(struct ixgbe_hw *hw) static int ixgbe_e_tag_filter_del(struct rte_eth_dev *dev, - struct rte_eth_l2_tunnel_conf *l2_tunnel) + struct ixgbe_l2_tunnel_conf *l2_tunnel) { int ret = 0; struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -7586,7 +7586,7 @@ ixgbe_e_tag_filter_del(struct rte_eth_dev *dev, static int ixgbe_e_tag_filter_add(struct rte_eth_dev *dev, - struct rte_eth_l2_tunnel_conf *l2_tunnel) + struct ixgbe_l2_tunnel_conf *l2_tunnel) { int ret = 0; struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -7690,7 +7690,7 @@ ixgbe_remove_l2_tn_filter(struct ixgbe_l2_tn_info *l2_tn_info, /* Add l2 tunnel filter */ int ixgbe_dev_l2_tunnel_filter_add(struct rte_eth_dev *dev, - struct rte_eth_l2_tunnel_conf *l2_tunnel, + struct ixgbe_l2_tunnel_conf *l2_tunnel, bool restore) { int ret; @@ -7747,7 +7747,7 @@ ixgbe_dev_l2_tunnel_filter_add(struct rte_eth_dev *dev, /* Delete l2 tunnel filter */ int ixgbe_dev_l2_tunnel_filter_del(struct rte_eth_dev *dev, - struct rte_eth_l2_tunnel_conf *l2_tunnel) + struct ixgbe_l2_tunnel_conf *l2_tunnel) { int ret; struct ixgbe_l2_tn_info *l2_tn_info = @@ -8169,7 +8169,7 @@ ixgbe_l2_tn_filter_restore(struct rte_eth_dev *dev) struct ixgbe_l2_tn_info *l2_tn_info = IXGBE_DEV_PRIVATE_TO_L2_TN_INFO(dev->data->dev_private); struct ixgbe_l2_tn_filter *node; - struct rte_eth_l2_tunnel_conf l2_tn_conf; + struct ixgbe_l2_tunnel_conf l2_tn_conf; TAILQ_FOREACH(node, &l2_tn_info->l2_tn_list, entries) { l2_tn_conf.l2_tunnel_type = node->key.l2_tn_type; @@ -8276,7 +8276,7 @@ ixgbe_clear_all_l2_tn_filter(struct rte_eth_dev *dev) struct ixgbe_l2_tn_info *l2_tn_info = IXGBE_DEV_PRIVATE_TO_L2_TN_INFO(dev->data->dev_private); struct ixgbe_l2_tn_filter *l2_tn_filter; - struct rte_eth_l2_tunnel_conf l2_tn_conf; + struct ixgbe_l2_tunnel_conf l2_tn_conf; int ret = 0; while ((l2_tn_filter = TAILQ_FIRST(&l2_tn_info->l2_tn_list))) { diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h index a4f7d184b5..ff0ab78f5d 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/ixgbe/ixgbe_ethdev.h @@ -678,13 +678,25 @@ int ixgbe_add_del_ethertype_filter(struct rte_eth_dev *dev, int ixgbe_syn_filter_set(struct rte_eth_dev *dev, struct rte_eth_syn_filter *filter, bool add); + +/** + * l2 tunnel configuration. + */ +struct ixgbe_l2_tunnel_conf { + enum rte_eth_tunnel_type l2_tunnel_type; + uint16_t ether_type; /* ether type in l2 header */ + uint32_t tunnel_id; /* port tag id for e-tag */ + uint16_t vf_id; /* VF id for tag insertion */ + uint32_t pool; /* destination pool for tag based forwarding */ +}; + int ixgbe_dev_l2_tunnel_filter_add(struct rte_eth_dev *dev, - struct rte_eth_l2_tunnel_conf *l2_tunnel, + struct ixgbe_l2_tunnel_conf *l2_tunnel, bool restore); int ixgbe_dev_l2_tunnel_filter_del(struct rte_eth_dev *dev, - struct rte_eth_l2_tunnel_conf *l2_tunnel); + struct ixgbe_l2_tunnel_conf *l2_tunnel); void ixgbe_filterlist_init(void); void ixgbe_filterlist_flush(void); /* diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c index 6b3dea46ee..dff04c462c 100644 --- a/drivers/net/ixgbe/ixgbe_flow.c +++ b/drivers/net/ixgbe/ixgbe_flow.c @@ -72,7 +72,7 @@ struct ixgbe_fdir_rule_ele { /* l2_tunnel filter list structure */ struct ixgbe_eth_l2_tunnel_conf_ele { TAILQ_ENTRY(ixgbe_eth_l2_tunnel_conf_ele) entries; - struct rte_eth_l2_tunnel_conf filter_info; + struct ixgbe_l2_tunnel_conf filter_info; }; /* rss filter list structure */ struct ixgbe_rss_conf_ele { @@ -1197,7 +1197,7 @@ cons_parse_l2_tn_filter(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], - struct rte_eth_l2_tunnel_conf *filter, + struct ixgbe_l2_tunnel_conf *filter, struct rte_flow_error *error) { const struct rte_flow_item *item; @@ -1231,7 +1231,7 @@ cons_parse_l2_tn_filter(struct rte_eth_dev *dev, /* The first not void item should be e-tag. */ item = next_no_void_pattern(pattern, NULL); if (item->type != RTE_FLOW_ITEM_TYPE_E_TAG) { - memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf)); + memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf)); rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "Not supported by L2 tunnel filter"); @@ -1239,7 +1239,7 @@ cons_parse_l2_tn_filter(struct rte_eth_dev *dev, } if (!item->spec || !item->mask) { - memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf)); + memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf)); rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "Not supported by L2 tunnel filter"); return -rte_errno; @@ -1261,7 +1261,7 @@ cons_parse_l2_tn_filter(struct rte_eth_dev *dev, e_tag_mask->in_ecid_e || e_tag_mask->ecid_e || e_tag_mask->rsvd_grp_ecid_b != rte_cpu_to_be_16(0x3FFF)) { - memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf)); + memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf)); rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "Not supported by L2 tunnel filter"); @@ -1278,7 +1278,7 @@ cons_parse_l2_tn_filter(struct rte_eth_dev *dev, /* check if the next not void item is END */ item = next_no_void_pattern(pattern, item); if (item->type != RTE_FLOW_ITEM_TYPE_END) { - memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf)); + memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf)); rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "Not supported by L2 tunnel filter"); @@ -1288,7 +1288,7 @@ cons_parse_l2_tn_filter(struct rte_eth_dev *dev, /* parse attr */ /* must be input direction */ if (!attr->ingress) { - memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf)); + memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf)); rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, attr, "Only support ingress."); @@ -1297,7 +1297,7 @@ cons_parse_l2_tn_filter(struct rte_eth_dev *dev, /* not supported */ if (attr->egress) { - memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf)); + memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf)); rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, attr, "Not support egress."); @@ -1306,7 +1306,7 @@ cons_parse_l2_tn_filter(struct rte_eth_dev *dev, /* not supported */ if (attr->transfer) { - memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf)); + memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf)); rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER, attr, "No support for transfer."); @@ -1315,7 +1315,7 @@ cons_parse_l2_tn_filter(struct rte_eth_dev *dev, /* not supported */ if (attr->priority) { - memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf)); + memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf)); rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY, attr, "Not support priority."); @@ -1326,7 +1326,7 @@ cons_parse_l2_tn_filter(struct rte_eth_dev *dev, act = next_no_void_action(actions, NULL); if (act->type != RTE_FLOW_ACTION_TYPE_VF && act->type != RTE_FLOW_ACTION_TYPE_PF) { - memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf)); + memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf)); rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, act, "Not supported action."); @@ -1343,7 +1343,7 @@ cons_parse_l2_tn_filter(struct rte_eth_dev *dev, /* check if the next not void item is END */ act = next_no_void_action(actions, act); if (act->type != RTE_FLOW_ACTION_TYPE_END) { - memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf)); + memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf)); rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, act, "Not supported action."); @@ -1358,7 +1358,7 @@ ixgbe_parse_l2_tn_filter(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], - struct rte_eth_l2_tunnel_conf *l2_tn_filter, + struct ixgbe_l2_tunnel_conf *l2_tn_filter, struct rte_flow_error *error) { int ret = 0; @@ -1372,7 +1372,7 @@ ixgbe_parse_l2_tn_filter(struct rte_eth_dev *dev, if (hw->mac.type != ixgbe_mac_X550 && hw->mac.type != ixgbe_mac_X550EM_x && hw->mac.type != ixgbe_mac_X550EM_a) { - memset(l2_tn_filter, 0, sizeof(struct rte_eth_l2_tunnel_conf)); + memset(l2_tn_filter, 0, sizeof(struct ixgbe_l2_tunnel_conf)); rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL, "Not supported by L2 tunnel filter"); @@ -3023,7 +3023,7 @@ ixgbe_flow_create(struct rte_eth_dev *dev, struct rte_eth_ethertype_filter ethertype_filter; struct rte_eth_syn_filter syn_filter; struct ixgbe_fdir_rule fdir_rule; - struct rte_eth_l2_tunnel_conf l2_tn_filter; + struct ixgbe_l2_tunnel_conf l2_tn_filter; struct ixgbe_hw_fdir_info *fdir_info = IXGBE_DEV_PRIVATE_TO_FDIR_INFO(dev->data->dev_private); struct ixgbe_rte_flow_rss_conf rss_conf; @@ -3211,7 +3211,7 @@ ixgbe_flow_create(struct rte_eth_dev *dev, goto out; } - memset(&l2_tn_filter, 0, sizeof(struct rte_eth_l2_tunnel_conf)); + memset(&l2_tn_filter, 0, sizeof(struct ixgbe_l2_tunnel_conf)); ret = ixgbe_parse_l2_tn_filter(dev, attr, pattern, actions, &l2_tn_filter, error); if (!ret) { @@ -3225,7 +3225,7 @@ ixgbe_flow_create(struct rte_eth_dev *dev, } rte_memcpy(&l2_tn_filter_ptr->filter_info, &l2_tn_filter, - sizeof(struct rte_eth_l2_tunnel_conf)); + sizeof(struct ixgbe_l2_tunnel_conf)); TAILQ_INSERT_TAIL(&filter_l2_tunnel_list, l2_tn_filter_ptr, entries); flow->rule = l2_tn_filter_ptr; @@ -3282,7 +3282,7 @@ ixgbe_flow_validate(struct rte_eth_dev *dev, struct rte_eth_ntuple_filter ntuple_filter; struct rte_eth_ethertype_filter ethertype_filter; struct rte_eth_syn_filter syn_filter; - struct rte_eth_l2_tunnel_conf l2_tn_filter; + struct ixgbe_l2_tunnel_conf l2_tn_filter; struct ixgbe_fdir_rule fdir_rule; struct ixgbe_rte_flow_rss_conf rss_conf; int ret; @@ -3311,7 +3311,7 @@ ixgbe_flow_validate(struct rte_eth_dev *dev, if (!ret) return 0; - memset(&l2_tn_filter, 0, sizeof(struct rte_eth_l2_tunnel_conf)); + memset(&l2_tn_filter, 0, sizeof(struct ixgbe_l2_tunnel_conf)); ret = ixgbe_parse_l2_tn_filter(dev, attr, pattern, actions, &l2_tn_filter, error); if (!ret) @@ -3337,7 +3337,7 @@ ixgbe_flow_destroy(struct rte_eth_dev *dev, struct rte_eth_ethertype_filter ethertype_filter; struct rte_eth_syn_filter syn_filter; struct ixgbe_fdir_rule fdir_rule; - struct rte_eth_l2_tunnel_conf l2_tn_filter; + struct ixgbe_l2_tunnel_conf l2_tn_filter; struct ixgbe_ntuple_filter_ele *ntuple_filter_ptr; struct ixgbe_ethertype_filter_ele *ethertype_filter_ptr; struct ixgbe_eth_syn_filter_ele *syn_filter_ptr; @@ -3407,7 +3407,7 @@ ixgbe_flow_destroy(struct rte_eth_dev *dev, l2_tn_filter_ptr = (struct ixgbe_eth_l2_tunnel_conf_ele *) pmd_flow->rule; rte_memcpy(&l2_tn_filter, &l2_tn_filter_ptr->filter_info, - sizeof(struct rte_eth_l2_tunnel_conf)); + sizeof(struct ixgbe_l2_tunnel_conf)); ret = ixgbe_dev_l2_tunnel_filter_del(dev, &l2_tn_filter); if (!ret) { TAILQ_REMOVE(&filter_l2_tunnel_list, diff --git a/lib/librte_ethdev/rte_eth_ctrl.h b/lib/librte_ethdev/rte_eth_ctrl.h index 012e8059ad..1cca522fa3 100644 --- a/lib/librte_ethdev/rte_eth_ctrl.h +++ b/lib/librte_ethdev/rte_eth_ctrl.h @@ -486,17 +486,6 @@ struct rte_eth_fdir_stats { uint32_t best_cnt; /**< Number of filters in best effort spaces. */ }; -/** - * l2 tunnel configuration. - */ -struct rte_eth_l2_tunnel_conf { - enum rte_eth_tunnel_type l2_tunnel_type; - uint16_t ether_type; /* ether type in l2 header */ - uint32_t tunnel_id; /* port tag id for e-tag */ - uint16_t vf_id; /* VF id for tag insertion */ - uint32_t pool; /* destination pool for tag based forwarding */ -}; - #ifdef __cplusplus } #endif