Commit 454784d8 authored by Daode Huang's avatar Daode Huang Committed by David S. Miller

net: hns: delete redundancy ring enable operations

When network interface is enabled, the ring enable operation is
conducted twice. This patch deletes the redundancy code of ring enable,
and integrates hnae_ae_ops.toggle_queue_status other functions to
hns_ae_start.
Signed-off-by: default avatarDaode Huang <huangdaode@hisilicon.com>
Signed-off-by: default avatarYisen Zhuang <Yisen.Zhuang@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ad59a17f
...@@ -400,7 +400,6 @@ int hnae_ae_register(struct hnae_ae_dev *hdev, struct module *owner) ...@@ -400,7 +400,6 @@ int hnae_ae_register(struct hnae_ae_dev *hdev, struct module *owner)
if (!hdev->ops || !hdev->ops->get_handle || if (!hdev->ops || !hdev->ops->get_handle ||
!hdev->ops->toggle_ring_irq || !hdev->ops->toggle_ring_irq ||
!hdev->ops->toggle_queue_status ||
!hdev->ops->get_status || !hdev->ops->adjust_link) !hdev->ops->get_status || !hdev->ops->adjust_link)
return -EINVAL; return -EINVAL;
......
...@@ -454,7 +454,6 @@ struct hnae_ae_ops { ...@@ -454,7 +454,6 @@ struct hnae_ae_ops {
int (*get_info)(struct hnae_handle *handle, int (*get_info)(struct hnae_handle *handle,
u8 *auto_neg, u16 *speed, u8 *duplex); u8 *auto_neg, u16 *speed, u8 *duplex);
void (*toggle_ring_irq)(struct hnae_ring *ring, u32 val); void (*toggle_ring_irq)(struct hnae_ring *ring, u32 val);
void (*toggle_queue_status)(struct hnae_queue *queue, u32 val);
void (*adjust_link)(struct hnae_handle *handle, int speed, int duplex); void (*adjust_link)(struct hnae_handle *handle, int speed, int duplex);
int (*set_loopback)(struct hnae_handle *handle, int (*set_loopback)(struct hnae_handle *handle,
enum hnae_loop loop_mode, int en); enum hnae_loop loop_mode, int en);
......
...@@ -247,12 +247,21 @@ static void hns_ae_set_tso_stats(struct hnae_handle *handle, int enable) ...@@ -247,12 +247,21 @@ static void hns_ae_set_tso_stats(struct hnae_handle *handle, int enable)
static int hns_ae_start(struct hnae_handle *handle) static int hns_ae_start(struct hnae_handle *handle)
{ {
int ret; int ret;
int k;
struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle);
ret = hns_mac_vm_config_bc_en(mac_cb, 0, true); ret = hns_mac_vm_config_bc_en(mac_cb, 0, true);
if (ret) if (ret)
return ret; return ret;
for (k = 0; k < handle->q_num; k++) {
if (AE_IS_VER1(mac_cb->dsaf_dev->dsaf_ver))
hns_rcb_int_clr_hw(handle->qs[k],
RCB_INT_FLAG_TX | RCB_INT_FLAG_RX);
else
hns_rcbv2_int_clr_hw(handle->qs[k],
RCB_INT_FLAG_TX | RCB_INT_FLAG_RX);
}
hns_ae_ring_enable_all(handle, 1); hns_ae_ring_enable_all(handle, 1);
msleep(100); msleep(100);
...@@ -313,18 +322,6 @@ static void hns_aev2_toggle_ring_irq(struct hnae_ring *ring, u32 mask) ...@@ -313,18 +322,6 @@ static void hns_aev2_toggle_ring_irq(struct hnae_ring *ring, u32 mask)
hns_rcbv2_int_ctrl_hw(ring->q, flag, mask); hns_rcbv2_int_ctrl_hw(ring->q, flag, mask);
} }
static void hns_ae_toggle_queue_status(struct hnae_queue *queue, u32 val)
{
struct dsaf_device *dsaf_dev = hns_ae_get_dsaf_dev(queue->dev);
if (AE_IS_VER1(dsaf_dev->dsaf_ver))
hns_rcb_int_clr_hw(queue, RCB_INT_FLAG_TX | RCB_INT_FLAG_RX);
else
hns_rcbv2_int_clr_hw(queue, RCB_INT_FLAG_TX | RCB_INT_FLAG_RX);
hns_rcb_start(queue, val);
}
static int hns_ae_get_link_status(struct hnae_handle *handle) static int hns_ae_get_link_status(struct hnae_handle *handle)
{ {
u32 link_status; u32 link_status;
...@@ -808,7 +805,6 @@ static struct hnae_ae_ops hns_dsaf_ops = { ...@@ -808,7 +805,6 @@ static struct hnae_ae_ops hns_dsaf_ops = {
.stop = hns_ae_stop, .stop = hns_ae_stop,
.reset = hns_ae_reset, .reset = hns_ae_reset,
.toggle_ring_irq = hns_ae_toggle_ring_irq, .toggle_ring_irq = hns_ae_toggle_ring_irq,
.toggle_queue_status = hns_ae_toggle_queue_status,
.get_status = hns_ae_get_link_status, .get_status = hns_ae_get_link_status,
.get_info = hns_ae_get_mac_info, .get_info = hns_ae_get_mac_info,
.adjust_link = hns_ae_adjust_link, .adjust_link = hns_ae_adjust_link,
......
...@@ -1200,7 +1200,7 @@ static int hns_nic_net_up(struct net_device *ndev) ...@@ -1200,7 +1200,7 @@ static int hns_nic_net_up(struct net_device *ndev)
{ {
struct hns_nic_priv *priv = netdev_priv(ndev); struct hns_nic_priv *priv = netdev_priv(ndev);
struct hnae_handle *h = priv->ae_handle; struct hnae_handle *h = priv->ae_handle;
int i, j, k; int i, j;
int ret; int ret;
ret = hns_nic_init_irq(priv); ret = hns_nic_init_irq(priv);
...@@ -1215,9 +1215,6 @@ static int hns_nic_net_up(struct net_device *ndev) ...@@ -1215,9 +1215,6 @@ static int hns_nic_net_up(struct net_device *ndev)
goto out_has_some_queues; goto out_has_some_queues;
} }
for (k = 0; k < h->q_num; k++)
h->dev->ops->toggle_queue_status(h->qs[k], 1);
ret = h->dev->ops->set_mac_addr(h, ndev->dev_addr); ret = h->dev->ops->set_mac_addr(h, ndev->dev_addr);
if (ret) if (ret)
goto out_set_mac_addr_err; goto out_set_mac_addr_err;
...@@ -1237,8 +1234,6 @@ static int hns_nic_net_up(struct net_device *ndev) ...@@ -1237,8 +1234,6 @@ static int hns_nic_net_up(struct net_device *ndev)
out_start_err: out_start_err:
netif_stop_queue(ndev); netif_stop_queue(ndev);
out_set_mac_addr_err: out_set_mac_addr_err:
for (k = 0; k < h->q_num; k++)
h->dev->ops->toggle_queue_status(h->qs[k], 0);
out_has_some_queues: out_has_some_queues:
for (j = i - 1; j >= 0; j--) for (j = i - 1; j >= 0; j--)
hns_nic_ring_close(ndev, j); hns_nic_ring_close(ndev, j);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment