From patchwork Mon Feb 4 17:00:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Radulescu X-Patchwork-Id: 1036076 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="ZCdndn5t"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43tYr43shyz9s3l for ; Tue, 5 Feb 2019 04:00:52 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730368AbfBDRAt (ORCPT ); Mon, 4 Feb 2019 12:00:49 -0500 Received: from mail-eopbgr00056.outbound.protection.outlook.com ([40.107.0.56]:45536 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728147AbfBDRAt (ORCPT ); Mon, 4 Feb 2019 12:00:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aijKjw6KnJKCsnuy2wlJNwEdN38GZq8PrJwvJf+DRkI=; b=ZCdndn5tIwKQEFD6+YORORy8YXpl0J7viPJguUU7WMPgpcICNq/zmVF0CjtL1ZSD+ATFx3Wk0dHW6TOiBT2JBcnhIPaSAyzW6VgCEvLaRGdihRON1F1oPkKCMR5ipTqHcc1QI+I6pJd9E+ykpSxOAeYzz0TchWrRhS8dVe/szB0= Received: from AM0PR04MB4994.eurprd04.prod.outlook.com (20.177.40.15) by AM0PR04MB4148.eurprd04.prod.outlook.com (52.134.125.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.22; Mon, 4 Feb 2019 17:00:46 +0000 Received: from AM0PR04MB4994.eurprd04.prod.outlook.com ([fe80::4dc:92fb:eaf8:d6fa]) by AM0PR04MB4994.eurprd04.prod.outlook.com ([fe80::4dc:92fb:eaf8:d6fa%3]) with mapi id 15.20.1580.019; Mon, 4 Feb 2019 17:00:46 +0000 From: Ioana Ciocoi Radulescu To: "netdev@vger.kernel.org" , "davem@davemloft.net" CC: Ioana Ciornei , "brouer@redhat.com" , "ilias.apalodimas@linaro.org" Subject: [PATCH net-next 3/4] dpaa2-eth: Use FQ-based DPIO enqueue API Thread-Topic: [PATCH net-next 3/4] dpaa2-eth: Use FQ-based DPIO enqueue API Thread-Index: AQHUvKsmUkDDvFSWm0W9XmPw/xDjpQ== Date: Mon, 4 Feb 2019 17:00:36 +0000 Message-ID: <1549299625-28399-4-git-send-email-ruxandra.radulescu@nxp.com> References: <1549299625-28399-1-git-send-email-ruxandra.radulescu@nxp.com> In-Reply-To: <1549299625-28399-1-git-send-email-ruxandra.radulescu@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR0701CA0060.eurprd07.prod.outlook.com (2603:10a6:800:5f::22) To AM0PR04MB4994.eurprd04.prod.outlook.com (2603:10a6:208:c7::15) authentication-results: spf=none (sender IP is ) smtp.mailfrom=ruxandra.radulescu@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-originating-ip: [86.34.165.90] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR04MB4148; 6:bRDNxF3pHIWQfpsObPlho38n75ZPgrDJPgY/SSRY63bpP7YYKy2KYbVIWIC2nde/ZPRm/jN0ECtOSc/zCrTJX+dJ3LWbyJh/kCEh9yX0q9khzVBodVZMDgD2RHgqpdmFz+I1yJIj/9OMNFM+wW+rMZJMPXY3+T5HItuWzWnQYI1DTzxPoqiPxCKSyJLz1s0ieiNZqm2oJo9Hay1/k5fBD7EBlCXZm2DR2spwgvIrVHCLKJvXjd02wbD7y+5NEApn3Tt9/RAS/jJbKLWpBh9IQaNTki43p5EpqXYa8gbPzIBLgcR7roh3H94bpmV9eVj6DaPsVK0kjXPzLCp66Fb6hXGy+eUcK6L2UfoDzgrDERYPKhfkojvkz2MMIkQj/BGzs0aoWPGPOPq1ZID05XL4KnPjkQsjcPmAh9+ft4O8to2UTml/nxRfegHayYzQi+n3bIdm9ZjmASfUt4ToS/dGvg==; 5:JQ3owpsROWrGefzR8AlplKBtlJP0hxDPNYY7gTPzqQurd6Azi738vxyCDmiyYSIrQMVCx3bI1P8U1Ih2T8BDYwTmQVx7xxePfVerK1LSkHAwPHJZgeqLWcUNf3/extanc0W0YM9ooUzuid9KTgdK3QMoNl5oM080pMPbKGFmGROhi4jcYIg7gMoaakwviNUBAf8nDUXm2KfpsxtGWgax0Q==; 7:l8Wb5tynCfZjY3Orf1hbe5q1XhoNm9HB4RAuOpmZWUY9qXi4JhfxAB2rVdOskzZwrhBwWn4d6QqLJjeYbbPjloOTV24+OTmzKlZJCf9kmxv2/4v03o2lgQOoYzcvYgPBR6gY6dVr2PWgpXaEuYcezQ== x-ms-office365-filtering-correlation-id: a03e8ce5-f47c-4ea6-a7f1-08d68ac24872 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600110)(711020)(4605077)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM0PR04MB4148; x-ms-traffictypediagnostic: AM0PR04MB4148: x-microsoft-antispam-prvs: x-forefront-prvs: 0938781D02 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(346002)(376002)(39860400002)(396003)(136003)(199004)(189003)(97736004)(36756003)(2906002)(54906003)(110136005)(102836004)(2501003)(186003)(6506007)(52116002)(76176011)(99286004)(316002)(26005)(256004)(14444005)(68736007)(2616005)(11346002)(476003)(486006)(446003)(4326008)(53936002)(6512007)(7736002)(81166006)(305945005)(386003)(50226002)(81156014)(8676002)(14454004)(25786009)(478600001)(6666004)(105586002)(66066001)(71200400001)(71190400001)(6436002)(6486002)(86362001)(106356001)(8936002)(6116002)(3846002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB4148; H:AM0PR04MB4994.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: K38zmU5qkw3OsY6SmqDcUhBRxYhe1CFTH6Q6dVQYZk6wT7XDkOBz9WwJzrtItMlMuYjYxrl6N8VieFQGNfwGM284g1NgmAPXimnznvlEEE1Jff0mqX/5dUPltVe0YP4AYObnMxDAEBFVvHtYz/erfoauNH4sq/Sq4+XawFe12+jDJcxrNgLZo2rZsfxTw0fGmJ6aE+iQb7QA72T6GzoOI7pcbJ9cRmEHKdbrs264PqpVUUYNe9IcLJzj8TYSJY1Gz7Rik9U0Agqw1FgID8U6V0Xg0U2XBwTHkqTidZ9doAqA59O1CIrgAfFD5sW/2iXdisbmvHmbYXXWDYsclmRSCxcMvzJYMRuh6jGUGsZvTLsp974z6SK12mucCnXxnASQaG+50cJu1wBgJ6B26nW1EPs3J3bQbeSxS/1p7QmtcTI= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a03e8ce5-f47c-4ea6-a7f1-08d68ac24872 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Feb 2019 17:00:35.9713 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4148 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Starting with MC10.14.0, dpaa2_io_service_enqueue_fq() API is functional. Since there are a number of cases where it offers better performance compared to the currently used enqueue function, switch to it for firmware versions that support it. Signed-off-by: Ioana Radulescu --- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 41 ++++++++++++++++++++---- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h | 4 +++ 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c index 3bc5437..87777b0 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -264,9 +264,7 @@ static int xdp_enqueue(struct dpaa2_eth_priv *priv, struct dpaa2_fd *fd, fq = &priv->fq[queue_id]; for (i = 0; i < DPAA2_ETH_ENQUEUE_RETRIES; i++) { - err = dpaa2_io_service_enqueue_qd(fq->channel->dpio, - priv->tx_qdid, 0, - fq->tx_qdbin, fd); + err = priv->enqueue(priv, fq, fd, 0); if (err != -EBUSY) break; } @@ -785,9 +783,7 @@ static netdev_tx_t dpaa2_eth_tx(struct sk_buff *skb, struct net_device *net_dev) queue_mapping = skb_get_queue_mapping(skb); fq = &priv->fq[queue_mapping]; for (i = 0; i < DPAA2_ETH_ENQUEUE_RETRIES; i++) { - err = dpaa2_io_service_enqueue_qd(fq->channel->dpio, - priv->tx_qdid, 0, - fq->tx_qdbin, &fd); + err = priv->enqueue(priv, fq, &fd, 0); if (err != -EBUSY) break; } @@ -2205,6 +2201,36 @@ static int set_buffer_layout(struct dpaa2_eth_priv *priv) return 0; } +#define DPNI_ENQUEUE_FQID_VER_MAJOR 7 +#define DPNI_ENQUEUE_FQID_VER_MINOR 9 + +static inline int dpaa2_eth_enqueue_qd(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_fq *fq, + struct dpaa2_fd *fd, u8 prio) +{ + return dpaa2_io_service_enqueue_qd(fq->channel->dpio, + priv->tx_qdid, prio, + fq->tx_qdbin, fd); +} + +static inline int dpaa2_eth_enqueue_fq(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_fq *fq, + struct dpaa2_fd *fd, + u8 prio __always_unused) +{ + return dpaa2_io_service_enqueue_fq(fq->channel->dpio, + fq->tx_fqid, fd); +} + +static void set_enqueue_mode(struct dpaa2_eth_priv *priv) +{ + if (dpaa2_eth_cmp_dpni_ver(priv, DPNI_ENQUEUE_FQID_VER_MAJOR, + DPNI_ENQUEUE_FQID_VER_MINOR) < 0) + priv->enqueue = dpaa2_eth_enqueue_qd; + else + priv->enqueue = dpaa2_eth_enqueue_fq; +} + /* Configure the DPNI object this interface is associated with */ static int setup_dpni(struct fsl_mc_device *ls_dev) { @@ -2258,6 +2284,8 @@ static int setup_dpni(struct fsl_mc_device *ls_dev) if (err) goto close; + set_enqueue_mode(priv); + priv->cls_rules = devm_kzalloc(dev, sizeof(struct dpaa2_eth_cls_rule) * dpaa2_eth_fs_count(priv), GFP_KERNEL); if (!priv->cls_rules) @@ -2342,6 +2370,7 @@ static int setup_tx_flow(struct dpaa2_eth_priv *priv, } fq->tx_qdbin = qid.qdbin; + fq->tx_fqid = qid.fqid; err = dpni_get_queue(priv->mc_io, 0, priv->mc_token, DPNI_QUEUE_TX_CONFIRM, 0, fq->flowid, diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h index da3d039..3e29dec 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h @@ -276,6 +276,7 @@ struct dpaa2_eth_priv; struct dpaa2_eth_fq { u32 fqid; u32 tx_qdbin; + u32 tx_fqid; u16 flowid; int target_cpu; u32 dq_frames; @@ -328,6 +329,9 @@ struct dpaa2_eth_priv { u8 num_fqs; struct dpaa2_eth_fq fq[DPAA2_ETH_MAX_QUEUES]; + int (*enqueue)(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_fq *fq, + struct dpaa2_fd *fd, u8 prio); u8 num_channels; struct dpaa2_eth_channel *channel[DPAA2_ETH_MAX_DPCONS];