Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1441571pxb; Wed, 4 Nov 2020 09:01:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJyyaexxblyV78vAvFNbbjnveWl4haKKMg6TNsibSslz27+hX0znSsIldH1+pKCxj+aehwLm X-Received: by 2002:aa7:de97:: with SMTP id j23mr28301951edv.45.1604509277958; Wed, 04 Nov 2020 09:01:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604509277; cv=none; d=google.com; s=arc-20160816; b=g1P5WSIBrZLXzpl15PkbeU0V2H0VfqYInIIqyltjpTtfCM2PktFRk3EAHY9FYxaxuC xn25ePJbNSKum54AHfQxYSA9FaE1LX249lveiywqBDiW+HJn0u8wdUGiuw6EHWF8D8SO yiFGo/zIC1dPCTAuDsyRpX17691yhrMtKrHF22RPNPjo871ZPbu2AJzMUvk3+/+onxcF q6YPQ7X0eupQaW/JWh8vJwUc4HzA53FMTBcJzO6fQFE0iPqSb4tZkv0FV/GulfFVziEc tk/4bGctu9LpJaU9FO++DcBDkjzpr/U33zWgOxe9541zpX05SWvCdDHHw3tKHfIO34ax 8xgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EDL7iVITnjN2zqIR3rWp5y3OBXWBH+5pWTBqHVdSlTo=; b=ONCLKOYiC+WHALbb2vOI2HhlTNlaGBEpxNTSCibpdeqcCveleEMD0Uler01Dv0q6V4 QRfuJsl143yjto2gxjAfQEB6LZ2B7Wiyj/zo74rd/Ct5E+YOCWLlR8Y++XXyrbe/kbBk /962eBXrli+ECXnasViZpR4jzFVFQawmre5cjrdrAkAJ4AF+kW+zkVrmfao2GtAz4/3a XF54YjvpSwtsRhxSvKKO0l/oflW6rxM157ypx42cqeXrnffHzqjIRyd9mkxJ1o7qjg7a tXHXG/X2tYtBobjUnP24x+MsbdNgMsUkkZ86I3GUDtj8kh2ZOmF+Y0hGJL5AzTsYBiVA XPgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gtFBMLxZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r10si1803085ejr.168.2020.11.04.09.00.55; Wed, 04 Nov 2020 09:01:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gtFBMLxZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731965AbgKDQ6W (ORCPT + 99 others); Wed, 4 Nov 2020 11:58:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731501AbgKDQ5d (ORCPT ); Wed, 4 Nov 2020 11:57:33 -0500 Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 729E8C0613D3; Wed, 4 Nov 2020 08:57:33 -0800 (PST) Received: by mail-ed1-x544.google.com with SMTP id v4so23193574edi.0; Wed, 04 Nov 2020 08:57:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EDL7iVITnjN2zqIR3rWp5y3OBXWBH+5pWTBqHVdSlTo=; b=gtFBMLxZHtZNE0AYm40OxttgGXm7IFqOY0WBvL+G4zWOwdMAD+tt/ftHnu82I5HSpC X+JdsywwHoTS28rCwaOvKgb+GJ5mcvVsZaNdl+CGJmdp6iY7Lh8+weCJRQks3esWTNRQ QVSN7c4b5HG8mwvIfIKjmVkxnZxywqCgmeAA1xqd2L0YIUGE0ZZPRgc7APjOTiK4luBD pCQbcOVcDSqDNqkMyEdejgvmVz3s/aIBj5O1Ntcu0M8Xja87yY/q3/8UJ87Jc+IVv7kG g8+SBe6w9ms2HUxfhi69IsUJELh4LDv4tYUalLcciTAlJe7R8Lqn+96FBwZFh39ji5M4 mZMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EDL7iVITnjN2zqIR3rWp5y3OBXWBH+5pWTBqHVdSlTo=; b=qIAyjqLzEnhBLHDTMLaAuYsTQeppIstSPCvktLdD0TSmnqrPFt0XnBlM80lsSnUQAx vttCfCOMUq3W/74jrLcZf4N+nwfoHaof5nyYjHS3Cy/QULCngjwYehXIDWF6H56mFdw5 vG6MnwSNnIRjcfwW9RFHkVtkwy3HfxC648Ld3IsIG3lTyl1k427a40WiBGteObp0/hPp O92kjF/c57NBpQlfcbPJZCPPqZi+Wd/ObOHMBQcJAAugaL05atnssdIsV/+nIM0Io+7J I2DfaTMkQ5FTdzJrLUmNcSwITu/ZoZwJFigJ0LiLcUwc7/Y4cmnI2ix62pu2n7BivnsM li3Q== X-Gm-Message-State: AOAM5334N9A01aRdPKS1766G1VjOZ7jOsp6luevnXhVdQi7+gxhjUqeQ aK3pAydgkjhX7muJ+g6o7Up7ARizu6nQiA== X-Received: by 2002:a05:6402:b68:: with SMTP id cb8mr6358861edb.198.1604509052131; Wed, 04 Nov 2020 08:57:32 -0800 (PST) Received: from yoga-910.localhost ([188.25.2.177]) by smtp.gmail.com with ESMTPSA id l12sm1354748edt.46.2020.11.04.08.57.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Nov 2020 08:57:31 -0800 (PST) From: Ioana Ciornei To: Greg Kroah-Hartman , Andrew Lunn Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Ioana Ciornei Subject: [RFC 3/9] staging: dpaa2-switch: setup RX path rings Date: Wed, 4 Nov 2020 18:57:14 +0200 Message-Id: <20201104165720.2566399-4-ciorneiioana@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201104165720.2566399-1-ciorneiioana@gmail.com> References: <20201104165720.2566399-1-ciorneiioana@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ioana Ciornei On the Rx path, when a pull-dequeue operation is performed on a software portal, available frame descriptors are put in a ring - a DMA memory storage - for further usage. Create the needed rings for both frame queues used on the control interface. Signed-off-by: Ioana Ciornei --- drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 37 +++++++++++++++++++++++++ drivers/staging/fsl-dpaa2/ethsw/ethsw.h | 4 +++ 2 files changed, 41 insertions(+) diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c index 21d3ff6b9f55..d81961d36821 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c @@ -1580,6 +1580,33 @@ static void dpaa2_switch_free_dpbp(struct ethsw_core *ethsw) fsl_mc_object_free(ethsw->dpbp_dev); } +static int dpaa2_switch_alloc_rings(struct ethsw_core *ethsw) +{ + int i; + + for (i = 0; i < DPAA2_SWITCH_RX_NUM_FQS; i++) { + ethsw->fq[i].store = + dpaa2_io_store_create(DPAA2_SWITCH_STORE_SIZE, + ethsw->dev); + if (!ethsw->fq[i].store) { + dev_err(ethsw->dev, "dpaa2_io_store_create failed\n"); + while (--i >= 0) + dpaa2_io_store_destroy(ethsw->fq[i].store); + return -ENOMEM; + } + } + + return 0; +} + +static void dpaa2_switch_destroy_rings(struct ethsw_core *ethsw) +{ + int i; + + for (i = 0; i < DPAA2_SWITCH_RX_NUM_FQS; i++) + dpaa2_io_store_destroy(ethsw->fq[i].store); +} + static int dpaa2_switch_ctrl_if_setup(struct ethsw_core *ethsw) { int err; @@ -1594,7 +1621,16 @@ static int dpaa2_switch_ctrl_if_setup(struct ethsw_core *ethsw) if (err) return err; + err = dpaa2_switch_alloc_rings(ethsw); + if (err) + goto err_free_dpbp; + return 0; + +err_free_dpbp: + dpaa2_switch_free_dpbp(ethsw); + + return err; } static int dpaa2_switch_init(struct fsl_mc_device *sw_dev) @@ -1777,6 +1813,7 @@ static void dpaa2_switch_takedown(struct fsl_mc_device *sw_dev) static void dpaa2_switch_ctrl_if_teardown(struct ethsw_core *ethsw) { + dpaa2_switch_destroy_rings(ethsw); dpaa2_switch_free_dpbp(ethsw); } diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.h b/drivers/staging/fsl-dpaa2/ethsw/ethsw.h index 84130134aa67..b476f9ac4c55 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.h +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.h @@ -18,6 +18,7 @@ #include #include #include +#include #include "dpsw.h" @@ -50,6 +51,8 @@ #define DPAA2_SWITCH_RX_BUF_SIZE \ (DPAA2_SWITCH_RX_BUF_RAW_SIZE - DPAA2_SWITCH_RX_BUF_TAILROOM) +#define DPAA2_SWITCH_STORE_SIZE 16 + extern const struct ethtool_ops dpaa2_switch_port_ethtool_ops; struct ethsw_core; @@ -57,6 +60,7 @@ struct ethsw_core; struct dpaa2_switch_fq { struct ethsw_core *ethsw; enum dpsw_queue_type type; + struct dpaa2_io_store *store; u32 fqid; }; -- 2.28.0