From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B0B52A09FF; Mon, 11 Jan 2021 17:38:00 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 70500140E38; Mon, 11 Jan 2021 17:38:00 +0100 (CET) Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) by mails.dpdk.org (Postfix) with ESMTP id A2D3A140E33 for ; Mon, 11 Jan 2021 17:37:58 +0100 (CET) Received: by mail-io1-f45.google.com with SMTP id m23so231576ioy.2 for ; Mon, 11 Jan 2021 08:37:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=f9tRI7MHV2v2VT4/QtSl8LRATSJZ2oeFyBT0VUo/XH4=; b=sneYCohjose8iCI1ONu5vPnDI8SIAykalVFuVcMa+HksHfRV79gV76J4CgEKv6cLof 17gdA6QpERYTI6mxMCHx+0Jog+kACbFP70rIrDFNljongs++5tx8WmiRia2tzC+a4RFm dK7lhIDvMnTB/DcHSg4KYlg6TwInHMKdAsyrM1fcjnmsPCIlkagJiuRRFph6xL2vIIfQ stm8/2a4TD8R8rfg9vgDBH0Q/2reEH/XXh4bCAP70zixgkqqfM1xXryacQg82ch3fFM2 5VargnEBgWifzEx3D3De6UHo1mQnPkDcddNsqjP5ofwcBU3TSTHR63vmdfOU6z0y5Z3f Pyng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=f9tRI7MHV2v2VT4/QtSl8LRATSJZ2oeFyBT0VUo/XH4=; b=IA8dQb7/K7CSVtrnVcDkT+Nv8mhBPbQ27G2cBKXfpCmsOQeS220m4lkDmSiVIm95nY M3y7EGWmSL7fr7z3h1rNRBcprBCJ1q2B2ljir9dVtgvCZ1E1MmjiWMDLQhs4MuP+Cgrv Arzq726iUV5zHzT2YRiNL+Tun2/dbnw206HcdFeg75+vM4rnl4wGwBo7WXgap0G7DvWk fmj5Axluh8YEuaZx2+vlHV87wTXBln9z1A2US/YLDwlOtgDCREe1x7b32F08I8564FAh PGRCxjqH8ST+DVdXUKfzWGNAFiU+TRYZXFCodKQ65wl0BjeVuSHNRDpnYyXln+57t0bm 2wow== X-Gm-Message-State: AOAM53248/XVql+WSxoBhudzTOEUypPa5GnN/P07RJq156AIkpcDFuPR OYpJc4MaNl12r9gAXzaIPXiJ62C2SzqcOwQqfeI= X-Google-Smtp-Source: ABdhPJyu/SCiAy9PItp7G8vm8Vm4NXnhX4v3Ti8lsTEG/XxGi/7Z6jNobQ1hO1QDbrhtjfB2rWRNYmE7SLyVAnjvWnk= X-Received: by 2002:a02:cba7:: with SMTP id v7mr479076jap.133.1610383078043; Mon, 11 Jan 2021 08:37:58 -0800 (PST) MIME-Version: 1.0 References: <20201202101212.4717-1-lironh@marvell.com> <20201202101212.4717-28-lironh@marvell.com> In-Reply-To: From: Jerin Jacob Date: Mon, 11 Jan 2021 22:07:41 +0530 Message-ID: To: Michael Shamis Cc: Liron Himi , Jerin Jacob Kollanukkaran , "dev@dpdk.org" Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v1 27/38] net/mvpp2: dummy pool creation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wed, Dec 23, 2020 at 3:03 PM Michael Shamis wrote: > > Reviewed-by: Michael Shamis > > -----Original Message----- > From: dev On Behalf Of lironh@marvell.com > Sent: Wednesday, December 2, 2020 12:12 PM > To: Jerin Jacob Kollanukkaran > Cc: dev@dpdk.org; Liron Himi > Subject: [dpdk-dev] [PATCH v1 27/38] net/mvpp2: dummy pool creation probably change "dummy pool creation" to introduce fixup for ... > > From: Liron Himi > > Currently the HW is configured with only one pool which its buffer size may be larger than the rx-fifo-size. > In that situation, frame size larger than the fifo-size is gets dropped due to fifo overrun. > this is cause because the HW works in cut-through mode which waits to have in the fifo at least the amount of bytes as define in the smallest pool's buffer size. > > This patch add a dummy pool which its buffer size is very small (smaller than 64B frame). this tricks the HW and any frame size is gets passed from the FIFO to the PP2. > > Signed-off-by: Liron Himi > --- > drivers/net/mvpp2/mrvl_ethdev.c | 71 ++++++++++++++++++++++++++------- drivers/net/mvpp2/mrvl_ethdev.h | 2 + > drivers/net/mvpp2/mrvl_qos.c | 1 + > 3 files changed, 60 insertions(+), 14 deletions(-) > > diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index 127861a82..1f9489d77 100644 > --- a/drivers/net/mvpp2/mrvl_ethdev.c > +++ b/drivers/net/mvpp2/mrvl_ethdev.c > @@ -90,6 +90,8 @@ static int used_bpools[PP2_NUM_PKT_PROC] = { static struct pp2_bpool *mrvl_port_to_bpool_lookup[RTE_MAX_ETHPORTS]; > static int mrvl_port_bpool_size[PP2_NUM_PKT_PROC][PP2_BPOOL_NUM_POOLS][RTE_MAX_LCORE]; > static uint64_t cookie_addr_high = MRVL_COOKIE_ADDR_INVALID; > +static int dummy_pool_id[PP2_NUM_PKT_PROC]; struct pp2_bpool > +*dummy_pool[PP2_NUM_PKT_PROC] = {0}; > > struct mrvl_ifnames { > const char *names[PP2_NUM_ETH_PPIO * PP2_NUM_PKT_PROC]; @@ -189,6 +191,19 @@ static struct { > MRVL_XSTATS_TBL_ENTRY(tx_errors) > }; > > +static inline int > +mrvl_reserve_bit(int *bitmap, int max) > +{ > + int n = sizeof(*bitmap) * 8 - __builtin_clz(*bitmap); > + > + if (n >= max) > + return -1; > + > + *bitmap |= 1 << n; > + > + return n; > +} > + > /** > * Initialize packet processor. > * > @@ -199,6 +214,9 @@ static int > mrvl_init_pp2(void) > { > struct pp2_init_params init_params; > + struct pp2_bpool_params bpool_params; > + char name[15]; > + int err, i; > > memset(&init_params, 0, sizeof(init_params)); > init_params.hif_reserved_map = MRVL_MUSDK_HIFS_RESERVED; @@ -207,7 +225,36 @@ mrvl_init_pp2(void) > if (mrvl_cfg && mrvl_cfg->pp2_cfg.prs_udfs.num_udfs) > memcpy(&init_params.prs_udfs, &mrvl_cfg->pp2_cfg.prs_udfs, > sizeof(struct pp2_parse_udfs)); > - return pp2_init(&init_params); > + err = pp2_init(&init_params); > + if (err != 0) { > + MRVL_LOG(ERR, "PP2 init failed"); > + return -1; > + } > + > + memset(dummy_pool, 0, sizeof(dummy_pool)); > + for (i = 0; i < pp2_get_num_inst(); i++) { > + dummy_pool_id[i] = mrvl_reserve_bit(&used_bpools[i], > + PP2_BPOOL_NUM_POOLS); > + if (dummy_pool_id[i] < 0) { > + MRVL_LOG(ERR, "Can't find free pool\n"); > + return -1; > + } > + > + memset(name, 0, sizeof(name)); > + snprintf(name, sizeof(name), "pool-%d:%d", i, dummy_pool_id[i]); > + memset(&bpool_params, 0, sizeof(bpool_params)); > + bpool_params.match = name; > + bpool_params.buff_len = MRVL_PKT_OFFS; > + bpool_params.dummy_short_pool = 1; > + err = pp2_bpool_init(&bpool_params, &dummy_pool[i]); > + if (err != 0 || !dummy_pool[i]) { > + MRVL_LOG(ERR, "BPool init failed!\n"); > + used_bpools[i] &= ~(1 << dummy_pool_id[i]); > + return -1; Probably you can move this fixup and init and fini as separation function with a comment. Say mrvl_..._fixup_init() and mrvl_..._fixup_fini()