Merge branch 'there-are-some-bugfix-for-the-hns3-ethernet-driver'
Jijie Shao says: ==================== There are some bugfix for the HNS3 ethernet driver ==================== Link: https://patch.msgid.link/20250430093052.2400464-1-shaojijie@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -61,7 +61,7 @@ static struct hns3_dbg_cmd_info hns3_dbg_cmd[] = {
|
||||
.name = "tm_qset",
|
||||
.cmd = HNAE3_DBG_CMD_TM_QSET,
|
||||
.dentry = HNS3_DBG_DENTRY_TM,
|
||||
.buf_len = HNS3_DBG_READ_LEN,
|
||||
.buf_len = HNS3_DBG_READ_LEN_1MB,
|
||||
.init = hns3_dbg_common_file_init,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -473,20 +473,14 @@ static void hns3_mask_vector_irq(struct hns3_enet_tqp_vector *tqp_vector,
|
||||
writel(mask_en, tqp_vector->mask_addr);
|
||||
}
|
||||
|
||||
static void hns3_vector_enable(struct hns3_enet_tqp_vector *tqp_vector)
|
||||
static void hns3_irq_enable(struct hns3_enet_tqp_vector *tqp_vector)
|
||||
{
|
||||
napi_enable(&tqp_vector->napi);
|
||||
enable_irq(tqp_vector->vector_irq);
|
||||
|
||||
/* enable vector */
|
||||
hns3_mask_vector_irq(tqp_vector, 1);
|
||||
}
|
||||
|
||||
static void hns3_vector_disable(struct hns3_enet_tqp_vector *tqp_vector)
|
||||
static void hns3_irq_disable(struct hns3_enet_tqp_vector *tqp_vector)
|
||||
{
|
||||
/* disable vector */
|
||||
hns3_mask_vector_irq(tqp_vector, 0);
|
||||
|
||||
disable_irq(tqp_vector->vector_irq);
|
||||
napi_disable(&tqp_vector->napi);
|
||||
cancel_work_sync(&tqp_vector->rx_group.dim.work);
|
||||
@@ -707,11 +701,42 @@ static int hns3_set_rx_cpu_rmap(struct net_device *netdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void hns3_enable_irqs_and_tqps(struct net_device *netdev)
|
||||
{
|
||||
struct hns3_nic_priv *priv = netdev_priv(netdev);
|
||||
struct hnae3_handle *h = priv->ae_handle;
|
||||
u16 i;
|
||||
|
||||
for (i = 0; i < priv->vector_num; i++)
|
||||
hns3_irq_enable(&priv->tqp_vector[i]);
|
||||
|
||||
for (i = 0; i < priv->vector_num; i++)
|
||||
hns3_mask_vector_irq(&priv->tqp_vector[i], 1);
|
||||
|
||||
for (i = 0; i < h->kinfo.num_tqps; i++)
|
||||
hns3_tqp_enable(h->kinfo.tqp[i]);
|
||||
}
|
||||
|
||||
static void hns3_disable_irqs_and_tqps(struct net_device *netdev)
|
||||
{
|
||||
struct hns3_nic_priv *priv = netdev_priv(netdev);
|
||||
struct hnae3_handle *h = priv->ae_handle;
|
||||
u16 i;
|
||||
|
||||
for (i = 0; i < h->kinfo.num_tqps; i++)
|
||||
hns3_tqp_disable(h->kinfo.tqp[i]);
|
||||
|
||||
for (i = 0; i < priv->vector_num; i++)
|
||||
hns3_mask_vector_irq(&priv->tqp_vector[i], 0);
|
||||
|
||||
for (i = 0; i < priv->vector_num; i++)
|
||||
hns3_irq_disable(&priv->tqp_vector[i]);
|
||||
}
|
||||
|
||||
static int hns3_nic_net_up(struct net_device *netdev)
|
||||
{
|
||||
struct hns3_nic_priv *priv = netdev_priv(netdev);
|
||||
struct hnae3_handle *h = priv->ae_handle;
|
||||
int i, j;
|
||||
int ret;
|
||||
|
||||
ret = hns3_nic_reset_all_ring(h);
|
||||
@@ -720,23 +745,13 @@ static int hns3_nic_net_up(struct net_device *netdev)
|
||||
|
||||
clear_bit(HNS3_NIC_STATE_DOWN, &priv->state);
|
||||
|
||||
/* enable the vectors */
|
||||
for (i = 0; i < priv->vector_num; i++)
|
||||
hns3_vector_enable(&priv->tqp_vector[i]);
|
||||
|
||||
/* enable rcb */
|
||||
for (j = 0; j < h->kinfo.num_tqps; j++)
|
||||
hns3_tqp_enable(h->kinfo.tqp[j]);
|
||||
hns3_enable_irqs_and_tqps(netdev);
|
||||
|
||||
/* start the ae_dev */
|
||||
ret = h->ae_algo->ops->start ? h->ae_algo->ops->start(h) : 0;
|
||||
if (ret) {
|
||||
set_bit(HNS3_NIC_STATE_DOWN, &priv->state);
|
||||
while (j--)
|
||||
hns3_tqp_disable(h->kinfo.tqp[j]);
|
||||
|
||||
for (j = i - 1; j >= 0; j--)
|
||||
hns3_vector_disable(&priv->tqp_vector[j]);
|
||||
hns3_disable_irqs_and_tqps(netdev);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -823,17 +838,9 @@ static void hns3_reset_tx_queue(struct hnae3_handle *h)
|
||||
static void hns3_nic_net_down(struct net_device *netdev)
|
||||
{
|
||||
struct hns3_nic_priv *priv = netdev_priv(netdev);
|
||||
struct hnae3_handle *h = hns3_get_handle(netdev);
|
||||
const struct hnae3_ae_ops *ops;
|
||||
int i;
|
||||
|
||||
/* disable vectors */
|
||||
for (i = 0; i < priv->vector_num; i++)
|
||||
hns3_vector_disable(&priv->tqp_vector[i]);
|
||||
|
||||
/* disable rcb */
|
||||
for (i = 0; i < h->kinfo.num_tqps; i++)
|
||||
hns3_tqp_disable(h->kinfo.tqp[i]);
|
||||
hns3_disable_irqs_and_tqps(netdev);
|
||||
|
||||
/* stop ae_dev */
|
||||
ops = priv->ae_handle->ae_algo->ops;
|
||||
@@ -5864,8 +5871,6 @@ int hns3_set_channels(struct net_device *netdev,
|
||||
void hns3_external_lb_prepare(struct net_device *ndev, bool if_running)
|
||||
{
|
||||
struct hns3_nic_priv *priv = netdev_priv(ndev);
|
||||
struct hnae3_handle *h = priv->ae_handle;
|
||||
int i;
|
||||
|
||||
if (!if_running)
|
||||
return;
|
||||
@@ -5876,11 +5881,7 @@ void hns3_external_lb_prepare(struct net_device *ndev, bool if_running)
|
||||
netif_carrier_off(ndev);
|
||||
netif_tx_disable(ndev);
|
||||
|
||||
for (i = 0; i < priv->vector_num; i++)
|
||||
hns3_vector_disable(&priv->tqp_vector[i]);
|
||||
|
||||
for (i = 0; i < h->kinfo.num_tqps; i++)
|
||||
hns3_tqp_disable(h->kinfo.tqp[i]);
|
||||
hns3_disable_irqs_and_tqps(ndev);
|
||||
|
||||
/* delay ring buffer clearing to hns3_reset_notify_uninit_enet
|
||||
* during reset process, because driver may not be able
|
||||
@@ -5896,7 +5897,6 @@ void hns3_external_lb_restore(struct net_device *ndev, bool if_running)
|
||||
{
|
||||
struct hns3_nic_priv *priv = netdev_priv(ndev);
|
||||
struct hnae3_handle *h = priv->ae_handle;
|
||||
int i;
|
||||
|
||||
if (!if_running)
|
||||
return;
|
||||
@@ -5912,11 +5912,7 @@ void hns3_external_lb_restore(struct net_device *ndev, bool if_running)
|
||||
|
||||
clear_bit(HNS3_NIC_STATE_DOWN, &priv->state);
|
||||
|
||||
for (i = 0; i < priv->vector_num; i++)
|
||||
hns3_vector_enable(&priv->tqp_vector[i]);
|
||||
|
||||
for (i = 0; i < h->kinfo.num_tqps; i++)
|
||||
hns3_tqp_enable(h->kinfo.tqp[i]);
|
||||
hns3_enable_irqs_and_tqps(ndev);
|
||||
|
||||
netif_tx_wake_all_queues(ndev);
|
||||
|
||||
|
||||
@@ -440,6 +440,13 @@ static int hclge_ptp_create_clock(struct hclge_dev *hdev)
|
||||
ptp->info.settime64 = hclge_ptp_settime;
|
||||
|
||||
ptp->info.n_alarm = 0;
|
||||
|
||||
spin_lock_init(&ptp->lock);
|
||||
ptp->io_base = hdev->hw.hw.io_base + HCLGE_PTP_REG_OFFSET;
|
||||
ptp->ts_cfg.rx_filter = HWTSTAMP_FILTER_NONE;
|
||||
ptp->ts_cfg.tx_type = HWTSTAMP_TX_OFF;
|
||||
hdev->ptp = ptp;
|
||||
|
||||
ptp->clock = ptp_clock_register(&ptp->info, &hdev->pdev->dev);
|
||||
if (IS_ERR(ptp->clock)) {
|
||||
dev_err(&hdev->pdev->dev,
|
||||
@@ -451,12 +458,6 @@ static int hclge_ptp_create_clock(struct hclge_dev *hdev)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
spin_lock_init(&ptp->lock);
|
||||
ptp->io_base = hdev->hw.hw.io_base + HCLGE_PTP_REG_OFFSET;
|
||||
ptp->ts_cfg.rx_filter = HWTSTAMP_FILTER_NONE;
|
||||
ptp->ts_cfg.tx_type = HWTSTAMP_TX_OFF;
|
||||
hdev->ptp = ptp;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1292,9 +1292,8 @@ static void hclgevf_sync_vlan_filter(struct hclgevf_dev *hdev)
|
||||
rtnl_unlock();
|
||||
}
|
||||
|
||||
static int hclgevf_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable)
|
||||
static int hclgevf_en_hw_strip_rxvtag_cmd(struct hclgevf_dev *hdev, bool enable)
|
||||
{
|
||||
struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
|
||||
struct hclge_vf_to_pf_msg send_msg;
|
||||
|
||||
hclgevf_build_send_msg(&send_msg, HCLGE_MBX_SET_VLAN,
|
||||
@@ -1303,6 +1302,19 @@ static int hclgevf_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable)
|
||||
return hclgevf_send_mbx_msg(hdev, &send_msg, false, NULL, 0);
|
||||
}
|
||||
|
||||
static int hclgevf_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable)
|
||||
{
|
||||
struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
|
||||
int ret;
|
||||
|
||||
ret = hclgevf_en_hw_strip_rxvtag_cmd(hdev, enable);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
hdev->rxvtag_strip_en = enable;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hclgevf_reset_tqp(struct hnae3_handle *handle)
|
||||
{
|
||||
#define HCLGEVF_RESET_ALL_QUEUE_DONE 1U
|
||||
@@ -2204,12 +2216,13 @@ static int hclgevf_rss_init_hw(struct hclgevf_dev *hdev)
|
||||
tc_valid, tc_size);
|
||||
}
|
||||
|
||||
static int hclgevf_init_vlan_config(struct hclgevf_dev *hdev)
|
||||
static int hclgevf_init_vlan_config(struct hclgevf_dev *hdev,
|
||||
bool rxvtag_strip_en)
|
||||
{
|
||||
struct hnae3_handle *nic = &hdev->nic;
|
||||
int ret;
|
||||
|
||||
ret = hclgevf_en_hw_strip_rxvtag(nic, true);
|
||||
ret = hclgevf_en_hw_strip_rxvtag(nic, rxvtag_strip_en);
|
||||
if (ret) {
|
||||
dev_err(&hdev->pdev->dev,
|
||||
"failed to enable rx vlan offload, ret = %d\n", ret);
|
||||
@@ -2879,7 +2892,7 @@ static int hclgevf_reset_hdev(struct hclgevf_dev *hdev)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = hclgevf_init_vlan_config(hdev);
|
||||
ret = hclgevf_init_vlan_config(hdev, hdev->rxvtag_strip_en);
|
||||
if (ret) {
|
||||
dev_err(&hdev->pdev->dev,
|
||||
"failed(%d) to initialize VLAN config\n", ret);
|
||||
@@ -2994,7 +3007,7 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev)
|
||||
goto err_config;
|
||||
}
|
||||
|
||||
ret = hclgevf_init_vlan_config(hdev);
|
||||
ret = hclgevf_init_vlan_config(hdev, true);
|
||||
if (ret) {
|
||||
dev_err(&hdev->pdev->dev,
|
||||
"failed(%d) to initialize VLAN config\n", ret);
|
||||
|
||||
@@ -253,6 +253,7 @@ struct hclgevf_dev {
|
||||
int *vector_irq;
|
||||
|
||||
bool gro_en;
|
||||
bool rxvtag_strip_en;
|
||||
|
||||
unsigned long vlan_del_fail_bmap[BITS_TO_LONGS(VLAN_N_VID)];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user