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 84617A2EEB for ; Thu, 12 Sep 2019 17:25:30 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BDB361EBF3; Thu, 12 Sep 2019 17:24:51 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 720621EBDA for ; Thu, 12 Sep 2019 17:24:49 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x8CFOn2t018236 for ; Thu, 12 Sep 2019 08:24:49 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=Lst8Hm3hMuXJr+JkF4T6bp5gDb8nD9mzUBUQB/GtDvM=; b=GdOBEQkQAv5sSoWiJXGvE2BISXhw/mX44mBgUAIP7lUlM1D3hUBWu459XSNqFAnogaij lhxgNUEB37ZKBeHHyYAOoppInsTGXe8Wi5lj9OowdIkvWElNgUg9gPWk6n6FM6JmyY3B i8CB2qSWGFgYxMKJ0vMLATqYhuc7AWzxwCHECyTL0fo6IdKt9ufvFJ8+fMJJFL6ui8CB 5oNt2wiblOoV16uWd0dyIGwzsd6V24M5v8MwQ3LFcXqzqpaPHsA8QnoCFIhnFwfdq7ZE EP7sKNvzvu0g8A38iY42PBWQ0IYeTQinrUs6WZ70Z9eWCXtbTz5wfUraRDHRhCtr/QFw +A== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 2uvc2jy6c6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 12 Sep 2019 08:24:48 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 12 Sep 2019 08:24:47 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 12 Sep 2019 08:24:47 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id DEE5E3F703F; Thu, 12 Sep 2019 08:24:46 -0700 (PDT) Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x8CFOkJF003094; Thu, 12 Sep 2019 08:24:46 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x8CFOkYT003084; Thu, 12 Sep 2019 08:24:46 -0700 From: Shahed Shaikh To: CC: , , Date: Thu, 12 Sep 2019 08:24:16 -0700 Message-ID: <20190912152416.2990-6-shshaikh@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190912152416.2990-1-shshaikh@marvell.com> References: <20190912152416.2990-1-shshaikh@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-12_08:2019-09-11,2019-09-12 signatures=0 Subject: [dpdk-dev] [PATCH v2 5/5] net/qede: implement rte_flow drop action 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" Add support to configure drop action in rte_flow infrastructure and add counter for dropped packets due to this filter action "rx_gft_filter_drop". Also, update supported flows and actions in qede guide. Signed-off-by: Shahed Shaikh --- doc/guides/nics/qede.rst | 39 +++++++++++++++++++++ drivers/net/qede/base/ecore_dev_api.h | 1 + drivers/net/qede/base/ecore_l2.c | 50 +++++++++++++++------------ drivers/net/qede/base/ecore_l2_api.h | 39 ++++++++++++++------- drivers/net/qede/qede_ethdev.c | 2 ++ drivers/net/qede/qede_ethdev.h | 1 + drivers/net/qede/qede_filter.c | 22 ++++++++---- 7 files changed, 114 insertions(+), 40 deletions(-) diff --git a/doc/guides/nics/qede.rst b/doc/guides/nics/qede.rst index 05a6aef57..471d98014 100644 --- a/doc/guides/nics/qede.rst +++ b/doc/guides/nics/qede.rst @@ -39,6 +39,7 @@ Supported Features - GENEVE Tunneling offload - VXLAN Tunneling offload - MPLSoUDP Tx Tunneling offload +- Generic flow API Non-supported Features ---------------------- @@ -137,6 +138,44 @@ Driver compilation and testing Refer to the document :ref:`compiling and testing a PMD for a NIC ` for details. +RTE Flow Support +---------------- + +QLogic FastLinQ QL4xxxx NICs has support for the following patterns and +actions. + +Patterns: + +.. _table_qede_supported_flow_item_types: + +.. table:: Item types + + +----+--------------------------------+ + | # | Pattern Type | + +====+================================+ + | 1 | RTE_FLOW_ITEM_TYPE_IPV4 | + +----+--------------------------------+ + | 2 | RTE_FLOW_ITEM_TYPE_IPV6 | + +----+--------------------------------+ + | 3 | RTE_FLOW_ITEM_TYPE_UDP | + +----+--------------------------------+ + | 4 | RTE_FLOW_ITEM_TYPE_TCP | + +----+--------------------------------+ + +Actions: + +.. _table_qede_supported_ingress_action_types: + +.. table:: Ingress action types + + +----+--------------------------------+ + | # | Action Type | + +====+================================+ + | 1 | RTE_FLOW_ACTION_TYPE_QUEUE | + +----+--------------------------------+ + | 2 | RTE_FLOW_ACTION_TYPE_DROP | + +----+--------------------------------+ + SR-IOV: Prerequisites and Sample Application Notes -------------------------------------------------- diff --git a/drivers/net/qede/base/ecore_dev_api.h b/drivers/net/qede/base/ecore_dev_api.h index 730806321..a99888097 100644 --- a/drivers/net/qede/base/ecore_dev_api.h +++ b/drivers/net/qede/base/ecore_dev_api.h @@ -334,6 +334,7 @@ struct ecore_eth_stats_common { u64 rx_bcast_pkts; u64 mftag_filter_discards; u64 mac_filter_discards; + u64 gft_filter_drop; u64 tx_ucast_bytes; u64 tx_mcast_bytes; u64 tx_bcast_bytes; diff --git a/drivers/net/qede/base/ecore_l2.c b/drivers/net/qede/base/ecore_l2.c index 8b9817eb2..5dcdc84fc 100644 --- a/drivers/net/qede/base/ecore_l2.c +++ b/drivers/net/qede/base/ecore_l2.c @@ -1782,6 +1782,8 @@ static void __ecore_get_vport_tstats(struct ecore_hwfn *p_hwfn, HILO_64_REGPAIR(tstats.mftag_filter_discard); p_stats->common.mac_filter_discards += HILO_64_REGPAIR(tstats.eth_mac_filter_discard); + p_stats->common.gft_filter_drop += + HILO_64_REGPAIR(tstats.eth_gft_drop_pkt); } static void __ecore_get_vport_ustats_addrlen(struct ecore_hwfn *p_hwfn, @@ -2140,9 +2142,7 @@ void ecore_arfs_mode_configure(struct ecore_hwfn *p_hwfn, enum _ecore_status_t ecore_configure_rfs_ntuple_filter(struct ecore_hwfn *p_hwfn, struct ecore_spq_comp_cb *p_cb, - dma_addr_t p_addr, u16 length, - u16 qid, u8 vport_id, - bool b_is_add) + struct ecore_ntuple_filter_params *p_params) { struct rx_update_gft_filter_data *p_ramrod = OSAL_NULL; struct ecore_spq_entry *p_ent = OSAL_NULL; @@ -2151,14 +2151,6 @@ ecore_configure_rfs_ntuple_filter(struct ecore_hwfn *p_hwfn, u8 abs_vport_id = 0; enum _ecore_status_t rc = ECORE_NOTIMPL; - rc = ecore_fw_vport(p_hwfn, vport_id, &abs_vport_id); - if (rc != ECORE_SUCCESS) - return rc; - - rc = ecore_fw_l2_queue(p_hwfn, qid, &abs_rx_q_id); - if (rc != ECORE_SUCCESS) - return rc; - /* Get SPQ entry */ OSAL_MEMSET(&init_data, 0, sizeof(init_data)); init_data.cid = ecore_spq_get_cid(p_hwfn); @@ -2180,27 +2172,41 @@ ecore_configure_rfs_ntuple_filter(struct ecore_hwfn *p_hwfn, p_ramrod = &p_ent->ramrod.rx_update_gft; - DMA_REGPAIR_LE(p_ramrod->pkt_hdr_addr, p_addr); - p_ramrod->pkt_hdr_length = OSAL_CPU_TO_LE16(length); + DMA_REGPAIR_LE(p_ramrod->pkt_hdr_addr, p_params->addr); + p_ramrod->pkt_hdr_length = OSAL_CPU_TO_LE16(p_params->length); - p_ramrod->action_icid_valid = 0; - p_ramrod->action_icid = 0; + if (p_params->b_is_drop) { + p_ramrod->vport_id = OSAL_CPU_TO_LE16(ETH_GFT_TRASHCAN_VPORT); + } else { + rc = ecore_fw_vport(p_hwfn, p_params->vport_id, + &abs_vport_id); + if (rc) + return rc; + + if (p_params->qid != ECORE_RFS_NTUPLE_QID_RSS) { + rc = ecore_fw_l2_queue(p_hwfn, p_params->qid, + &abs_rx_q_id); + if (rc) + return rc; - p_ramrod->rx_qid_valid = 1; - p_ramrod->rx_qid = OSAL_CPU_TO_LE16(abs_rx_q_id); + p_ramrod->rx_qid_valid = 1; + p_ramrod->rx_qid = OSAL_CPU_TO_LE16(abs_rx_q_id); + } + + p_ramrod->vport_id = OSAL_CPU_TO_LE16((u16)abs_vport_id); + } p_ramrod->flow_id_valid = 0; p_ramrod->flow_id = 0; - p_ramrod->vport_id = OSAL_CPU_TO_LE16((u16)abs_vport_id); - p_ramrod->filter_action = b_is_add ? GFT_ADD_FILTER - : GFT_DELETE_FILTER; + p_ramrod->filter_action = p_params->b_is_add ? GFT_ADD_FILTER + : GFT_DELETE_FILTER; DP_VERBOSE(p_hwfn, ECORE_MSG_SP, "V[%0x], Q[%04x] - %s filter from 0x%lx [length %04xb]\n", abs_vport_id, abs_rx_q_id, - b_is_add ? "Adding" : "Removing", - (unsigned long)p_addr, length); + p_params->b_is_add ? "Adding" : "Removing", + (unsigned long)p_params->addr, p_params->length); return ecore_spq_post(p_hwfn, p_ent, OSAL_NULL); } diff --git a/drivers/net/qede/base/ecore_l2_api.h b/drivers/net/qede/base/ecore_l2_api.h index 004fb61ba..acde81fad 100644 --- a/drivers/net/qede/base/ecore_l2_api.h +++ b/drivers/net/qede/base/ecore_l2_api.h @@ -448,6 +448,31 @@ void ecore_arfs_mode_configure(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, struct ecore_arfs_config_params *p_cfg_params); +struct ecore_ntuple_filter_params { + /* Physically mapped address containing header of buffer to be used + * as filter. + */ + dma_addr_t addr; + + /* Length of header in bytes */ + u16 length; + + /* Relative queue-id to receive classified packet */ + #define ECORE_RFS_NTUPLE_QID_RSS ((u16)-1) + u16 qid; + + /* Identifier can either be according to vport-id or vfid */ + bool b_is_vf; + u8 vport_id; + u8 vf_id; + + /* true if this filter is to be added. Else to be removed */ + bool b_is_add; + + /* If packet needs to be dropped */ + bool b_is_drop; +}; + /** * @brief - ecore_configure_rfs_ntuple_filter * @@ -457,22 +482,12 @@ void ecore_arfs_mode_configure(struct ecore_hwfn *p_hwfn, * @params p_cb Used for ECORE_SPQ_MODE_CB,where client would initialize * it with cookie and callback function address, if not * using this mode then client must pass NULL. - * @params p_addr p_addr is an actual packet header that needs to be - * filter. It has to mapped with IO to read prior to - * calling this, [contains 4 tuples- src ip, dest ip, - * src port, dest port]. - * @params length length of p_addr header up to past the transport header. - * @params qid receive packet will be directed to this queue. - * @params vport_id - * @params b_is_add flag to add or remove filter. - * + * @params p_params */ enum _ecore_status_t ecore_configure_rfs_ntuple_filter(struct ecore_hwfn *p_hwfn, struct ecore_spq_comp_cb *p_cb, - dma_addr_t p_addr, u16 length, - u16 qid, u8 vport_id, - bool b_is_add); + struct ecore_ntuple_filter_params *p_params); /** * @brief - ecore_update_eth_rss_ind_table_entry diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 98290fdc7..8064735db 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -125,6 +125,8 @@ static const struct rte_qede_xstats_name_off qede_xstats_strings[] = { offsetof(struct ecore_eth_stats_common, mftag_filter_discards)}, {"rx_mac_filter_discards", offsetof(struct ecore_eth_stats_common, mac_filter_discards)}, + {"rx_gft_filter_drop", + offsetof(struct ecore_eth_stats_common, gft_filter_drop)}, {"rx_hw_buffer_truncates", offsetof(struct ecore_eth_stats_common, brb_truncates)}, {"rx_hw_buffer_discards", diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h index 5549d0bf3..b5f93e9fa 100644 --- a/drivers/net/qede/qede_ethdev.h +++ b/drivers/net/qede/qede_ethdev.h @@ -179,6 +179,7 @@ struct qede_arfs_entry { uint32_t soft_id; /* unused for now */ uint16_t pkt_len; /* actual packet length to match */ uint16_t rx_queue; /* queue to be steered to */ + bool is_drop; /* drop action */ const struct rte_memzone *mz; /* mz used to hold L2 frame */ struct qede_arfs_tuple tuple; SLIST_ENTRY(qede_arfs_entry) list; diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c index 81509f04b..b7ad59ad6 100644 --- a/drivers/net/qede/qede_filter.c +++ b/drivers/net/qede/qede_filter.c @@ -272,6 +272,7 @@ qede_config_arfs_filter(struct rte_eth_dev *eth_dev, { struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev); struct ecore_dev *edev = QEDE_INIT_EDEV(qdev); + struct ecore_ntuple_filter_params params; char mz_name[RTE_MEMZONE_NAMESIZE] = {0}; struct qede_arfs_entry *tmp = NULL; const struct rte_memzone *mz; @@ -344,12 +345,18 @@ qede_config_arfs_filter(struct rte_eth_dev *eth_dev, ecore_arfs_mode_configure(p_hwfn, p_hwfn->p_arfs_ptt, &qdev->arfs_info.arfs); } + + memset(¶ms, 0, sizeof(params)); + params.addr = (dma_addr_t)mz->iova; + params.length = pkt_len; + params.qid = arfs->rx_queue; + params.vport_id = 0; + params.b_is_add = add; + params.b_is_drop = arfs->is_drop; + /* configure filter with ECORE_SPQ_MODE_EBLOCK */ rc = ecore_configure_rfs_ntuple_filter(p_hwfn, NULL, - (dma_addr_t)mz->iova, - pkt_len, - arfs->rx_queue, - 0, add); + ¶ms); if (rc == ECORE_SUCCESS) { if (add) { arfs->pkt_len = pkt_len; @@ -1371,12 +1378,15 @@ qede_flow_parse_actions(struct rte_eth_dev *dev, flow->entry.rx_queue = queue->index; break; - + case RTE_FLOW_ACTION_TYPE_DROP: + if (flow) + flow->entry.is_drop = true; + break; default: rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, actions, - "Action is not supported - only ACTION_TYPE_QUEUE supported"); + "Action is not supported - only ACTION_TYPE_QUEUE and ACTION_TYPE_DROP supported"); return -rte_errno; } } -- 2.17.1