!375 [sync] PR-373: support flow control autoneg for fiber port
From: @openeuler-sync-bot Reviewed-by: @li-huisong Signed-off-by: @li-huisong
This commit is contained in:
commit
3fc7a9e6b1
224
0285-net-hns3-simplify-hardware-checksum-offloading.patch
Normal file
224
0285-net-hns3-simplify-hardware-checksum-offloading.patch
Normal file
@ -0,0 +1,224 @@
|
||||
From bc4b30bb7c3ce3310d98a43bb5364b327ecd5cf9 Mon Sep 17 00:00:00 2001
|
||||
From: Dongdong Liu <liudongdong3@huawei.com>
|
||||
Date: Fri, 21 Apr 2023 17:53:21 +0800
|
||||
Subject: net/hns3: simplify hardware checksum offloading
|
||||
|
||||
[ upstream commit 7fd763a9dd18a3edd98e95c26e96349fd71cbb9b ]
|
||||
|
||||
If the NIC support simple BD mode, the hardware will calculate
|
||||
the checksum from the start position of checksum and fill the
|
||||
checksum result to the offset position, which simple the
|
||||
HW operations of calculating the type and header length of
|
||||
L3/L4.
|
||||
|
||||
Add this mode for hns3 PMD when the packet type is L4.
|
||||
|
||||
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_cmd.c | 3 ++
|
||||
drivers/net/hns3/hns3_cmd.h | 1 +
|
||||
drivers/net/hns3/hns3_dump.c | 1 +
|
||||
drivers/net/hns3/hns3_ethdev.h | 1 +
|
||||
drivers/net/hns3/hns3_rxtx.c | 52 +++++++++++++++++++++++++++++++++-
|
||||
drivers/net/hns3/hns3_rxtx.h | 12 +++++++-
|
||||
6 files changed, 68 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c
|
||||
index bdfc85f934..d530650452 100644
|
||||
--- a/drivers/net/hns3/hns3_cmd.c
|
||||
+++ b/drivers/net/hns3/hns3_cmd.c
|
||||
@@ -419,6 +419,7 @@ hns3_get_caps_name(uint32_t caps_id)
|
||||
} dev_caps[] = {
|
||||
{ HNS3_CAPS_FD_QUEUE_REGION_B, "fd_queue_region" },
|
||||
{ HNS3_CAPS_PTP_B, "ptp" },
|
||||
+ { HNS3_CAPS_SIMPLE_BD_B, "simple_bd" },
|
||||
{ HNS3_CAPS_TX_PUSH_B, "tx_push" },
|
||||
{ HNS3_CAPS_PHY_IMP_B, "phy_imp" },
|
||||
{ HNS3_CAPS_TQP_TXRX_INDEP_B, "tqp_txrx_indep" },
|
||||
@@ -489,6 +490,8 @@ hns3_parse_capability(struct hns3_hw *hw,
|
||||
hns3_warn(hw, "ignore PTP capability due to lack of "
|
||||
"rxd advanced layout capability.");
|
||||
}
|
||||
+ if (hns3_get_bit(caps, HNS3_CAPS_SIMPLE_BD_B))
|
||||
+ hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_SIMPLE_BD_B, 1);
|
||||
if (hns3_get_bit(caps, HNS3_CAPS_TX_PUSH_B))
|
||||
hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_TX_PUSH_B, 1);
|
||||
if (hns3_get_bit(caps, HNS3_CAPS_PHY_IMP_B))
|
||||
diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h
|
||||
index eb394c9dec..4abe0f1d13 100644
|
||||
--- a/drivers/net/hns3/hns3_cmd.h
|
||||
+++ b/drivers/net/hns3/hns3_cmd.h
|
||||
@@ -313,6 +313,7 @@ enum HNS3_CAPS_BITS {
|
||||
*/
|
||||
HNS3_CAPS_FD_QUEUE_REGION_B = 2,
|
||||
HNS3_CAPS_PTP_B,
|
||||
+ HNS3_CAPS_SIMPLE_BD_B = 5,
|
||||
HNS3_CAPS_TX_PUSH_B = 6,
|
||||
HNS3_CAPS_PHY_IMP_B = 7,
|
||||
HNS3_CAPS_TQP_TXRX_INDEP_B,
|
||||
diff --git a/drivers/net/hns3/hns3_dump.c b/drivers/net/hns3/hns3_dump.c
|
||||
index 8268506f6f..a793ba64ad 100644
|
||||
--- a/drivers/net/hns3/hns3_dump.c
|
||||
+++ b/drivers/net/hns3/hns3_dump.c
|
||||
@@ -96,6 +96,7 @@ hns3_get_dev_feature_capability(FILE *file, struct hns3_hw *hw)
|
||||
{HNS3_DEV_SUPPORT_TX_PUSH_B, "TX PUSH"},
|
||||
{HNS3_DEV_SUPPORT_INDEP_TXRX_B, "INDEP TXRX"},
|
||||
{HNS3_DEV_SUPPORT_STASH_B, "STASH"},
|
||||
+ {HNS3_DEV_SUPPORT_SIMPLE_BD_B, "SIMPLE BD"},
|
||||
{HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B, "RXD Advanced Layout"},
|
||||
{HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B, "OUTER UDP CKSUM"},
|
||||
{HNS3_DEV_SUPPORT_RAS_IMP_B, "RAS IMP"},
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
|
||||
index 9acc5a3d7e..ee4dd18d7b 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.h
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.h
|
||||
@@ -886,6 +886,7 @@ enum hns3_dev_cap {
|
||||
HNS3_DEV_SUPPORT_TX_PUSH_B,
|
||||
HNS3_DEV_SUPPORT_INDEP_TXRX_B,
|
||||
HNS3_DEV_SUPPORT_STASH_B,
|
||||
+ HNS3_DEV_SUPPORT_SIMPLE_BD_B,
|
||||
HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B,
|
||||
HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B,
|
||||
HNS3_DEV_SUPPORT_RAS_IMP_B,
|
||||
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
|
||||
index 1f44c0345f..aaf0a06ca6 100644
|
||||
--- a/drivers/net/hns3/hns3_rxtx.c
|
||||
+++ b/drivers/net/hns3/hns3_rxtx.c
|
||||
@@ -3046,6 +3046,10 @@ hns3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc,
|
||||
HNS3_PORT_BASE_VLAN_ENABLE;
|
||||
else
|
||||
txq->pvid_sw_shift_en = false;
|
||||
+
|
||||
+ if (hns3_dev_get_support(hw, SIMPLE_BD))
|
||||
+ txq->simple_bd_enable = true;
|
||||
+
|
||||
txq->max_non_tso_bd_num = hw->max_non_tso_bd_num;
|
||||
txq->configured = true;
|
||||
txq->io_base = (void *)((char *)hw->io_base +
|
||||
@@ -3162,7 +3166,7 @@ hns3_set_tso(struct hns3_desc *desc, uint32_t paylen, struct rte_mbuf *rxm)
|
||||
return;
|
||||
|
||||
desc->tx.type_cs_vlan_tso_len |= rte_cpu_to_le_32(BIT(HNS3_TXD_TSO_B));
|
||||
- desc->tx.mss = rte_cpu_to_le_16(rxm->tso_segsz);
|
||||
+ desc->tx.ckst_mss |= rte_cpu_to_le_16(rxm->tso_segsz);
|
||||
}
|
||||
|
||||
static inline void
|
||||
@@ -3901,6 +3905,50 @@ hns3_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
|
||||
return i;
|
||||
}
|
||||
|
||||
+static inline int
|
||||
+hns3_handle_simple_bd(struct hns3_tx_queue *txq, struct hns3_desc *desc,
|
||||
+ struct rte_mbuf *m)
|
||||
+{
|
||||
+#define HNS3_TCP_CSUM_OFFSET 16
|
||||
+#define HNS3_UDP_CSUM_OFFSET 6
|
||||
+
|
||||
+ /*
|
||||
+ * In HIP09, NIC HW support Tx simple BD mode that the HW will
|
||||
+ * calculate the checksum from the start position of checksum and fill
|
||||
+ * the checksum result to the offset position without packet type and
|
||||
+ * header length of L3/L4.
|
||||
+ * For non-tunneling packet:
|
||||
+ * - Tx simple BD support for TCP and UDP checksum.
|
||||
+ * For tunneling packet:
|
||||
+ * - Tx simple BD support for inner L4 checksum(except sctp checksum).
|
||||
+ * - Tx simple BD not support the outer checksum and the inner L3
|
||||
+ * checksum.
|
||||
+ * - Besides, Tx simple BD is not support for TSO.
|
||||
+ */
|
||||
+ if (txq->simple_bd_enable && !(m->ol_flags & RTE_MBUF_F_TX_IP_CKSUM) &&
|
||||
+ !(m->ol_flags & RTE_MBUF_F_TX_TCP_SEG) &&
|
||||
+ !(m->ol_flags & RTE_MBUF_F_TX_OUTER_IP_CKSUM) &&
|
||||
+ ((m->ol_flags & RTE_MBUF_F_TX_L4_MASK) == RTE_MBUF_F_TX_TCP_CKSUM ||
|
||||
+ (m->ol_flags & RTE_MBUF_F_TX_L4_MASK) == RTE_MBUF_F_TX_UDP_CKSUM)) {
|
||||
+ /* set checksum start and offset, defined in 2 Bytes */
|
||||
+ hns3_set_field(desc->tx.type_cs_vlan_tso_len,
|
||||
+ HNS3_TXD_L4_START_M, HNS3_TXD_L4_START_S,
|
||||
+ (m->l2_len + m->l3_len) >> HNS3_SIMPLE_BD_UNIT);
|
||||
+ hns3_set_field(desc->tx.ol_type_vlan_len_msec,
|
||||
+ HNS3_TXD_L4_CKS_OFFSET_M, HNS3_TXD_L4_CKS_OFFSET_S,
|
||||
+ (m->ol_flags & RTE_MBUF_F_TX_L4_MASK) ==
|
||||
+ RTE_MBUF_F_TX_TCP_CKSUM ?
|
||||
+ HNS3_TCP_CSUM_OFFSET >> HNS3_SIMPLE_BD_UNIT :
|
||||
+ HNS3_UDP_CSUM_OFFSET >> HNS3_SIMPLE_BD_UNIT);
|
||||
+
|
||||
+ hns3_set_bit(desc->tx.ckst_mss, HNS3_TXD_CKST_B, 1);
|
||||
+
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ return -ENOTSUP;
|
||||
+}
|
||||
+
|
||||
static int
|
||||
hns3_parse_cksum(struct hns3_tx_queue *txq, uint16_t tx_desc_id,
|
||||
struct rte_mbuf *m)
|
||||
@@ -3910,6 +3958,8 @@ hns3_parse_cksum(struct hns3_tx_queue *txq, uint16_t tx_desc_id,
|
||||
|
||||
/* Enable checksum offloading */
|
||||
if (m->ol_flags & HNS3_TX_CKSUM_OFFLOAD_MASK) {
|
||||
+ if (hns3_handle_simple_bd(txq, desc, m) == 0)
|
||||
+ return 0;
|
||||
/* Fill in tunneling parameters if necessary */
|
||||
if (hns3_parse_tunneling_params(txq, m, tx_desc_id)) {
|
||||
txq->dfx_stats.unsupported_tunnel_pkt_cnt++;
|
||||
diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h
|
||||
index fa39f6481a..7685ac2ea3 100644
|
||||
--- a/drivers/net/hns3/hns3_rxtx.h
|
||||
+++ b/drivers/net/hns3/hns3_rxtx.h
|
||||
@@ -134,6 +134,9 @@
|
||||
#define HNS3_TXD_L4LEN_S 24
|
||||
#define HNS3_TXD_L4LEN_M (0xffUL << HNS3_TXD_L4LEN_S)
|
||||
|
||||
+#define HNS3_TXD_L4_START_S 8
|
||||
+#define HNS3_TXD_L4_START_M (0xffff << HNS3_TXD_L4_START_S)
|
||||
+
|
||||
#define HNS3_TXD_OL3T_S 0
|
||||
#define HNS3_TXD_OL3T_M (0x3 << HNS3_TXD_OL3T_S)
|
||||
#define HNS3_TXD_OVLAN_B 2
|
||||
@@ -141,6 +144,9 @@
|
||||
#define HNS3_TXD_TUNTYPE_S 4
|
||||
#define HNS3_TXD_TUNTYPE_M (0xf << HNS3_TXD_TUNTYPE_S)
|
||||
|
||||
+#define HNS3_TXD_L4_CKS_OFFSET_S 8
|
||||
+#define HNS3_TXD_L4_CKS_OFFSET_M (0xffff << HNS3_TXD_L4_CKS_OFFSET_S)
|
||||
+
|
||||
#define HNS3_TXD_BDTYPE_S 0
|
||||
#define HNS3_TXD_BDTYPE_M (0xf << HNS3_TXD_BDTYPE_S)
|
||||
#define HNS3_TXD_FE_B 4
|
||||
@@ -157,10 +163,13 @@
|
||||
#define HNS3_TXD_MSS_S 0
|
||||
#define HNS3_TXD_MSS_M (0x3fff << HNS3_TXD_MSS_S)
|
||||
|
||||
+#define HNS3_TXD_CKST_B 14
|
||||
+
|
||||
#define HNS3_TXD_OL4CS_B 22
|
||||
#define HNS3_L2_LEN_UNIT 1UL
|
||||
#define HNS3_L3_LEN_UNIT 2UL
|
||||
#define HNS3_L4_LEN_UNIT 2UL
|
||||
+#define HNS3_SIMPLE_BD_UNIT 1UL
|
||||
|
||||
#define HNS3_TXD_DEFAULT_BDTYPE 0
|
||||
#define HNS3_TXD_VLD_CMD (0x1 << HNS3_TXD_VLD_B)
|
||||
@@ -247,7 +256,7 @@ struct hns3_desc {
|
||||
|
||||
uint32_t paylen_fd_dop_ol4cs;
|
||||
uint16_t tp_fe_sc_vld_ra_ri;
|
||||
- uint16_t mss;
|
||||
+ uint16_t ckst_mss;
|
||||
} tx;
|
||||
|
||||
struct {
|
||||
@@ -488,6 +497,7 @@ struct hns3_tx_queue {
|
||||
*/
|
||||
uint16_t udp_cksum_mode:1;
|
||||
|
||||
+ /* check whether the simple BD mode is supported */
|
||||
uint16_t simple_bd_enable:1;
|
||||
uint16_t tx_push_enable:1; /* check whether the tx push is enabled */
|
||||
/*
|
||||
--
|
||||
2.23.0
|
||||
|
||||
66
0286-net-hns3-support-dump-media-type.patch
Normal file
66
0286-net-hns3-support-dump-media-type.patch
Normal file
@ -0,0 +1,66 @@
|
||||
From 8c4f049f4ed9885886d4f16332472df7d2bd4773 Mon Sep 17 00:00:00 2001
|
||||
From: Chengwen Feng <fengchengwen@huawei.com>
|
||||
Date: Fri, 21 Apr 2023 17:53:22 +0800
|
||||
Subject: net/hns3: support dump media type
|
||||
|
||||
[ upstream commit 5a4af56b354d412b1be460f65d2977fd56b21ef8 ]
|
||||
|
||||
The media type information helps locate faults such as AN or rate
|
||||
switching, so add dump media type in eth_dev_priv_dump ops.
|
||||
|
||||
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
|
||||
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_dump.c | 2 ++
|
||||
drivers/net/hns3/hns3_ethdev.c | 2 +-
|
||||
drivers/net/hns3/hns3_ethdev.h | 2 ++
|
||||
3 files changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_dump.c b/drivers/net/hns3/hns3_dump.c
|
||||
index a793ba64ad..7daa54ec87 100644
|
||||
--- a/drivers/net/hns3/hns3_dump.c
|
||||
+++ b/drivers/net/hns3/hns3_dump.c
|
||||
@@ -68,12 +68,14 @@ hns3_get_dev_mac_info(FILE *file, struct hns3_adapter *hns)
|
||||
|
||||
fprintf(file, " - MAC Info:\n");
|
||||
fprintf(file,
|
||||
+ "\t -- media_type=%s\n"
|
||||
"\t -- query_type=%u\n"
|
||||
"\t -- supported_speed=0x%x\n"
|
||||
"\t -- advertising=0x%x\n"
|
||||
"\t -- lp_advertising=0x%x\n"
|
||||
"\t -- support_autoneg=%s\n"
|
||||
"\t -- support_fc_autoneg=%s\n",
|
||||
+ hns3_get_media_type_name(hw->mac.media_type),
|
||||
hw->mac.query_type,
|
||||
hw->mac.supported_speed,
|
||||
hw->mac.advertising,
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index 1c67ff2c99..12e7a72c36 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -4891,7 +4891,7 @@ hns3_set_fiber_port_link_speed(struct hns3_hw *hw,
|
||||
return hns3_cfg_mac_speed_dup(hw, cfg->speed, cfg->duplex);
|
||||
}
|
||||
|
||||
-static const char *
|
||||
+const char *
|
||||
hns3_get_media_type_name(uint8_t media_type)
|
||||
{
|
||||
if (media_type == HNS3_MEDIA_TYPE_FIBER)
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
|
||||
index ee4dd18d7b..8268dba788 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.h
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.h
|
||||
@@ -1054,6 +1054,8 @@ int hns3_timesync_write_time(struct rte_eth_dev *dev,
|
||||
const struct timespec *ts);
|
||||
int hns3_timesync_adjust_time(struct rte_eth_dev *dev, int64_t delta);
|
||||
|
||||
+const char *hns3_get_media_type_name(uint8_t media_type);
|
||||
+
|
||||
static inline bool
|
||||
is_reset_pending(struct hns3_adapter *hns)
|
||||
{
|
||||
--
|
||||
2.23.0
|
||||
|
||||
116
0287-ethdev-fix-one-address-occupies-two-entries-in-MAC-a.patch
Normal file
116
0287-ethdev-fix-one-address-occupies-two-entries-in-MAC-a.patch
Normal file
@ -0,0 +1,116 @@
|
||||
From dfa6c33450b990739a282f5acad8e43a5b27437b Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Fri, 19 May 2023 17:31:55 +0800
|
||||
Subject: ethdev: fix one address occupies two entries in MAC addrs
|
||||
|
||||
[ upstream commit 964ccaf2fe229ef31f57574176f966af7fcefae4 ]
|
||||
|
||||
The dev->data->mac_addrs[0] will be changed to a new MAC address when
|
||||
applications modify the default MAC address by .mac_addr_set(). However,
|
||||
if the new default one has been added as a non-default MAC address by
|
||||
.mac_addr_add(), the .mac_addr_set() didn't check this address.
|
||||
As a result, this MAC address occupies two entries in the list. Like:
|
||||
add(MAC1)
|
||||
add(MAC2)
|
||||
add(MAC3)
|
||||
add(MAC4)
|
||||
set_default(MAC3)
|
||||
default=MAC3, the rest of the list=MAC1, MAC2, MAC3, MAC4
|
||||
Note: MAC3 occupies two entries.
|
||||
|
||||
But .mac_addr_set() cannot remove it implicitly in case of MAC address
|
||||
shrinking in the list.
|
||||
So this patch adds a check on whether the new default address was
|
||||
already in the list and if so requires the user to remove it first.
|
||||
|
||||
In addition, this patch documents the position of the default MAC
|
||||
address and address unique in the list.
|
||||
|
||||
Fixes: 854d8ad4ef68 ("ethdev: add default mac address modifier")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
|
||||
Acked-by: Thomas Monjalon <thomas@monjalon.net>
|
||||
Reviewed-by: Ferruh Yigit <ferruh.yigit@amd.com>
|
||||
---
|
||||
lib/ethdev/ethdev_driver.h | 6 +++++-
|
||||
lib/ethdev/rte_ethdev.c | 14 +++++++++++++-
|
||||
lib/ethdev/rte_ethdev.h | 4 ++++
|
||||
3 files changed, 22 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
|
||||
index d3de203d7a..6f539d45c6 100644
|
||||
--- a/lib/ethdev/ethdev_driver.h
|
||||
+++ b/lib/ethdev/ethdev_driver.h
|
||||
@@ -111,7 +111,11 @@ struct rte_eth_dev_data {
|
||||
|
||||
uint64_t rx_mbuf_alloc_failed; /**< Rx ring mbuf allocation failures */
|
||||
|
||||
- /** Device Ethernet link address. @see rte_eth_dev_release_port() */
|
||||
+ /**
|
||||
+ * Device Ethernet link addresses.
|
||||
+ * All entries are unique.
|
||||
+ * The first entry (index zero) is the default address.
|
||||
+ */
|
||||
struct rte_ether_addr *mac_addrs;
|
||||
/** Bitmap associating MAC addresses to pools */
|
||||
uint64_t mac_pool_sel[RTE_ETH_NUM_RECEIVE_MAC_ADDR];
|
||||
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
|
||||
index 054715e05a..2f0aa282df 100644
|
||||
--- a/lib/ethdev/rte_ethdev.c
|
||||
+++ b/lib/ethdev/rte_ethdev.c
|
||||
@@ -4471,6 +4471,7 @@ int
|
||||
rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct rte_ether_addr *addr)
|
||||
{
|
||||
struct rte_eth_dev *dev;
|
||||
+ int index;
|
||||
int ret;
|
||||
|
||||
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
|
||||
@@ -4486,8 +4487,19 @@ rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct rte_ether_addr *addr)
|
||||
if (!rte_is_valid_assigned_ether_addr(addr))
|
||||
return -EINVAL;
|
||||
|
||||
- RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_set, -ENOTSUP);
|
||||
+ if (*dev->dev_ops->mac_addr_set == NULL)
|
||||
+ return -ENOTSUP;
|
||||
+
|
||||
+ /* Keep address unique in dev->data->mac_addrs[]. */
|
||||
+ index = eth_dev_get_mac_addr_index(port_id, addr);
|
||||
+ if (index > 0) {
|
||||
+ RTE_ETHDEV_LOG(ERR,
|
||||
+ "New default address for port %u was already in the address list. Please remove it first.\n",
|
||||
+ port_id);
|
||||
+ return -EEXIST;
|
||||
+ }
|
||||
|
||||
+ ret = (*dev->dev_ops->mac_addr_set)(dev, addr);
|
||||
ret = (*dev->dev_ops->mac_addr_set)(dev, addr);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
|
||||
index b262939a33..9df50c30b4 100644
|
||||
--- a/lib/ethdev/rte_ethdev.h
|
||||
+++ b/lib/ethdev/rte_ethdev.h
|
||||
@@ -4167,6 +4167,9 @@ int rte_eth_dev_mac_addr_remove(uint16_t port_id,
|
||||
|
||||
/**
|
||||
* Set the default MAC address.
|
||||
+ * It replaces the address at index 0 of the MAC address list.
|
||||
+ * If the address was already in the MAC address list,
|
||||
+ * please remove it first.
|
||||
*
|
||||
* @param port_id
|
||||
* The port identifier of the Ethernet device.
|
||||
@@ -4177,6 +4180,7 @@ int rte_eth_dev_mac_addr_remove(uint16_t port_id,
|
||||
* - (-ENOTSUP) if hardware doesn't support.
|
||||
* - (-ENODEV) if *port* invalid.
|
||||
* - (-EINVAL) if MAC address is invalid.
|
||||
+ * - (-EEXIST) if MAC address was already in the address list.
|
||||
*/
|
||||
int rte_eth_dev_default_mac_addr_set(uint16_t port_id,
|
||||
struct rte_ether_addr *mac_addr);
|
||||
--
|
||||
2.23.0
|
||||
|
||||
47
0288-net-hns3-fix-never-set-MAC-flow-control.patch
Normal file
47
0288-net-hns3-fix-never-set-MAC-flow-control.patch
Normal file
@ -0,0 +1,47 @@
|
||||
From 68c936210f151e6359bb770026a2d6b7a3bed43a Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Mon, 22 May 2023 21:17:36 +0800
|
||||
Subject: net/hns3: fix never set MAC flow control
|
||||
|
||||
[ upstream commit 73b4f0011f09c5a57776c9f4edaf2d88a3065053 ]
|
||||
|
||||
When some hardware and firmware support speed auto-negotiation
|
||||
but do not support flow control auto-negotiation, driver can
|
||||
never successfully set MAC flow control by flow_ctrl_set() API.
|
||||
So only tell user driver doesn't support flow control autoneg
|
||||
when user enable it.
|
||||
|
||||
Fixes: 1f411e31a826 ("net/hns3: support flow control autoneg for copper port")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 11 +----------
|
||||
1 file changed, 1 insertion(+), 10 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index 12e7a72c36..e01d5f76db 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -5304,16 +5304,7 @@ hns3_check_fc_autoneg_valid(struct hns3_hw *hw, uint8_t autoneg)
|
||||
|
||||
if (!pf->support_fc_autoneg) {
|
||||
if (autoneg != 0) {
|
||||
- hns3_err(hw, "unsupported fc auto-negotiation setting.");
|
||||
- return -EOPNOTSUPP;
|
||||
- }
|
||||
-
|
||||
- /*
|
||||
- * Flow control auto-negotiation of the NIC is not supported,
|
||||
- * but other auto-negotiation features may be supported.
|
||||
- */
|
||||
- if (autoneg != hw->mac.link_autoneg) {
|
||||
- hns3_err(hw, "please use 'link_speeds' in struct rte_eth_conf to disable autoneg!");
|
||||
+ hns3_err(hw, "unsupported fc auto-negotiation.");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
303
0289-net-hns3-add-flow-control-autoneg-for-fiber-port.patch
Normal file
303
0289-net-hns3-add-flow-control-autoneg-for-fiber-port.patch
Normal file
@ -0,0 +1,303 @@
|
||||
From 1a547f79f8d9b412dd4d643107b134e653500865 Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Mon, 22 May 2023 21:17:37 +0800
|
||||
Subject: net/hns3: add flow control autoneg for fiber port
|
||||
|
||||
[ upstream commit ab0ddd9a0ad5adcc96eabd1fe49edbd2809f202e ]
|
||||
|
||||
Support flow control autoneg for fiber and backplane port.
|
||||
And it depends on the capability of firmware.
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_cmd.c | 30 +++++++++++++++++-
|
||||
drivers/net/hns3/hns3_cmd.h | 20 +++++++++++-
|
||||
drivers/net/hns3/hns3_dump.c | 1 +
|
||||
drivers/net/hns3/hns3_ethdev.c | 58 ++++++++--------------------------
|
||||
drivers/net/hns3/hns3_ethdev.h | 1 +
|
||||
5 files changed, 63 insertions(+), 47 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c
|
||||
index d530650452..d0a3853656 100644
|
||||
--- a/drivers/net/hns3/hns3_cmd.c
|
||||
+++ b/drivers/net/hns3/hns3_cmd.c
|
||||
@@ -428,7 +428,8 @@ hns3_get_caps_name(uint32_t caps_id)
|
||||
{ HNS3_CAPS_UDP_TUNNEL_CSUM_B, "udp_tunnel_csum" },
|
||||
{ HNS3_CAPS_RAS_IMP_B, "ras_imp" },
|
||||
{ HNS3_CAPS_RXD_ADV_LAYOUT_B, "rxd_adv_layout" },
|
||||
- { HNS3_CAPS_TM_B, "tm_capability" }
|
||||
+ { HNS3_CAPS_TM_B, "tm_capability" },
|
||||
+ { HNS3_CAPS_FC_AUTO_B, "fc_autoneg" }
|
||||
};
|
||||
uint32_t i;
|
||||
|
||||
@@ -510,6 +511,8 @@ hns3_parse_capability(struct hns3_hw *hw,
|
||||
hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_RAS_IMP_B, 1);
|
||||
if (hns3_get_bit(caps, HNS3_CAPS_TM_B))
|
||||
hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_TM_B, 1);
|
||||
+ if (hns3_get_bit(caps, HNS3_CAPS_FC_AUTO_B))
|
||||
+ hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_FC_AUTO_B, 1);
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
@@ -613,9 +616,31 @@ hns3_update_dev_lsc_cap(struct hns3_hw *hw, int fw_compact_cmd_result)
|
||||
}
|
||||
}
|
||||
|
||||
+static void
|
||||
+hns3_set_fc_autoneg_cap(struct hns3_adapter *hns, int fw_compact_cmd_result)
|
||||
+{
|
||||
+ struct hns3_hw *hw = &hns->hw;
|
||||
+ struct hns3_mac *mac = &hw->mac;
|
||||
+
|
||||
+ if (mac->media_type == HNS3_MEDIA_TYPE_COPPER) {
|
||||
+ hns->pf.support_fc_autoneg = true;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * Flow control auto-negotiation requires the cooperation of the driver
|
||||
+ * and firmware.
|
||||
+ */
|
||||
+ hns->pf.support_fc_autoneg = (hns3_dev_get_support(hw, FC_AUTO) &&
|
||||
+ fw_compact_cmd_result == 0) ?
|
||||
+ true : false;
|
||||
+}
|
||||
+
|
||||
static int
|
||||
hns3_apply_fw_compat_cmd_result(struct hns3_hw *hw, int result)
|
||||
{
|
||||
+ struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw);
|
||||
+
|
||||
if (result != 0 && hns3_dev_get_support(hw, COPPER)) {
|
||||
hns3_err(hw, "firmware fails to initialize the PHY, ret = %d.",
|
||||
result);
|
||||
@@ -623,6 +648,7 @@ hns3_apply_fw_compat_cmd_result(struct hns3_hw *hw, int result)
|
||||
}
|
||||
|
||||
hns3_update_dev_lsc_cap(hw, result);
|
||||
+ hns3_set_fc_autoneg_cap(hns, result);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -642,6 +668,8 @@ hns3_firmware_compat_config(struct hns3_hw *hw, bool is_init)
|
||||
hns3_set_bit(compat, HNS3_NCSI_ERROR_REPORT_EN_B, 0);
|
||||
if (hns3_dev_get_support(hw, COPPER))
|
||||
hns3_set_bit(compat, HNS3_FIRMWARE_PHY_DRIVER_EN_B, 1);
|
||||
+ if (hns3_dev_get_support(hw, FC_AUTO))
|
||||
+ hns3_set_bit(compat, HNS3_MAC_FC_AUTONEG_EN_B, 1);
|
||||
}
|
||||
req->compat = rte_cpu_to_le_32(compat);
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h
|
||||
index 4abe0f1d13..d78c1b401e 100644
|
||||
--- a/drivers/net/hns3/hns3_cmd.h
|
||||
+++ b/drivers/net/hns3/hns3_cmd.h
|
||||
@@ -323,6 +323,7 @@ enum HNS3_CAPS_BITS {
|
||||
HNS3_CAPS_RAS_IMP_B,
|
||||
HNS3_CAPS_RXD_ADV_LAYOUT_B = 15,
|
||||
HNS3_CAPS_TM_B = 19,
|
||||
+ HNS3_CAPS_FC_AUTO_B = 30,
|
||||
};
|
||||
|
||||
/* Capabilities of VF dependent on the PF */
|
||||
@@ -666,6 +667,9 @@ enum hns3_promisc_type {
|
||||
#define HNS3_LINK_EVENT_REPORT_EN_B 0
|
||||
#define HNS3_NCSI_ERROR_REPORT_EN_B 1
|
||||
#define HNS3_FIRMWARE_PHY_DRIVER_EN_B 2
|
||||
+
|
||||
+#define HNS3_MAC_FC_AUTONEG_EN_B 6
|
||||
+
|
||||
struct hns3_firmware_compat_cmd {
|
||||
uint32_t compat;
|
||||
uint8_t rsv[20];
|
||||
@@ -680,6 +684,7 @@ struct hns3_firmware_compat_cmd {
|
||||
#define HNS3_PHY_LINK_MODE_AUTONEG_BIT BIT(6)
|
||||
#define HNS3_PHY_LINK_MODE_PAUSE_BIT BIT(13)
|
||||
#define HNS3_PHY_LINK_MODE_ASYM_PAUSE_BIT BIT(14)
|
||||
+#define HNS3_PHY_LINK_MODE_PAUSE_S 13
|
||||
|
||||
#define HNS3_PHY_PARAM_CFG_BD_NUM 2
|
||||
struct hns3_phy_params_bd0_cmd {
|
||||
@@ -789,6 +794,17 @@ struct hns3_sfp_type {
|
||||
#define HNS3_FIBER_LINK_SPEED_10M_BIT BIT(7)
|
||||
#define HNS3_FIBER_LINK_SPEED_200G_BIT BIT(8)
|
||||
|
||||
+/* Flags for pause status field */
|
||||
+#define HNS3_FIBER_LOCAL_PAUSE_BIT BIT(0)
|
||||
+#define HNS3_FIBER_LOCAL_ASYM_PAUSE_BIT BIT(1)
|
||||
+#define HNS3_FIBER_LP_PAUSE_BIT BIT(2)
|
||||
+#define HNS3_FIBER_LP_ASYM_PAUSE_BIT BIT(3)
|
||||
+#define HNS3_FIBER_LOCAL_PAUSE_MASK (HNS3_FIBER_LOCAL_PAUSE_BIT | \
|
||||
+ HNS3_FIBER_LOCAL_ASYM_PAUSE_BIT)
|
||||
+#define HNS3_FIBER_LP_PAUSE_MASK (HNS3_FIBER_LP_PAUSE_BIT | \
|
||||
+ HNS3_FIBER_LP_ASYM_PAUSE_BIT)
|
||||
+#define HNS3_FIBER_LP_PAUSE_S 2
|
||||
+
|
||||
struct hns3_sfp_info_cmd {
|
||||
uint32_t sfp_speed;
|
||||
uint8_t query_type; /* 0: sfp speed, 1: active */
|
||||
@@ -798,7 +814,9 @@ struct hns3_sfp_info_cmd {
|
||||
uint8_t autoneg_ability;
|
||||
uint32_t supported_speed; /* speed supported by current media */
|
||||
uint32_t module_type;
|
||||
- uint8_t rsv1[8];
|
||||
+ uint8_t rsv[2];
|
||||
+ uint8_t pause_status;
|
||||
+ uint8_t rsv1[5];
|
||||
};
|
||||
|
||||
#define HNS3_MAC_CFG_FEC_AUTO_EN_B 0
|
||||
diff --git a/drivers/net/hns3/hns3_dump.c b/drivers/net/hns3/hns3_dump.c
|
||||
index 7daa54ec87..7ecfca8497 100644
|
||||
--- a/drivers/net/hns3/hns3_dump.c
|
||||
+++ b/drivers/net/hns3/hns3_dump.c
|
||||
@@ -104,6 +104,7 @@ hns3_get_dev_feature_capability(FILE *file, struct hns3_hw *hw)
|
||||
{HNS3_DEV_SUPPORT_RAS_IMP_B, "RAS IMP"},
|
||||
{HNS3_DEV_SUPPORT_TM_B, "TM"},
|
||||
{HNS3_DEV_SUPPORT_VF_VLAN_FLT_MOD_B, "VF VLAN FILTER MOD"},
|
||||
+ {HNS3_DEV_SUPPORT_FC_AUTO_B, "FC AUTO"}
|
||||
};
|
||||
uint32_t i;
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index e01d5f76db..8a7f6cc7be 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -3975,6 +3975,7 @@ static int
|
||||
hns3_get_sfp_info(struct hns3_hw *hw, struct hns3_mac *mac_info)
|
||||
{
|
||||
struct hns3_sfp_info_cmd *resp;
|
||||
+ uint32_t local_pause, lp_pause;
|
||||
struct hns3_cmd_desc desc;
|
||||
int ret;
|
||||
|
||||
@@ -4011,6 +4012,13 @@ hns3_get_sfp_info(struct hns3_hw *hw, struct hns3_mac *mac_info)
|
||||
mac_info->support_autoneg = resp->autoneg_ability;
|
||||
mac_info->link_autoneg = (resp->autoneg == 0) ? RTE_ETH_LINK_FIXED
|
||||
: RTE_ETH_LINK_AUTONEG;
|
||||
+ local_pause = resp->pause_status & HNS3_FIBER_LOCAL_PAUSE_MASK;
|
||||
+ lp_pause = (resp->pause_status & HNS3_FIBER_LP_PAUSE_MASK) >>
|
||||
+ HNS3_FIBER_LP_PAUSE_S;
|
||||
+ mac_info->advertising =
|
||||
+ local_pause << HNS3_PHY_LINK_MODE_PAUSE_S;
|
||||
+ mac_info->lp_advertising =
|
||||
+ lp_pause << HNS3_PHY_LINK_MODE_PAUSE_S;
|
||||
} else {
|
||||
mac_info->query_type = HNS3_DEFAULT_QUERY;
|
||||
}
|
||||
@@ -4093,6 +4101,8 @@ hns3_update_fiber_link_info(struct hns3_hw *hw)
|
||||
mac->supported_speed = mac_info.supported_speed;
|
||||
mac->support_autoneg = mac_info.support_autoneg;
|
||||
mac->link_autoneg = mac_info.link_autoneg;
|
||||
+ mac->advertising = mac_info.advertising;
|
||||
+ mac->lp_advertising = mac_info.lp_advertising;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -4495,24 +4505,6 @@ hns3_get_port_supported_speed(struct rte_eth_dev *eth_dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static void
|
||||
-hns3_get_fc_autoneg_capability(struct hns3_adapter *hns)
|
||||
-{
|
||||
- struct hns3_mac *mac = &hns->hw.mac;
|
||||
-
|
||||
- if (mac->media_type == HNS3_MEDIA_TYPE_COPPER) {
|
||||
- hns->pf.support_fc_autoneg = true;
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- /*
|
||||
- * Flow control auto-negotiation requires the cooperation of the driver
|
||||
- * and firmware. Currently, the optical port does not support flow
|
||||
- * control auto-negotiation.
|
||||
- */
|
||||
- hns->pf.support_fc_autoneg = false;
|
||||
-}
|
||||
-
|
||||
static int
|
||||
hns3_init_pf(struct rte_eth_dev *eth_dev)
|
||||
{
|
||||
@@ -4615,8 +4607,6 @@ hns3_init_pf(struct rte_eth_dev *eth_dev)
|
||||
goto err_supported_speed;
|
||||
}
|
||||
|
||||
- hns3_get_fc_autoneg_capability(hns);
|
||||
-
|
||||
hns3_tm_conf_init(eth_dev);
|
||||
|
||||
return 0;
|
||||
@@ -5181,8 +5171,7 @@ hns3_dev_close(struct rte_eth_dev *eth_dev)
|
||||
}
|
||||
|
||||
static void
|
||||
-hns3_get_autoneg_rxtx_pause_copper(struct hns3_hw *hw, bool *rx_pause,
|
||||
- bool *tx_pause)
|
||||
+hns3_get_autoneg_rxtx_pause(struct hns3_hw *hw, bool *rx_pause, bool *tx_pause)
|
||||
{
|
||||
struct hns3_mac *mac = &hw->mac;
|
||||
uint32_t advertising = mac->advertising;
|
||||
@@ -5193,8 +5182,7 @@ hns3_get_autoneg_rxtx_pause_copper(struct hns3_hw *hw, bool *rx_pause,
|
||||
if (advertising & lp_advertising & HNS3_PHY_LINK_MODE_PAUSE_BIT) {
|
||||
*rx_pause = true;
|
||||
*tx_pause = true;
|
||||
- } else if (advertising & lp_advertising &
|
||||
- HNS3_PHY_LINK_MODE_ASYM_PAUSE_BIT) {
|
||||
+ } else if (advertising & lp_advertising & HNS3_PHY_LINK_MODE_ASYM_PAUSE_BIT) {
|
||||
if (advertising & HNS3_PHY_LINK_MODE_PAUSE_BIT)
|
||||
*rx_pause = true;
|
||||
else if (lp_advertising & HNS3_PHY_LINK_MODE_PAUSE_BIT)
|
||||
@@ -5209,26 +5197,7 @@ hns3_get_autoneg_fc_mode(struct hns3_hw *hw)
|
||||
bool rx_pause = false;
|
||||
bool tx_pause = false;
|
||||
|
||||
- switch (hw->mac.media_type) {
|
||||
- case HNS3_MEDIA_TYPE_COPPER:
|
||||
- hns3_get_autoneg_rxtx_pause_copper(hw, &rx_pause, &tx_pause);
|
||||
- break;
|
||||
-
|
||||
- /*
|
||||
- * Flow control auto-negotiation is not supported for fiber and
|
||||
- * backplane media type.
|
||||
- */
|
||||
- case HNS3_MEDIA_TYPE_FIBER:
|
||||
- case HNS3_MEDIA_TYPE_BACKPLANE:
|
||||
- hns3_err(hw, "autoneg FC mode can't be obtained, but flow control auto-negotiation is enabled.");
|
||||
- current_mode = hw->requested_fc_mode;
|
||||
- goto out;
|
||||
- default:
|
||||
- hns3_err(hw, "autoneg FC mode can't be obtained for unknown media type(%u).",
|
||||
- hw->mac.media_type);
|
||||
- current_mode = HNS3_FC_NONE;
|
||||
- goto out;
|
||||
- }
|
||||
+ hns3_get_autoneg_rxtx_pause(hw, &rx_pause, &tx_pause);
|
||||
|
||||
if (rx_pause && tx_pause)
|
||||
current_mode = HNS3_FC_FULL;
|
||||
@@ -5239,7 +5208,6 @@ hns3_get_autoneg_fc_mode(struct hns3_hw *hw)
|
||||
else
|
||||
current_mode = HNS3_FC_NONE;
|
||||
|
||||
-out:
|
||||
return current_mode;
|
||||
}
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
|
||||
index 8268dba788..88146f5054 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.h
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.h
|
||||
@@ -892,6 +892,7 @@ enum hns3_dev_cap {
|
||||
HNS3_DEV_SUPPORT_RAS_IMP_B,
|
||||
HNS3_DEV_SUPPORT_TM_B,
|
||||
HNS3_DEV_SUPPORT_VF_VLAN_FLT_MOD_B,
|
||||
+ HNS3_DEV_SUPPORT_FC_AUTO_B,
|
||||
};
|
||||
|
||||
#define hns3_dev_get_support(hw, _name) \
|
||||
--
|
||||
2.23.0
|
||||
|
||||
52
0290-net-hns3-fix-variable-type-mismatch.patch
Normal file
52
0290-net-hns3-fix-variable-type-mismatch.patch
Normal file
@ -0,0 +1,52 @@
|
||||
From cae0ec81453b65080372918ea266b3e571fc6197 Mon Sep 17 00:00:00 2001
|
||||
From: Dengdui Huang <huangdengdui@huawei.com>
|
||||
Date: Mon, 22 May 2023 21:17:38 +0800
|
||||
Subject: net/hns3: fix variable type mismatch
|
||||
|
||||
[ upstream commit 84b195b9348810cb9ee2ac71f61ee4331b27d552 ]
|
||||
|
||||
Loop conditions are compared with different variable types,
|
||||
which may cause overflow risks.
|
||||
|
||||
Fixes: 67d010346933 ("net/hns3: adjust data type of some variables")
|
||||
Fixes: 6ee07e3cb589 ("net/hns3: fix insecure way to query MAC statistics")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
|
||||
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_regs.c | 3 ++-
|
||||
drivers/net/hns3/hns3_stats.c | 2 +-
|
||||
2 files changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_regs.c b/drivers/net/hns3/hns3_regs.c
|
||||
index 33392fd1f0..5d6f92e4bb 100644
|
||||
--- a/drivers/net/hns3/hns3_regs.c
|
||||
+++ b/drivers/net/hns3/hns3_regs.c
|
||||
@@ -294,8 +294,9 @@ hns3_direct_access_regs(struct hns3_hw *hw, uint32_t *data)
|
||||
struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw);
|
||||
uint32_t *origin_data_ptr = data;
|
||||
uint32_t reg_offset;
|
||||
- uint16_t i, j;
|
||||
size_t reg_num;
|
||||
+ uint16_t j;
|
||||
+ size_t i;
|
||||
|
||||
/* fetching per-PF registers values from PF PCIe register space */
|
||||
reg_num = sizeof(cmdq_reg_addrs) / sizeof(uint32_t);
|
||||
diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c
|
||||
index bad65fcbed..c2e692a2c5 100644
|
||||
--- a/drivers/net/hns3/hns3_stats.c
|
||||
+++ b/drivers/net/hns3/hns3_stats.c
|
||||
@@ -317,7 +317,7 @@ hns3_update_mac_stats(struct hns3_hw *hw)
|
||||
uint32_t stats_iterms;
|
||||
uint64_t *desc_data;
|
||||
uint32_t desc_num;
|
||||
- uint16_t i;
|
||||
+ uint32_t i;
|
||||
int ret;
|
||||
|
||||
/* The first desc has a 64-bit header, so need to consider it. */
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -0,0 +1,67 @@
|
||||
From 307e0a26dd0c00b0e600e97c975f0e9d71b175a3 Mon Sep 17 00:00:00 2001
|
||||
From: Chengwen Feng <fengchengwen@huawei.com>
|
||||
Date: Mon, 22 May 2023 21:17:39 +0800
|
||||
Subject: net/hns3: fix Rx multiple firmware reset interrupts
|
||||
|
||||
[ upstream commit 312dd216fe75173016a4c5edce60bb1bea988315 ]
|
||||
|
||||
In the firmware (also known as IMP) reset scenario, driver interrupt
|
||||
processing and firmware watchdog initialization are asynchronous.
|
||||
|
||||
If the driver interrupt processing is faster than firmware watchdog
|
||||
initialization (that is, the driver clears the firmware reset
|
||||
interrupt source before the firmware watchdog is initialized), the
|
||||
driver will receive multiple firmware reset interrupts.
|
||||
|
||||
In the Kunpeng 920 platform, the above situation does not exist. But
|
||||
it does on the newer platforms. So we add 5ms delay before drivers
|
||||
clears the IMP reset interrupt source.
|
||||
|
||||
As for the impact of 5ms, the number of PFs managed by a firmware is
|
||||
limited. Therefore, even if a DPDK process takes over all the PFs
|
||||
which managed by the firmware, the delay is controllable.
|
||||
|
||||
Fixes: ee930d38ffca ("net/hns3: fix timing of clearing interrupt source")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
|
||||
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index 8a7f6cc7be..c0df8f5d97 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -286,6 +286,19 @@ hns3_handle_mac_tnl(struct hns3_hw *hw)
|
||||
}
|
||||
}
|
||||
|
||||
+static void
|
||||
+hns3_delay_before_clear_event_cause(struct hns3_hw *hw, uint32_t event_type, uint32_t regclr)
|
||||
+{
|
||||
+#define IMPRESET_WAIT_MS_TIME 5
|
||||
+
|
||||
+ if (event_type == HNS3_VECTOR0_EVENT_RST &&
|
||||
+ regclr & BIT(HNS3_VECTOR0_IMPRESET_INT_B) &&
|
||||
+ hw->revision >= PCI_REVISION_ID_HIP09_A) {
|
||||
+ rte_delay_ms(IMPRESET_WAIT_MS_TIME);
|
||||
+ hns3_dbg(hw, "wait firmware watchdog initialization completed.");
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void
|
||||
hns3_interrupt_handler(void *param)
|
||||
{
|
||||
@@ -305,6 +318,7 @@ hns3_interrupt_handler(void *param)
|
||||
vector0_int = hns3_read_dev(hw, HNS3_VECTOR0_OTHER_INT_STS_REG);
|
||||
ras_int = hns3_read_dev(hw, HNS3_RAS_PF_OTHER_INT_STS_REG);
|
||||
cmdq_int = hns3_read_dev(hw, HNS3_VECTOR0_CMDQ_SRC_REG);
|
||||
+ hns3_delay_before_clear_event_cause(hw, event_cause, clearval);
|
||||
hns3_clear_event_cause(hw, event_cause, clearval);
|
||||
/* vector 0 interrupt is shared with reset and mailbox source events. */
|
||||
if (event_cause == HNS3_VECTOR0_EVENT_ERR) {
|
||||
--
|
||||
2.23.0
|
||||
|
||||
132
0292-net-hns3-add-Tx-Rx-descriptor-logs.patch
Normal file
132
0292-net-hns3-add-Tx-Rx-descriptor-logs.patch
Normal file
@ -0,0 +1,132 @@
|
||||
From 23e9f9ec10d6ef2cbb794d55c0018c76e393a9b0 Mon Sep 17 00:00:00 2001
|
||||
From: Dengdui Huang <huangdengdui@huawei.com>
|
||||
Date: Mon, 22 May 2023 21:17:40 +0800
|
||||
Subject: net/hns3: add Tx/Rx descriptor logs
|
||||
|
||||
[ upstream commit 7cd4df57fb216489979528d603d39a7a5d1529da ]
|
||||
|
||||
Add Tx/Rx descriptor logs, controlled by 'RTE_ETHDEV_DEBUG_RX/TX'
|
||||
compile time flag with 'pmd.net.hns3.rx/tx' log type.
|
||||
|
||||
Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
|
||||
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 6 ++++++
|
||||
drivers/net/hns3/hns3_logs.h | 18 ++++++++++++++++++
|
||||
drivers/net/hns3/hns3_rxtx.c | 4 ++++
|
||||
drivers/net/hns3/hns3_rxtx.h | 29 +++++++++++++++++++++++++++++
|
||||
4 files changed, 57 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index c0df8f5d97..2fb9e68039 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -6625,3 +6625,9 @@ RTE_PMD_REGISTER_PARAM_STRING(net_hns3,
|
||||
HNS3_DEVARG_MBX_TIME_LIMIT_MS "=<uint16> ");
|
||||
RTE_LOG_REGISTER_SUFFIX(hns3_logtype_init, init, NOTICE);
|
||||
RTE_LOG_REGISTER_SUFFIX(hns3_logtype_driver, driver, NOTICE);
|
||||
+#ifdef RTE_ETHDEV_DEBUG_RX
|
||||
+RTE_LOG_REGISTER_SUFFIX(hns3_logtype_rx, rx, DEBUG);
|
||||
+#endif
|
||||
+#ifdef RTE_ETHDEV_DEBUG_TX
|
||||
+RTE_LOG_REGISTER_SUFFIX(hns3_logtype_tx, tx, DEBUG);
|
||||
+#endif
|
||||
diff --git a/drivers/net/hns3/hns3_logs.h b/drivers/net/hns3/hns3_logs.h
|
||||
index c880f752ab..47d3a13220 100644
|
||||
--- a/drivers/net/hns3/hns3_logs.h
|
||||
+++ b/drivers/net/hns3/hns3_logs.h
|
||||
@@ -31,4 +31,22 @@ extern int hns3_logtype_driver;
|
||||
#define hns3_dbg(hw, fmt, args...) \
|
||||
PMD_DRV_LOG_RAW(hw, RTE_LOG_DEBUG, fmt "\n", ## args)
|
||||
|
||||
+#ifdef RTE_ETHDEV_DEBUG_RX
|
||||
+extern int hns3_logtype_rx;
|
||||
+#define PMD_RX_LOG(hw, level, fmt, args...) \
|
||||
+ rte_log(RTE_LOG_ ## level, hns3_logtype_rx, "%s %s(): " fmt "\n", \
|
||||
+ (hw)->data->name, __func__, ## args)
|
||||
+#else
|
||||
+#define PMD_RX_LOG(hw, level, fmt, args...) do { } while (0)
|
||||
+#endif
|
||||
+
|
||||
+#ifdef RTE_ETHDEV_DEBUG_TX
|
||||
+extern int hns3_logtype_tx;
|
||||
+#define PMD_TX_LOG(hw, level, fmt, args...) \
|
||||
+ rte_log(RTE_LOG_ ## level, hns3_logtype_tx, "%s %s(): " fmt "\n", \
|
||||
+ (hw)->data->name, __func__, ## args)
|
||||
+#else
|
||||
+#define PMD_TX_LOG(hw, level, fmt, args...) do { } while (0)
|
||||
+#endif
|
||||
+
|
||||
#endif /* HNS3_LOGS_H */
|
||||
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
|
||||
index aaf0a06ca6..e055b5415d 100644
|
||||
--- a/drivers/net/hns3/hns3_rxtx.c
|
||||
+++ b/drivers/net/hns3/hns3_rxtx.c
|
||||
@@ -2618,6 +2618,7 @@ hns3_recv_scattered_pkts(void *rx_queue,
|
||||
*/
|
||||
rxd = rxdp[(bd_base_info & (1u << HNS3_RXD_VLD_B)) -
|
||||
(1u << HNS3_RXD_VLD_B)];
|
||||
+ RX_BD_LOG(&rxq->hns->hw, DEBUG, &rxd);
|
||||
|
||||
nmb = hns3_rx_alloc_buffer(rxq);
|
||||
if (unlikely(nmb == NULL)) {
|
||||
@@ -4274,6 +4275,8 @@ hns3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
|
||||
tx_next_use = 0;
|
||||
tx_bak_pkt = txq->sw_ring;
|
||||
}
|
||||
+ if (m_seg != NULL)
|
||||
+ TX_BD_LOG(&txq->hns->hw, DEBUG, desc);
|
||||
|
||||
i++;
|
||||
} while (m_seg != NULL);
|
||||
@@ -4281,6 +4284,7 @@ hns3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
|
||||
/* Add end flag for the last Tx Buffer Descriptor */
|
||||
desc->tx.tp_fe_sc_vld_ra_ri |=
|
||||
rte_cpu_to_le_16(BIT(HNS3_TXD_FE_B));
|
||||
+ TX_BD_LOG(&txq->hns->hw, DEBUG, desc);
|
||||
|
||||
/* Increment bytes counter */
|
||||
txq->basic_stats.bytes += tx_pkt->pkt_len;
|
||||
diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h
|
||||
index 7685ac2ea3..b6a6513307 100644
|
||||
--- a/drivers/net/hns3/hns3_rxtx.h
|
||||
+++ b/drivers/net/hns3/hns3_rxtx.h
|
||||
@@ -553,6 +553,35 @@ struct hns3_tx_queue {
|
||||
bool enabled; /* indicate if Tx queue has been enabled */
|
||||
};
|
||||
|
||||
+#define RX_BD_LOG(hw, level, rxdp) \
|
||||
+ PMD_RX_LOG(hw, level, "Rx descriptor: " \
|
||||
+ "l234_info=%#x pkt_len=%u size=%u rss_hash=%#x fd_id=%u vlan_tag=%u " \
|
||||
+ "o_dm_vlan_id_fb=%#x ot_vlan_tag=%u bd_base_info=%#x", \
|
||||
+ rte_le_to_cpu_32((rxdp)->rx.l234_info), \
|
||||
+ rte_le_to_cpu_16((rxdp)->rx.pkt_len), \
|
||||
+ rte_le_to_cpu_16((rxdp)->rx.size), \
|
||||
+ rte_le_to_cpu_32((rxdp)->rx.rss_hash), \
|
||||
+ rte_le_to_cpu_16((rxdp)->rx.fd_id), \
|
||||
+ rte_le_to_cpu_16((rxdp)->rx.vlan_tag), \
|
||||
+ rte_le_to_cpu_16((rxdp)->rx.o_dm_vlan_id_fb), \
|
||||
+ rte_le_to_cpu_16((rxdp)->rx.ot_vlan_tag), \
|
||||
+ rte_le_to_cpu_32((rxdp)->rx.bd_base_info))
|
||||
+
|
||||
+#define TX_BD_LOG(hw, level, txdp) \
|
||||
+ PMD_TX_LOG(hw, level, "Tx descriptor: " \
|
||||
+ "vlan_tag=%u send_size=%u type_cs_vlan_tso_len=%#x outer_vlan_tag=%u " \
|
||||
+ "tv=%#x ol_type_vlan_len_msec=%#x paylen_fd_dop_ol4cs=%#x " \
|
||||
+ "tp_fe_sc_vld_ra_ri=%#x ckst_mss=%u", \
|
||||
+ rte_le_to_cpu_16((txdp)->tx.vlan_tag), \
|
||||
+ rte_le_to_cpu_16((txdp)->tx.send_size), \
|
||||
+ rte_le_to_cpu_32((txdp)->tx.type_cs_vlan_tso_len), \
|
||||
+ rte_le_to_cpu_16((txdp)->tx.outer_vlan_tag), \
|
||||
+ rte_le_to_cpu_16((txdp)->tx.tv), \
|
||||
+ rte_le_to_cpu_32((txdp)->tx.ol_type_vlan_len_msec), \
|
||||
+ rte_le_to_cpu_32((txdp)->tx.paylen_fd_dop_ol4cs), \
|
||||
+ rte_le_to_cpu_16((txdp)->tx.tp_fe_sc_vld_ra_ri), \
|
||||
+ rte_le_to_cpu_16((txdp)->tx.ckst_mss))
|
||||
+
|
||||
#define HNS3_GET_TX_QUEUE_PEND_BD_NUM(txq) \
|
||||
((txq)->nb_tx_desc - 1 - (txq)->tx_bd_ready)
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
20
dpdk.spec
20
dpdk.spec
@ -1,6 +1,6 @@
|
||||
Name: dpdk
|
||||
Version: 21.11
|
||||
Release: 42
|
||||
Release: 43
|
||||
Packager: packaging@6wind.com
|
||||
URL: http://dpdk.org
|
||||
%global source_version 21.11
|
||||
@ -303,6 +303,14 @@ Patch9281: 0281-net-hns3-fix-empty-devargs-parsing.patch
|
||||
Patch9282: 0282-net-virtio-fix-empty-devargs-parsing.patch
|
||||
Patch9283: 0283-dma-skeleton-fix-empty-devargs-parsing.patch
|
||||
Patch9284: 0284-raw-skeleton-fix-empty-devargs-parsing.patch
|
||||
Patch9285: 0285-net-hns3-simplify-hardware-checksum-offloading.patch
|
||||
Patch9286: 0286-net-hns3-support-dump-media-type.patch
|
||||
Patch9287: 0287-ethdev-fix-one-address-occupies-two-entries-in-MAC-a.patch
|
||||
Patch9288: 0288-net-hns3-fix-never-set-MAC-flow-control.patch
|
||||
Patch9289: 0289-net-hns3-add-flow-control-autoneg-for-fiber-port.patch
|
||||
Patch9290: 0290-net-hns3-fix-variable-type-mismatch.patch
|
||||
Patch9291: 0291-net-hns3-fix-Rx-multiple-firmware-reset-interrupts.patch
|
||||
Patch9292: 0292-net-hns3-add-Tx-Rx-descriptor-logs.patch
|
||||
|
||||
Summary: Data Plane Development Kit core
|
||||
Group: System Environment/Libraries
|
||||
@ -450,6 +458,16 @@ strip -g $RPM_BUILD_ROOT/lib/modules/%{kern_devel_ver}/extra/dpdk/igb_uio.ko
|
||||
/usr/sbin/depmod
|
||||
|
||||
%changelog
|
||||
* Wed May 24 2023 chenjiji <chenjiji09@163.com> - 21.11-43
|
||||
Sync some patchs from upstreaming for hns3 pmd and modifies
|
||||
are as follow:
|
||||
1. support flow control autoneg for fiber port
|
||||
2. support simplify hardware checksum offloading
|
||||
3. support dump media type
|
||||
4. add Tx Rx descriptor logs
|
||||
5. fix Rx multiple firmware reset interrupts
|
||||
6. ethdev: fix one address occupies two entries in MAC addrs
|
||||
|
||||
* Thu Apr 27 2023 chenjiji <chenjiji09@163.com> - 21.11-42
|
||||
- fix empty devargs parsing
|
||||
Sync some patchs from upstreaming and modifies are as
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user