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 ABAE4A0350 for ; Mon, 21 Feb 2022 16:43:16 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9A05441150; Mon, 21 Feb 2022 16:43:15 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 1D32040E5A for ; Mon, 21 Feb 2022 16:43:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645458193; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rVBTtUq8NLL9/zi7EeZG3MTXxhXIqKSGX6hWqeNZeeg=; b=e8bc+ID89T0IcL0wjgmJKvbiIAknLS9UmCK0rLRpynXglfVlmYWf8i3Ag0G+JN/CXuZRKo Lz14Use1R4dgV96CREtOn9iz9yMQzik1RE2ShS+dz/GVLEpypxpmwUmKzumT6w++MJjmfX EsLlIdrw3Rmg8XMphDDxnhwKdAJ+UW8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-358-1asyTLMmN5uCbb0r7AgLYQ-1; Mon, 21 Feb 2022 10:43:08 -0500 X-MC-Unique: 1asyTLMmN5uCbb0r7AgLYQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F14971853028; Mon, 21 Feb 2022 15:43:06 +0000 (UTC) Received: from rh.Home (unknown [10.39.195.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id E28157E133; Mon, 21 Feb 2022 15:43:05 +0000 (UTC) From: Kevin Traynor To: Jiawen Wu Cc: dpdk stable Subject: patch 'net/ngbe: fix Rx by initializing packet buffer early' has been queued to stable release 21.11.1 Date: Mon, 21 Feb 2022 15:36:08 +0000 Message-Id: <20220221153625.152324-179-ktraynor@redhat.com> In-Reply-To: <20220221153625.152324-1-ktraynor@redhat.com> References: <20220221153625.152324-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" 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 Hi, FYI, your patch has been queued to stable release 21.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/26/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/cacbd7e4f7b4563fd62f4dd0c3ecdd1ea20bc2e8 Thanks. Kevin --- >From cacbd7e4f7b4563fd62f4dd0c3ecdd1ea20bc2e8 Mon Sep 17 00:00:00 2001 From: Jiawen Wu Date: Wed, 9 Feb 2022 18:42:02 +0800 Subject: [PATCH] net/ngbe: fix Rx by initializing packet buffer early [ upstream commit ccdeca8e98afa33721a70b90cb208472c39d3c77 ] Initialize Rx packet buffer before starting RxTx, ensure to receive packets. Fixes: 62fc35e63d0e ("net/ngbe: support Rx queue start/stop") Signed-off-by: Jiawen Wu --- drivers/net/ngbe/base/ngbe_dummy.h | 4 ++++ drivers/net/ngbe/base/ngbe_hw.c | 27 +++++++++++++++++++++++++++ drivers/net/ngbe/base/ngbe_hw.h | 2 ++ drivers/net/ngbe/base/ngbe_type.h | 7 +++++++ drivers/net/ngbe/ngbe_ethdev.c | 1 + 5 files changed, 41 insertions(+) diff --git a/drivers/net/ngbe/base/ngbe_dummy.h b/drivers/net/ngbe/base/ngbe_dummy.h index 61b0d82bfb..d74c9f7b54 100644 --- a/drivers/net/ngbe/base/ngbe_dummy.h +++ b/drivers/net/ngbe/base/ngbe_dummy.h @@ -115,4 +115,7 @@ static inline s32 ngbe_mac_get_link_capabilities_dummy(struct ngbe_hw *TUP0, return NGBE_ERR_OPS_DUMMY; } +static inline void ngbe_setup_pba_dummy(struct ngbe_hw *TUP0) +{ +} static inline s32 ngbe_mac_led_on_dummy(struct ngbe_hw *TUP0, u32 TUP1) { @@ -299,4 +302,5 @@ static inline void ngbe_init_ops_dummy(struct ngbe_hw *hw) hw->mac.check_link = ngbe_mac_check_link_dummy; hw->mac.get_link_capabilities = ngbe_mac_get_link_capabilities_dummy; + hw->mac.setup_pba = ngbe_setup_pba_dummy; hw->mac.led_on = ngbe_mac_led_on_dummy; hw->mac.led_off = ngbe_mac_led_off_dummy; diff --git a/drivers/net/ngbe/base/ngbe_hw.c b/drivers/net/ngbe/base/ngbe_hw.c index 0716357725..0b22ea0fb3 100644 --- a/drivers/net/ngbe/base/ngbe_hw.c +++ b/drivers/net/ngbe/base/ngbe_hw.c @@ -1610,4 +1610,28 @@ void ngbe_set_mac_anti_spoofing(struct ngbe_hw *hw, bool enable, int vf) } +/** + * ngbe_set_pba - Initialize Rx packet buffer + * @hw: pointer to hardware structure + * @headroom: reserve n KB of headroom + **/ +void ngbe_set_pba(struct ngbe_hw *hw) +{ + u32 rxpktsize = hw->mac.rx_pb_size; + u32 txpktsize, txpbthresh; + + /* Reserve 256 KB of headroom */ + rxpktsize -= 256; + + rxpktsize <<= 10; + wr32(hw, NGBE_PBRXSIZE, rxpktsize); + + /* Only support an equally distributed Tx packet buffer strategy. */ + txpktsize = NGBE_PBTXSIZE_MAX; + txpbthresh = (txpktsize / 1024) - NGBE_TXPKT_SIZE_MAX; + + wr32(hw, NGBE_PBTXSIZE, txpktsize); + wr32(hw, NGBE_PBTXDMATH, txpbthresh); +} + /** * ngbe_set_vlan_anti_spoofing - Enable/Disable VLAN anti-spoofing @@ -1908,4 +1932,6 @@ s32 ngbe_init_ops_pf(struct ngbe_hw *hw) mac->setup_link = ngbe_setup_mac_link_em; + mac->setup_pba = ngbe_set_pba; + /* Manageability interface */ mac->init_thermal_sensor_thresh = ngbe_init_thermal_sensor_thresh; @@ -1929,4 +1955,5 @@ s32 ngbe_init_ops_pf(struct ngbe_hw *hw) mac->vft_size = NGBE_EM_VFT_TBL_SIZE; mac->num_rar_entries = NGBE_EM_RAR_ENTRIES; + mac->rx_pb_size = NGBE_EM_RX_PB_SIZE; mac->max_rx_queues = NGBE_EM_MAX_RX_QUEUES; mac->max_tx_queues = NGBE_EM_MAX_TX_QUEUES; diff --git a/drivers/net/ngbe/base/ngbe_hw.h b/drivers/net/ngbe/base/ngbe_hw.h index ad7e8fc2d9..b32cf87ff4 100644 --- a/drivers/net/ngbe/base/ngbe_hw.h +++ b/drivers/net/ngbe/base/ngbe_hw.h @@ -14,4 +14,5 @@ #define NGBE_EM_MC_TBL_SIZE 32 #define NGBE_EM_VFT_TBL_SIZE 128 +#define NGBE_EM_RX_PB_SIZE 42 /*KB*/ s32 ngbe_init_hw(struct ngbe_hw *hw); @@ -45,4 +46,5 @@ s32 ngbe_update_mc_addr_list(struct ngbe_hw *hw, u8 *mc_addr_list, s32 ngbe_disable_sec_rx_path(struct ngbe_hw *hw); s32 ngbe_enable_sec_rx_path(struct ngbe_hw *hw); +void ngbe_set_pba(struct ngbe_hw *hw); s32 ngbe_setup_fc_em(struct ngbe_hw *hw); diff --git a/drivers/net/ngbe/base/ngbe_type.h b/drivers/net/ngbe/base/ngbe_type.h index 12847b7272..269e087d50 100644 --- a/drivers/net/ngbe/base/ngbe_type.h +++ b/drivers/net/ngbe/base/ngbe_type.h @@ -12,4 +12,7 @@ #define NGBE_FRAME_SIZE_DFT (1522) /* Default frame size, +FCS */ #define NGBE_NUM_POOL (32) +#define NGBE_PBRXSIZE_MAX 0x00080000 /* 512KB Packet Buffer */ +#define NGBE_PBTXSIZE_MAX 0x00005000 /* 20KB Packet Buffer */ +#define NGBE_TXPKT_SIZE_MAX 0xA /* Max Tx Packet size */ #define NGBE_MAX_QP (8) #define NGBE_MAX_UTA 128 @@ -270,4 +273,7 @@ struct ngbe_mac_info { u32 *speed, bool *autoneg); + /* Packet Buffer manipulation */ + void (*setup_pba)(struct ngbe_hw *hw); + /* LED */ s32 (*led_on)(struct ngbe_hw *hw, u32 index); @@ -312,4 +318,5 @@ struct ngbe_mac_info { u32 vft_size; u32 num_rar_entries; + u32 rx_pb_size; u32 max_tx_queues; u32 max_rx_queues; diff --git a/drivers/net/ngbe/ngbe_ethdev.c b/drivers/net/ngbe/ngbe_ethdev.c index 0d66c32551..180489ce38 100644 --- a/drivers/net/ngbe/ngbe_ethdev.c +++ b/drivers/net/ngbe/ngbe_ethdev.c @@ -1005,4 +1005,5 @@ ngbe_dev_start(struct rte_eth_dev *dev) } + hw->mac.setup_pba(hw); ngbe_configure_port(dev); -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-02-21 15:22:48.418091256 +0000 +++ 0179-net-ngbe-fix-Rx-by-initializing-packet-buffer-early.patch 2022-02-21 15:22:44.353704716 +0000 @@ -1 +1 @@ -From ccdeca8e98afa33721a70b90cb208472c39d3c77 Mon Sep 17 00:00:00 2001 +From cacbd7e4f7b4563fd62f4dd0c3ecdd1ea20bc2e8 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit ccdeca8e98afa33721a70b90cb208472c39d3c77 ] + @@ -10 +11,0 @@ -Cc: stable@dpdk.org