未验证 提交 5f3ca709 编写于 作者: O openeuler-ci-bot 提交者: Gitee

!1570 【openEuler-1.0-LTS】net: hns3: bugfixes for hns3 drivers 2023.07.29

Merge Pull Request from: @liuyonglong86 
 
This patch set fix some bugs found on hns3 drivers and modify the
driver version. 
 
Link:https://gitee.com/openeuler/kernel/pulls/1570 

Reviewed-by: Zhang Changzhong <zhangchangzhong@huawei.com> 
Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com> 
......@@ -32,7 +32,7 @@
#include <linux/types.h>
#include <net/pkt_cls.h>
#define HNAE3_MOD_VERSION "22.9.2"
#define HNAE3_MOD_VERSION "23.7.1"
#define HNAE3_MIN_VECTOR_NUM 2 /* first one for misc, another for IO */
......
......@@ -4,7 +4,7 @@
#ifndef __HNS3_CAE_VERSION_H__
#define __HNS3_CAE_VERSION_H__
#define HNS3_CAE_MOD_VERSION "22.9.2"
#define HNS3_CAE_MOD_VERSION "23.7.1"
#define CMT_ID_LEN 8
#define RESV_LEN 3
......
......@@ -1440,10 +1440,14 @@ static void hns3_tx_doorbell(struct hns3_enet_ring *ring, int num,
if (!ring->pending_buf)
return;
/* This smp_store_release() pairs with smp_load_aquire() in
* hns3_nic_reclaim_desc(). Ensure that the BD valid bit is updated.
*/
smp_store_release(&ring->last_to_use, ring->next_to_use);
writel(ring->pending_buf,
ring->tqp->io_base + HNS3_RING_TX_RING_TAIL_REG);
ring->pending_buf = 0;
WRITE_ONCE(ring->last_to_use, ring->next_to_use);
}
netdev_tx_t hns3_nic_net_xmit(struct sk_buff *skb, struct net_device *netdev)
......@@ -2629,9 +2633,8 @@ static void hns3_reuse_buffer(struct hns3_enet_ring *ring, int i)
static bool hns3_nic_reclaim_desc(struct hns3_enet_ring *ring,
int *bytes, int *pkts, int budget)
{
/* pair with ring->last_to_use update in hns3_tx_doorbell(),
* smp_store_release() is not used in hns3_tx_doorbell() because
* the doorbell operation already have the needed barrier operation.
/* This smp_load_acquire() pairs with smp_store_release() in
* hns3_tx_doorbell().
*/
int ltu = smp_load_acquire(&ring->last_to_use);
int ntc = ring->next_to_clean;
......@@ -3132,15 +3135,26 @@ static int hns3_set_gro_and_checksum(struct hns3_enet_ring *ring,
}
static void hns3_set_rx_skb_rss_type(struct hns3_enet_ring *ring,
struct sk_buff *skb, u32 rss_hash)
struct sk_buff *skb, u32 rss_hash,
u32 l234info)
{
enum pkt_hash_types rss_type = PKT_HASH_TYPE_NONE;
struct hnae3_handle *handle = ring->tqp->handle;
enum pkt_hash_types rss_type;
int l3_type;
int l4_type;
if (rss_hash)
rss_type = handle->kinfo.rss_type;
else
rss_type = PKT_HASH_TYPE_NONE;
l3_type = hnae3_get_field(l234info, HNS3_RXD_L3ID_M, HNS3_RXD_L3ID_S);
l4_type = hnae3_get_field(l234info, HNS3_RXD_L4ID_M, HNS3_RXD_L4ID_S);
if (l3_type == HNS3_L3_TYPE_IPV4 ||
l3_type == HNS3_L3_TYPE_IPV6) {
if (l4_type == HNS3_L4_TYPE_UDP ||
l4_type == HNS3_L4_TYPE_TCP ||
l4_type == HNS3_L4_TYPE_SCTP)
rss_type = PKT_HASH_TYPE_L4;
else if (l4_type == HNS3_L4_TYPE_IGMP ||
l4_type == HNS3_L4_TYPE_ICMP)
rss_type = PKT_HASH_TYPE_L3;
}
skb_set_hash(skb, rss_hash, rss_type);
}
......@@ -3218,7 +3232,8 @@ static int hns3_handle_bdinfo(struct hns3_enet_ring *ring, struct sk_buff *skb)
ring->tqp_vector->rx_group.total_bytes += len;
hns3_set_rx_skb_rss_type(ring, skb, le32_to_cpu(desc->rx.rss_hash));
hns3_set_rx_skb_rss_type(ring, skb, le32_to_cpu(desc->rx.rss_hash),
l234info);
return 0;
}
......
......@@ -8,7 +8,7 @@
#include "hnae3.h"
#define HNS3_MOD_VERSION "22.9.2"
#define HNS3_MOD_VERSION "23.7.1"
extern char hns3_driver_version[];
......
......@@ -159,7 +159,7 @@ bool hclge_reset_end_it(struct hnae3_handle *handle, bool done)
nic_call_event(netdev, HNAE3_RESET_DONE_CUSTOM);
}
if (hdev->reset_fail_cnt >= HCLGE_RESET_MAX_FAIL_CNT) {
if (hdev->rst_stats.reset_fail_cnt >= HCLGE_RESET_MAX_FAIL_CNT) {
dev_err(&hdev->pdev->dev, "IT Report Reset fail!\n");
if (nic_event_call) {
if (hdev->reset_type == HNAE3_FUNC_RESET)
......
......@@ -12,7 +12,7 @@
#include "hclge_cmd.h"
#include "hnae3.h"
#define HCLGE_MOD_VERSION "22.9.2"
#define HCLGE_MOD_VERSION "23.7.1"
#define HCLGE_DRIVER_NAME "hclge"
#define HCLGE_MAX_PF_NUM 8
......
......@@ -10,7 +10,7 @@
#include "hclgevf_cmd.h"
#include "hnae3.h"
#define HCLGEVF_MOD_VERSION "22.9.2"
#define HCLGEVF_MOD_VERSION "23.7.1"
#define HCLGEVF_DRIVER_NAME "hclgevf"
#define HCLGEVF_MAX_VLAN_ID 4095
......
......@@ -82,6 +82,9 @@ static int hclgevf_get_mbx_resp(struct hclgevf_dev *hdev, u16 code0, u16 code1,
i++;
}
/* ensure additional_info will be seen after received_resp */
smp_rmb();
if (i >= HCLGEVF_MAX_TRY_TIMES) {
dev_err(&hdev->pdev->dev,
"VF could not get mbx(%u,%u) resp(=%d) from PF in %d tries\n",
......@@ -136,7 +139,8 @@ int hclgevf_send_mbx_msg(struct hclgevf_dev *hdev,
memcpy(&req->msg, send_msg, sizeof(struct hclge_vf_to_pf_msg));
trace_hclge_vf_mbx_send(hdev, req);
if (test_bit(HCLGEVF_STATE_NIC_REGISTERED, &hdev->state))
trace_hclge_vf_mbx_send(hdev, req);
/* synchronous send */
if (need_resp) {
......@@ -239,6 +243,11 @@ void hclgevf_mbx_handler(struct hclgevf_dev *hdev)
temp++;
}
/* ensure additional_info will be seen before setting
* received_resp
*/
smp_wmb();
if (req->match_id) {
/* If match_id is not zero, it means PF support
* match_id. If the match_id is right, VF get
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册