From patchwork Wed Dec 2 10:12:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liron Himi X-Patchwork-Id: 84709 X-Patchwork-Delegate: jerinj@marvell.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 EDBA2A04DB; Wed, 2 Dec 2020 11:24:23 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 80B3FCC19; Wed, 2 Dec 2020 11:13:33 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 87AEECC19 for ; Wed, 2 Dec 2020 11:13:31 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 0B2AAT4k024223 for ; Wed, 2 Dec 2020 02:13:29 -0800 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-transfer-encoding : content-type; s=pfpt0220; bh=9mfkY4Qb/Jc4B2ZD5ZqrIAZQlKSQcS8uSv3ZSGX5bsA=; b=gIjTRedWqNj5F92LO4CBg/Ss1A/307m44MwrO7TYYVs3HNETgyPOlUyZpUbT1lp17fen Ijr0JuCQrkuYFLbhu4p6MYe9esBGy76/U+aIgnP8c7lu1OT9oCJ4n/NlqMpJbo1n8nRu zlGDNIjyxjpb4demrMcImPvDSVXf1YaryJL+8lA7BixvQZN4dZAjjtVB2iVmoy0so1Dd lMV5nX5PNqaWTC4k0LjdyAN///X3a2ttootYmyDeEiniLnrUUVKDq3gRiVPYUpIsmheq +XgjNe1zbJxFiWJIFNChYGKmbSrMg1opkytqiZb1jr77Icr3tPsLoDNlFAjocw9w9qXr vw== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 355w509r6g-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 02 Dec 2020 02:13:26 -0800 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 2 Dec 2020 02:13:24 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 2 Dec 2020 02:13:24 -0800 Received: from pt-lxl0023.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 2 Dec 2020 02:13:23 -0800 From: To: CC: , Dana Vardi , Liron Himi Date: Wed, 2 Dec 2020 12:12:10 +0200 Message-ID: <20201202101212.4717-37-lironh@marvell.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201202101212.4717-1-lironh@marvell.com> References: <20201202101212.4717-1-lironh@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312, 18.0.737 definitions=2020-12-02_04:2020-11-30, 2020-12-02 signatures=0 Subject: [dpdk-dev] [PATCH v1 36/38] net/mvpp2: forward bad packets support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Dana Vardi extend the config file with option to forward packets that were marked as "l2 bad pkts". by default the driver drop those packets Signed-off-by: Dana Vardi Reviewed-by: Liron Himi Reviewed-by: Michael Shamis Signed-off-by: Dana Vardi Reviewed-by: Liron Himi --- drivers/net/mvpp2/mrvl_ethdev.c | 10 ++++++++-- drivers/net/mvpp2/mrvl_ethdev.h | 2 ++ drivers/net/mvpp2/mrvl_qos.c | 17 +++++++++++++++++ drivers/net/mvpp2/mrvl_qos.h | 1 + 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index cb792300b..4b5c4f075 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.c +++ b/drivers/net/mvpp2/mrvl_ethdev.c @@ -798,9 +798,14 @@ mrvl_dev_start(struct rte_eth_dev *dev) priv->pp_id, priv->ppio_id); priv->ppio_params.match = match; priv->ppio_params.eth_start_hdr = PP2_PPIO_HDR_ETH; - if (mrvl_cfg) + priv->forward_bad_frames = 0; + + if (mrvl_cfg) { priv->ppio_params.eth_start_hdr = mrvl_cfg->port[dev->data->port_id].eth_start_hdr; + priv->forward_bad_frames = + mrvl_cfg->port[dev->data->port_id].forward_bad_frames; + } /* * Calculate the minimum bpool size for refill feature as follows: @@ -2709,7 +2714,8 @@ mrvl_rx_pkt_burst(void *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) /* drop packet in case of mac, overrun or resource error */ status = pp2_ppio_inq_desc_get_l2_pkt_error(&descs[i]); - if (unlikely(status != PP2_DESC_ERR_OK)) { + if ((unlikely(status != PP2_DESC_ERR_OK)) && + !(q->priv->forward_bad_frames)) { struct pp2_buff_inf binf = { .addr = rte_mbuf_data_iova_default(mbuf), .cookie = (uint64_t)mbuf, diff --git a/drivers/net/mvpp2/mrvl_ethdev.h b/drivers/net/mvpp2/mrvl_ethdev.h index 148f2acba..2c1c159b9 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.h +++ b/drivers/net/mvpp2/mrvl_ethdev.h @@ -182,6 +182,8 @@ struct mrvl_priv { LIST_HEAD(shaper_profiles, mrvl_tm_shaper_profile) shaper_profiles; LIST_HEAD(nodes, mrvl_tm_node) nodes; uint64_t rate_max; + + uint8_t forward_bad_frames; }; /** Flow operations forward declaration. */ diff --git a/drivers/net/mvpp2/mrvl_qos.c b/drivers/net/mvpp2/mrvl_qos.c index 10e8636b4..f3936aec4 100644 --- a/drivers/net/mvpp2/mrvl_qos.c +++ b/drivers/net/mvpp2/mrvl_qos.c @@ -76,6 +76,8 @@ #define MRVL_TOK_PARSER_UDF_PROTO_UDP "udp" #define MRVL_TOK_PARSER_UDF_FIELD_UDP_DPORT "dport" +/* paser forward bad frames tokens */ +#define MRVL_TOK_FWD_BAD_FRAMES "forward_bad_frames" /** Number of tokens in range a-b = 2. */ #define MAX_RNG_TOKENS 2 @@ -872,6 +874,21 @@ mrvl_get_cfg(const char *key __rte_unused, const char *path, void *extra_args) return -1; } } + + /* Parse forward bad frames option */ + entry = rte_cfgfile_get_entry(file, sec_name, + MRVL_TOK_FWD_BAD_FRAMES); + if (entry) { + if (get_val_securely(entry, &val) < 0) { + MRVL_LOG(ERR, + "Error in parsing %s value (%s)!\n", + MRVL_TOK_FWD_BAD_FRAMES, entry); + return -1; + } + (*cfg)->port[n].forward_bad_frames = (uint8_t)val; + } else { + (*cfg)->port[n].forward_bad_frames = 0; + } } return 0; diff --git a/drivers/net/mvpp2/mrvl_qos.h b/drivers/net/mvpp2/mrvl_qos.h index daf4776ec..f2e341c37 100644 --- a/drivers/net/mvpp2/mrvl_qos.h +++ b/drivers/net/mvpp2/mrvl_qos.h @@ -48,6 +48,7 @@ struct mrvl_cfg { uint8_t use_global_defaults; struct pp2_cls_plcr_params policer_params; uint8_t setup_policer; + uint8_t forward_bad_frames; } port[RTE_MAX_ETHPORTS]; };