提交 2bcb9bfd 编写于 作者: S shenjian 提交者: Xie XiuQi

net: hns3: fix max ring bd number

driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

There is a limitation in hardware, if driver stop fetching packets
from rx ring, and the max ring bd number is set to 32768. Then
the FBD register value will remain 32768, which may block the hardware
receive unit.

This patch fixes it by reduce the max ring bd number to 32760.
Signed-off-by: Nshenjian (K) <shenjian15@huawei.com>
Reviewed-by: Nlipeng <lipeng321@huawei.com>
Reviewed-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 26e713d8
...@@ -75,7 +75,7 @@ enum hns3_nic_state { ...@@ -75,7 +75,7 @@ enum hns3_nic_state {
#define HNS3_TX_TIMEOUT (5 * HZ) #define HNS3_TX_TIMEOUT (5 * HZ)
#define HNS3_RING_NAME_LEN 16 #define HNS3_RING_NAME_LEN 16
#define HNS3_BUFFER_SIZE_2048 2048 #define HNS3_BUFFER_SIZE_2048 2048
#define HNS3_RING_MAX_PENDING 32768 #define HNS3_RING_MAX_PENDING 32760
#define HNS3_RING_MIN_PENDING 24 #define HNS3_RING_MIN_PENDING 24
#define HNS3_RING_BD_MULTIPLE 8 #define HNS3_RING_BD_MULTIPLE 8
/* max frame size of mac */ /* max frame size of mac */
......
...@@ -908,6 +908,9 @@ static struct hns3_enet_ring *hns3_backup_ringparam(struct hns3_nic_priv *priv) ...@@ -908,6 +908,9 @@ static struct hns3_enet_ring *hns3_backup_ringparam(struct hns3_nic_priv *priv)
static int hns3_check_ringparam(struct net_device *ndev, static int hns3_check_ringparam(struct net_device *ndev,
struct ethtool_ringparam *param) struct ethtool_ringparam *param)
{ {
if (hns3_nic_resetting(ndev))
return -EBUSY;
if (param->rx_mini_pending || param->rx_jumbo_pending) if (param->rx_mini_pending || param->rx_jumbo_pending)
return -EINVAL; return -EINVAL;
...@@ -975,7 +978,7 @@ static int hns3_set_ringparam(struct net_device *ndev, ...@@ -975,7 +978,7 @@ static int hns3_set_ringparam(struct net_device *ndev,
memcpy(priv->ring_data[i].ring, &tmp_rings[i], memcpy(priv->ring_data[i].ring, &tmp_rings[i],
sizeof(struct hns3_enet_ring)); sizeof(struct hns3_enet_ring));
} else { } else {
for (i = 0; i < h->kinfo.num_tqps; i++) for (i = 0; i < h->kinfo.num_tqps * 2; i++)
hns3_fini_ring(&tmp_rings[i]); hns3_fini_ring(&tmp_rings[i]);
} }
......
...@@ -2759,6 +2759,7 @@ static int hclge_get_sfp_info(struct hclge_dev *hdev, struct hclge_mac *mac) ...@@ -2759,6 +2759,7 @@ static int hclge_get_sfp_info(struct hclge_dev *hdev, struct hclge_mac *mac)
mac->speed_ability = le32_to_cpu(resp->speed_ability); mac->speed_ability = le32_to_cpu(resp->speed_ability);
mac->autoneg = resp->autoneg; mac->autoneg = resp->autoneg;
mac->support_autoneg = resp->autoneg_ability; mac->support_autoneg = resp->autoneg_ability;
mac->speed_type = QUERY_ACTIVE_SPEED;
if (!resp->active_fec) if (!resp->active_fec)
mac->fec_mode = 0; mac->fec_mode = 0;
else else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册