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 0257A42606 for ; Thu, 21 Sep 2023 10:35:40 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CBA1040A81; Thu, 21 Sep 2023 10:35:39 +0200 (CEST) Received: from BN3PR00CU001.outbound.protection.outlook.com (mail-eastus2azon11020022.outbound.protection.outlook.com [52.101.56.22]) by mails.dpdk.org (Postfix) with ESMTP id C565C40A79; Thu, 21 Sep 2023 10:35:38 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kARQFq+oCVq2AyYBcP16QHApsDjMgRY5lloCP96r6RxuQ1Tdu2WWss6L/Fa4MlSSecKVD/CToBHZq6pgn5w5Bgyfn1c6uZWXdXy9/oA9VgtHExHtp+7QsqNCywcs2pIur9185IzZu26JHz7x6CRou07qrO9gRKArmfMVysoHOG7T2WEAbv3EjshM5S+Q8iVBq5y63w0WOOtfOrYpYZ953xuJKHROveWN/SPbwMdmVCxzastOdHfg1Wo7h76JTIgzvvgUe1JPBeGkF26dA0sP/wIWxj+IqXEAOFRn2Jyv6CJLVn1ZSYN6PEQ8bUDWJ+Ai2B61txHbFAYnZ7S6B+0Fgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yucAq9XOa+q+ZquQ7NqHPYIRDTI8EqsyjtoE/GGfqU4=; b=GUXB6GgXeA596lN8E7YP6nvr+DFqwCTDDwNRa3gcr7R1yqyuwOXKW5a/ju3mBNhlRTNFIJzR66bRWWmoE2x6C7g8Tcg/WTEyEDa1MFiJXafKNJVjwBUAU82DbPI3LWeqmt/rfLQV1+dRpw+rv3Nc7yR8foYEAwPjUyVpfOcCpkwTlo4cIZO7eSJo23p5sC7N7aIJUGEk1ZOVS6rBwP6aHHG4FM2tEgetiOrs50TmSp3kXpRbg3VkKkJ6dg9PlGsyd+2xEvq83vdJywRMc0qBiTP9qiwycqxMPnQ8T6Jjp7FMmfVaujQSFsHKZEYXpNX/vKJzg/RVpieBdGs4ekglWA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yucAq9XOa+q+ZquQ7NqHPYIRDTI8EqsyjtoE/GGfqU4=; b=IhAYltcNfqxFckxF+ZhYOxjyV/r20NCV36aZu92YtTex6PEthJsgL4HKGbKxz6bA4qD6NVCAoaHGd+xKiQ2eo06F8+GmBpH4PGyJSu1L5b1i9BJIeN60AU7nEm/UMjS3rrq9PnlJ81n4el/ogFkgFlE8mjZhabfKS/D2Dur5zRA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; Received: from MN2PR21MB1454.namprd21.prod.outlook.com (2603:10b6:208:208::11) by LV2PR21MB3086.namprd21.prod.outlook.com (2603:10b6:408:17c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.4; Thu, 21 Sep 2023 08:35:36 +0000 Received: from MN2PR21MB1454.namprd21.prod.outlook.com ([fe80::cbd6:26c1:4d57:b9fc]) by MN2PR21MB1454.namprd21.prod.outlook.com ([fe80::cbd6:26c1:4d57:b9fc%5]) with mapi id 15.20.6838.010; Thu, 21 Sep 2023 08:35:36 +0000 From: Wei Hu To: dev@dpdk.org, ferruh.yigit@amd.com, ktraynor@redhat.com, xuemingl@nvidia.com, bluca@debian.org, Long Li Cc: Wei Hu , stable@dpdk.org Subject: [PATCH 2/2] net/mana: add 32 bit short doorbell Date: Thu, 21 Sep 2023 08:34:42 +0000 Message-Id: <20230921083442.2104530-3-weh@microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230921083442.2104530-1-weh@microsoft.com> References: <20230921083442.2104530-1-weh@microsoft.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: PH0P220CA0020.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:d3::34) To MN2PR21MB1454.namprd21.prod.outlook.com (2603:10b6:208:208::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR21MB1454:EE_|LV2PR21MB3086:EE_ X-MS-Office365-Filtering-Correlation-Id: a55f3314-4a88-4e46-fd89-08dbba7dba76 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +KvJ6EgLTVsNaxjQjmLuZ5+5x/l3mih0ZLZqBj6rgOFoW+BGMlEsmk21rkZi88ALfgdpyjgdHmPVH/EAcqLyVumeUilfxbpnqOQL9gzeb6Yak4nfY0CjwqJau3OPgMnzB/zp3jwnJWIgyIiPUt/r1phedfR9WYZgbeMNJzuoAiOTxr2LDwvsvuEtT8lvtYdv13eHZumkblN9kjTniiWBfdSy6FiZGIlG28Aq/Bdtm98XzEu2e88wFKgpx+qyhvMuLHJ463iKMobkjj9xb10WLgwzOiRf/vxeAetJJukZiptNHSaDh48AtulWzATzrxf+Gr5coF7/vO1ZmlkzshJSupFy8swG2J1aiv5UTxGdwP4MTinazzuqRusA+VFJMrj1jUylQTjozBnPdVlkV1yDF/+mw610gGyjztt/69RZxlhJkExAGvqC2d+s0PlsItjsNRKzH9o9JJQhHSWkVFlKPNY1T/HPA1m7KWkOo+uesD9NTbjiULd3YaFqO22WMjwtVxgMTtatZO+DVUir/dcZZvDDjJkotSu6qpVgkQIa3ShCYSpcJI0ff3cCLi5/rxuodvfUWIc+URjVeDUNJcXU0AkATS9tjMv1MxfyuAzkYJEPYtaNd/RBof5VgFHURJ9mraNjCGQPXEYaUPatt0pDTJqptiKD97YlhYPfdO6aNk4= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR21MB1454.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(396003)(366004)(39860400002)(376002)(346002)(186009)(451199024)(1800799009)(36756003)(86362001)(8676002)(26005)(66946007)(82950400001)(37006003)(38350700002)(478600001)(82960400001)(10290500003)(38100700002)(8936002)(41300700001)(6636002)(316002)(6506007)(2616005)(6512007)(52116002)(6666004)(66556008)(1076003)(4326008)(66476007)(2906002)(6862004)(6486002)(83380400001)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?DwvqOxan3wlnHRXpuPkfjllPNIAyh7BXSWeb4G+qbVm8EgjGdhDCAIUBd1yw?= =?us-ascii?Q?3nNEo7rtkVuDuJDI4Cp0UsrO+S1VkLS+SQe6gHr/cke7ANDHyBXPpo4uCy69?= =?us-ascii?Q?mgwFsYP+WNqqqWrGJEonF+MwV9OEWRDG1zx8yJiFc3l99bUdpKZ2MA7IZ6/5?= =?us-ascii?Q?KU1xz1131O1yFJci0aXOocC0/yKX+t+SCK6tg/YIv5tiH6WQlKo2btAZ+eR6?= =?us-ascii?Q?15GBCV9k9dXLuDPxI9coBSsgj1PJe0prm9KylO91ThyHzpRakgsfQ9m1k8Lc?= =?us-ascii?Q?b5qKzFK6o/63fk9T4Co/uRvovzeTqBpfziLgNetk6XVYluyBWYk+JEBH+h4x?= =?us-ascii?Q?okkiv5eCeOn0mI+3sq46kN0JrAGwtVfj0LjOhEvID0J4MjkeVi2EEluWbGoN?= =?us-ascii?Q?m98MjDUEkQ/vGAOLH7UQOIYaOx5PahEmtddIeaI9PDHvrdcnW5ZQNbwkRdgZ?= =?us-ascii?Q?wPUg2lqSEPb1yKdnFNTpZhu67KUE6d9so0Foe9taebJyxM4FQJyXSjmixrrP?= =?us-ascii?Q?8pQDWeAIZ9F5du1FHUxXGriitPT+u1doQygk+Xv4EIrW53IpSiqrHeBKi/HV?= =?us-ascii?Q?vEZH9OMk31CmC2x+fSPTvo2EituyycoWNCGgqg8EQ893FM5W5vLwFRv7i2aN?= =?us-ascii?Q?gCxmvvYcwxKtL6en6LewWhAdV+vWIpUojU1ZO04xo0ar6iF+Q6FIF9AchdnQ?= =?us-ascii?Q?UAcxnAnZoG5x/vkLZrgOU+siXjGbjgo0ryD9c316jJfxbkXLjdtSwP2W5zjt?= =?us-ascii?Q?fnNUD5MwYh4ruQZDRZuYUFNtkNtGLCqzh3dKB0zK5jP0KTgW/LVX44FGrgG2?= =?us-ascii?Q?os1UvsOXA1806w3N0UOHRJ0jaBJpoD7IrD1yKXu2wyFA5HbJKMq/HkvPtVUc?= =?us-ascii?Q?OPkvRKPK95TmfIn6v1tIlRTsy1pXjQTws9J248dqHAFthQiA8CQLjBCx2I1v?= =?us-ascii?Q?C4efbc5bPTd/LjXzIB77mU3uttKTkfAZ+Dtj9jmEOICnoy5v6pEgXNGebxmp?= =?us-ascii?Q?Y+fP8bsE4pHRfhsqf0EiGzKGQFa3d0QOmvKWEs7obHF7bXOgjcEUpjXUu8TP?= =?us-ascii?Q?SIu1YLlbFVauegXhDeZVMKoSoJPy1l27XGEJKhdJBuI/JJ4vXU7wJK7lMo87?= =?us-ascii?Q?2WKmRsJjKfaAB8TXK+tGuuRkYaavBNxVVw83RvsD/S2PX0ctdgwlizj+X1yz?= =?us-ascii?Q?UQGzxX6R86Lccl7ZdCSeL+0/1qkvuLznvg7fV8N22q+cs/oRrGwI9sF33zcL?= =?us-ascii?Q?yHjw0gGLYu+14A4GYfR9zB2p3mZzMsS3v5cIYO4/KsuAbyQdSQC6R38tEp9k?= =?us-ascii?Q?QP3G8nbnlVwCG9roRCCzgfaiEjgIQXzP8QFASAH7IETNAm3CYDW/kcDPBnQX?= =?us-ascii?Q?+heKr91oLlzlXAmHJSvsqUcNdiRPZXEXc4Sv2xn2rWofRAdC88KYs1O2Atdb?= =?us-ascii?Q?6WpWr/NE7AsCGnmax7KBW6O8dC385IFCgEHA1TSvgrWQA8FV+eHLJbL0MF+7?= =?us-ascii?Q?pD/gEeZJaURKiH6yWbih4uSGxKtIi277sS+AIAnrAY8EvklfjJTDFtN3kxu2?= =?us-ascii?Q?ay/ZTz4X5YfqQQllxOWJM0YNY1n0PbYBfoHnhha0?= X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: a55f3314-4a88-4e46-fd89-08dbba7dba76 X-MS-Exchange-CrossTenant-AuthSource: MN2PR21MB1454.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2023 08:35:36.6254 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: alQ19dq0ZELTx3VMEVUQSWKBaMFUDy721xNV8A4Sd6DBtOkUi573NvKPBL4/KI0j3D15xIoT7StWv+bWzCqcXw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR21MB3086 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Add 32 bit short doorbell support. Ring short doorbell when running in 32 bit applicactions. Both 32 bit and 64 bit doorbells are supported by mana hardware on same platform. 32 bit applications cannot use 64 bit doorbells. 64 bit applications can use 32 bit doorbells, however the performance would greatly suffer and it is not recommended. Cc: stable@dpdk.org Signed-off-by: Wei Hu --- drivers/net/mana/gdma.c | 92 +++++++++++++++++++++++++++++++++++++++++ drivers/net/mana/mana.h | 26 ++++++++++++ drivers/net/mana/rx.c | 45 ++++++++++++++++++++ drivers/net/mana/tx.c | 25 +++++++++++ 4 files changed, 188 insertions(+) diff --git a/drivers/net/mana/gdma.c b/drivers/net/mana/gdma.c index 65685fe236..7f66a7a7cf 100644 --- a/drivers/net/mana/gdma.c +++ b/drivers/net/mana/gdma.c @@ -166,6 +166,97 @@ gdma_post_work_request(struct mana_gdma_queue *queue, return 0; } +#ifdef RTE_ARCH_32 +union gdma_short_doorbell_entry { + uint32_t as_uint32; + + struct { + uint32_t tail_ptr_incr : 16; /* Number of CQEs */ + uint32_t id : 12; + uint32_t reserved : 3; + uint32_t arm : 1; + } cq; + + struct { + uint32_t tail_ptr_incr : 16; /* In number of bytes */ + uint32_t id : 12; + uint32_t reserved : 4; + } rq; + + struct { + uint32_t tail_ptr_incr : 16; /* In number of bytes */ + uint32_t id : 12; + uint32_t reserved : 4; + } sq; + + struct { + uint32_t tail_ptr_incr : 16; /* Number of EQEs */ + uint32_t id : 12; + uint32_t reserved : 3; + uint32_t arm : 1; + } eq; +}; /* HW DATA */ + +enum { + DOORBELL_SHORT_OFFSET_SQ = 0x10, + DOORBELL_SHORT_OFFSET_RQ = 0x410, + DOORBELL_SHORT_OFFSET_CQ = 0x810, + DOORBELL_SHORT_OFFSET_EQ = 0xFF0, +}; + +/* + * Write to hardware doorbell to notify new activity. + */ +int +mana_ring_short_doorbell(void *db_page, enum gdma_queue_types queue_type, + uint32_t queue_id, uint32_t tail_incr, uint8_t arm) +{ + uint8_t *addr = db_page; + union gdma_short_doorbell_entry e = {}; + + if ((queue_id & ~GDMA_SHORT_DB_QID_MASK) || + (tail_incr & ~GDMA_SHORT_DB_INC_MASK)) { + DP_LOG(ERR, "%s: queue_id %u or " + "tail_incr %u overflowed, queue type %d", + __func__, queue_id, tail_incr, queue_type); + return -EINVAL; + } + + switch (queue_type) { + case GDMA_QUEUE_SEND: + e.sq.id = queue_id; + e.sq.tail_ptr_incr = tail_incr; + addr += DOORBELL_SHORT_OFFSET_SQ; + break; + + case GDMA_QUEUE_RECEIVE: + e.rq.id = queue_id; + e.rq.tail_ptr_incr = tail_incr; + addr += DOORBELL_SHORT_OFFSET_RQ; + break; + + case GDMA_QUEUE_COMPLETION: + e.cq.id = queue_id; + e.cq.tail_ptr_incr = tail_incr; + e.cq.arm = arm; + addr += DOORBELL_SHORT_OFFSET_CQ; + break; + + default: + DP_LOG(ERR, "Unsupported queue type %d", queue_type); + return -1; + } + + /* Ensure all writes are done before ringing doorbell */ + rte_wmb(); + + DP_LOG(DEBUG, "db_page %p addr %p queue_id %u type %u tail %u arm %u", + db_page, addr, queue_id, queue_type, tail_incr, arm); + + rte_write32(e.as_uint32, addr); + return 0; +} +#else union gdma_doorbell_entry { uint64_t as_uint64; @@ -248,6 +339,7 @@ mana_ring_doorbell(void *db_page, enum gdma_queue_types queue_type, rte_write64(e.as_uint64, addr); return 0; } +#endif /* * Poll completion queue for completions. diff --git a/drivers/net/mana/mana.h b/drivers/net/mana/mana.h index 5801491d75..74e37706be 100644 --- a/drivers/net/mana/mana.h +++ b/drivers/net/mana/mana.h @@ -50,6 +50,21 @@ struct mana_shared_data { #define MAX_TX_WQE_SIZE 512 #define MAX_RX_WQE_SIZE 256 +/* For 32 bit only */ +#ifdef RTE_ARCH_32 +#define GDMA_SHORT_DB_INC_MASK 0xffff +#define GDMA_SHORT_DB_QID_MASK 0xfff + +#define GDMA_SHORT_DB_MAX_WQE (0x10000 / GDMA_WQE_ALIGNMENT_UNIT_SIZE) + +#define TX_WQE_SHORT_DB_THRESHOLD \ + (GDMA_SHORT_DB_MAX_WQE - \ + (MAX_TX_WQE_SIZE / GDMA_WQE_ALIGNMENT_UNIT_SIZE)) +#define RX_WQE_SHORT_DB_THRESHOLD \ + (GDMA_SHORT_DB_MAX_WQE - \ + (MAX_RX_WQE_SIZE / GDMA_WQE_ALIGNMENT_UNIT_SIZE)) +#endif + /* Values from the GDMA specification document, WQE format description */ #define INLINE_OOB_SMALL_SIZE_IN_BYTES 8 #define INLINE_OOB_LARGE_SIZE_IN_BYTES 24 @@ -425,6 +440,11 @@ struct mana_rxq { */ uint32_t desc_ring_head, desc_ring_tail; +#ifdef RTE_ARCH_32 + /* For storing wqe increment count btw each short doorbell ring */ + uint32_t wqe_cnt_to_short_db; +#endif + struct mana_gdma_queue gdma_rq; struct mana_gdma_queue gdma_cq; struct gdma_comp *gdma_comp_buf; @@ -455,8 +475,14 @@ extern int mana_logtype_init; #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") +#ifdef RTE_ARCH_32 +int mana_ring_short_doorbell(void *db_page, enum gdma_queue_types queue_type, + uint32_t queue_id, uint32_t tail_incr, + uint8_t arm); +#else int mana_ring_doorbell(void *db_page, enum gdma_queue_types queue_type, uint32_t queue_id, uint32_t tail, uint8_t arm); +#endif int mana_rq_ring_doorbell(struct mana_rxq *rxq); int gdma_post_work_request(struct mana_gdma_queue *queue, diff --git a/drivers/net/mana/rx.c b/drivers/net/mana/rx.c index 14d9085801..fc1587e206 100644 --- a/drivers/net/mana/rx.c +++ b/drivers/net/mana/rx.c @@ -39,10 +39,18 @@ mana_rq_ring_doorbell(struct mana_rxq *rxq) /* Hardware Spec specifies that software client should set 0 for * wqe_cnt for Receive Queues. */ +#ifdef RTE_ARCH_32 + ret = mana_ring_short_doorbell(db_page, GDMA_QUEUE_RECEIVE, + rxq->gdma_rq.id, + rxq->wqe_cnt_to_short_db * + GDMA_WQE_ALIGNMENT_UNIT_SIZE, + 0); +#else ret = mana_ring_doorbell(db_page, GDMA_QUEUE_RECEIVE, rxq->gdma_rq.id, rxq->gdma_rq.head * GDMA_WQE_ALIGNMENT_UNIT_SIZE, 0); +#endif if (ret) DP_LOG(ERR, "failed to ring RX doorbell ret %d", ret); @@ -97,6 +105,9 @@ mana_alloc_and_post_rx_wqe(struct mana_rxq *rxq) /* update queue for tracking pending packets */ desc->pkt = mbuf; desc->wqe_size_in_bu = wqe_size_in_bu; +#ifdef RTE_ARCH_32 + rxq->wqe_cnt_to_short_db += wqe_size_in_bu; +#endif rxq->desc_ring_head = (rxq->desc_ring_head + 1) % rxq->num_desc; } else { DP_LOG(DEBUG, "failed to post recv ret %d", ret); @@ -115,12 +126,22 @@ mana_alloc_and_post_rx_wqes(struct mana_rxq *rxq) int ret; uint32_t i; +#ifdef RTE_ARCH_32 + rxq->wqe_cnt_to_short_db = 0; +#endif for (i = 0; i < rxq->num_desc; i++) { ret = mana_alloc_and_post_rx_wqe(rxq); if (ret) { DP_LOG(ERR, "failed to post RX ret = %d", ret); return ret; } + +#ifdef RTE_ARCH_32 + if (rxq->wqe_cnt_to_short_db > RX_WQE_SHORT_DB_THRESHOLD) { + mana_rq_ring_doorbell(rxq); + rxq->wqe_cnt_to_short_db = 0; + } +#endif } mana_rq_ring_doorbell(rxq); @@ -397,6 +418,10 @@ mana_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n) uint32_t i; int polled = 0; +#ifdef RTE_ARCH_32 + rxq->wqe_cnt_to_short_db = 0; +#endif + repoll: /* Polling on new completions if we have no backlog */ if (rxq->comp_buf_idx == rxq->comp_buf_len) { @@ -505,6 +530,16 @@ mana_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n) wqe_posted++; if (pkt_received == pkts_n) break; + +#ifdef RTE_ARCH_32 + /* Ring short doorbell if approaching the wqe increment + * limit. + */ + if (rxq->wqe_cnt_to_short_db > RX_WQE_SHORT_DB_THRESHOLD) { + mana_rq_ring_doorbell(rxq); + rxq->wqe_cnt_to_short_db = 0; + } +#endif } rxq->backlog_idx = pkt_idx; @@ -525,6 +560,15 @@ mana_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n) return pkt_received; } +#ifdef RTE_ARCH_32 +static int +mana_arm_cq(struct mana_rxq *rxq __rte_unused, uint8_t arm __rte_unused) +{ + DP_LOG(ERR, "Do not support in 32 bit"); + + return -ENODEV; +} +#else static int mana_arm_cq(struct mana_rxq *rxq, uint8_t arm) { @@ -538,6 +582,7 @@ mana_arm_cq(struct mana_rxq *rxq, uint8_t arm) return mana_ring_doorbell(priv->db_page, GDMA_QUEUE_COMPLETION, rxq->gdma_cq.id, head, arm); } +#endif int mana_rx_intr_enable(struct rte_eth_dev *dev, uint16_t rx_queue_id) diff --git a/drivers/net/mana/tx.c b/drivers/net/mana/tx.c index 11ba2ee1ac..1e2508e1f2 100644 --- a/drivers/net/mana/tx.c +++ b/drivers/net/mana/tx.c @@ -176,6 +176,9 @@ mana_tx_burst(void *dpdk_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) void *db_page; uint16_t pkt_sent = 0; uint32_t num_comp, i; +#ifdef RTE_ARCH_32 + uint32_t wqe_count = 0; +#endif /* Process send completions from GDMA */ num_comp = gdma_poll_completion_queue(&txq->gdma_cq, @@ -418,6 +421,20 @@ mana_tx_burst(void *dpdk_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) DP_LOG(DEBUG, "nb_pkts %u pkt[%d] sent", nb_pkts, pkt_idx); +#ifdef RTE_ARCH_32 + wqe_count += wqe_size_in_bu; + if (wqe_count > TX_WQE_SHORT_DB_THRESHOLD) { + /* wqe_count approaching to short doorbell + * increment limit. Stop processing further + * more packets and just ring short + * doorbell. + */ + DP_LOG(DEBUG, "wqe_count %u reaching limit, " + "pkt_sent %d", + wqe_count, pkt_sent); + break; + } +#endif } else { DP_LOG(DEBUG, "pkt[%d] failed to post send ret %d", pkt_idx, ret); @@ -436,11 +453,19 @@ mana_tx_burst(void *dpdk_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) } if (pkt_sent) { +#ifdef RTE_ARCH_32 + ret = mana_ring_short_doorbell(db_page, GDMA_QUEUE_SEND, + txq->gdma_sq.id, + wqe_count * + GDMA_WQE_ALIGNMENT_UNIT_SIZE, + 0); +#else ret = mana_ring_doorbell(db_page, GDMA_QUEUE_SEND, txq->gdma_sq.id, txq->gdma_sq.head * GDMA_WQE_ALIGNMENT_UNIT_SIZE, 0); +#endif if (ret) DP_LOG(ERR, "mana_ring_doorbell failed ret %d", ret); } -- 2.34.1