Commit bded4422 authored by David S. Miller's avatar David S. Miller

Merge branch 'hns3-next'

Lipeng says:

====================
net: hns3: bug fixes & code improvements

This patchset introduces various HNS3 bug fixes, optimizations and code
improvements.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 5908064a 24e750c4
...@@ -837,7 +837,6 @@ static int hclge_parse_func_status(struct hclge_dev *hdev, ...@@ -837,7 +837,6 @@ static int hclge_parse_func_status(struct hclge_dev *hdev,
else else
hdev->flag &= ~HCLGE_FLAG_MAIN; hdev->flag &= ~HCLGE_FLAG_MAIN;
hdev->num_req_vfs = status->vf_num / status->pf_num;
return 0; return 0;
} }
...@@ -4361,6 +4360,8 @@ static int hclge_pci_init(struct hclge_dev *hdev) ...@@ -4361,6 +4360,8 @@ static int hclge_pci_init(struct hclge_dev *hdev)
goto err_clr_master; goto err_clr_master;
} }
hdev->num_req_vfs = pci_sriov_get_totalvfs(pdev);
return 0; return 0;
err_clr_master: err_clr_master:
pci_clear_master(pdev); pci_clear_master(pdev);
......
...@@ -1444,8 +1444,6 @@ static int hns3_alloc_buffer(struct hns3_enet_ring *ring, ...@@ -1444,8 +1444,6 @@ static int hns3_alloc_buffer(struct hns3_enet_ring *ring,
cb->length = hnae_page_size(ring); cb->length = hnae_page_size(ring);
cb->type = DESC_TYPE_PAGE; cb->type = DESC_TYPE_PAGE;
memset(cb->buf, 0, cb->length);
return 0; return 0;
} }
...@@ -1555,7 +1553,7 @@ static int hns3_reserve_buffer_map(struct hns3_enet_ring *ring, ...@@ -1555,7 +1553,7 @@ static int hns3_reserve_buffer_map(struct hns3_enet_ring *ring,
return 0; return 0;
out_with_buf: out_with_buf:
hns3_free_buffers(ring); hns3_free_buffer(ring, cb);
out: out:
return ret; return ret;
} }
...@@ -1595,7 +1593,7 @@ static int hns3_alloc_ring_buffers(struct hns3_enet_ring *ring) ...@@ -1595,7 +1593,7 @@ static int hns3_alloc_ring_buffers(struct hns3_enet_ring *ring)
static void hns3_replace_buffer(struct hns3_enet_ring *ring, int i, static void hns3_replace_buffer(struct hns3_enet_ring *ring, int i,
struct hns3_desc_cb *res_cb) struct hns3_desc_cb *res_cb)
{ {
hns3_map_buffer(ring, &ring->desc_cb[i]); hns3_unmap_buffer(ring, &ring->desc_cb[i]);
ring->desc_cb[i] = *res_cb; ring->desc_cb[i] = *res_cb;
ring->desc[i].addr = cpu_to_le64(ring->desc_cb[i].dma); ring->desc[i].addr = cpu_to_le64(ring->desc_cb[i].dma);
} }
...@@ -1631,7 +1629,7 @@ static int is_valid_clean_head(struct hns3_enet_ring *ring, int h) ...@@ -1631,7 +1629,7 @@ static int is_valid_clean_head(struct hns3_enet_ring *ring, int h)
return u > c ? (h > c && h <= u) : (h > c || h <= u); return u > c ? (h > c && h <= u) : (h > c || h <= u);
} }
int hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget) bool hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget)
{ {
struct net_device *netdev = ring->tqp->handle->kinfo.netdev; struct net_device *netdev = ring->tqp->handle->kinfo.netdev;
struct netdev_queue *dev_queue; struct netdev_queue *dev_queue;
...@@ -1642,7 +1640,7 @@ int hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget) ...@@ -1642,7 +1640,7 @@ int hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget)
rmb(); /* Make sure head is ready before touch any data */ rmb(); /* Make sure head is ready before touch any data */
if (is_ring_empty(ring) || head == ring->next_to_clean) if (is_ring_empty(ring) || head == ring->next_to_clean)
return 0; /* no data to poll */ return true; /* no data to poll */
if (!is_valid_clean_head(ring, head)) { if (!is_valid_clean_head(ring, head)) {
netdev_err(netdev, "wrong head (%d, %d-%d)\n", head, netdev_err(netdev, "wrong head (%d, %d-%d)\n", head,
...@@ -1651,7 +1649,7 @@ int hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget) ...@@ -1651,7 +1649,7 @@ int hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget)
u64_stats_update_begin(&ring->syncp); u64_stats_update_begin(&ring->syncp);
ring->stats.io_err_cnt++; ring->stats.io_err_cnt++;
u64_stats_update_end(&ring->syncp); u64_stats_update_end(&ring->syncp);
return -EIO; return true;
} }
bytes = 0; bytes = 0;
...@@ -2506,16 +2504,16 @@ static int hns3_ring_get_cfg(struct hnae3_queue *q, struct hns3_nic_priv *priv, ...@@ -2506,16 +2504,16 @@ static int hns3_ring_get_cfg(struct hnae3_queue *q, struct hns3_nic_priv *priv,
if (ring_type == HNAE3_RING_TYPE_TX) { if (ring_type == HNAE3_RING_TYPE_TX) {
ring_data[q->tqp_index].ring = ring; ring_data[q->tqp_index].ring = ring;
ring_data[q->tqp_index].queue_index = q->tqp_index;
ring->io_base = (u8 __iomem *)q->io_base + HNS3_TX_REG_OFFSET; ring->io_base = (u8 __iomem *)q->io_base + HNS3_TX_REG_OFFSET;
} else { } else {
ring_data[q->tqp_index + queue_num].ring = ring; ring_data[q->tqp_index + queue_num].ring = ring;
ring_data[q->tqp_index + queue_num].queue_index = q->tqp_index;
ring->io_base = q->io_base; ring->io_base = q->io_base;
} }
hnae_set_bit(ring->flag, HNAE3_RING_TYPE_B, ring_type); hnae_set_bit(ring->flag, HNAE3_RING_TYPE_B, ring_type);
ring_data[q->tqp_index].queue_index = q->tqp_index;
ring->tqp = q; ring->tqp = q;
ring->desc = NULL; ring->desc = NULL;
ring->desc_cb = NULL; ring->desc_cb = NULL;
......
...@@ -594,7 +594,7 @@ static inline void hns3_write_reg(void __iomem *base, u32 reg, u32 value) ...@@ -594,7 +594,7 @@ static inline void hns3_write_reg(void __iomem *base, u32 reg, u32 value)
void hns3_ethtool_set_ops(struct net_device *netdev); void hns3_ethtool_set_ops(struct net_device *netdev);
int hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget); bool hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget);
int hns3_init_all_ring(struct hns3_nic_priv *priv); int hns3_init_all_ring(struct hns3_nic_priv *priv);
int hns3_uninit_all_ring(struct hns3_nic_priv *priv); int hns3_uninit_all_ring(struct hns3_nic_priv *priv);
netdev_tx_t hns3_nic_net_xmit(struct sk_buff *skb, struct net_device *netdev); netdev_tx_t hns3_nic_net_xmit(struct sk_buff *skb, struct net_device *netdev);
......
...@@ -717,7 +717,7 @@ static int hns3_get_rxnfc(struct net_device *netdev, ...@@ -717,7 +717,7 @@ static int hns3_get_rxnfc(struct net_device *netdev,
{ {
struct hnae3_handle *h = hns3_get_handle(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
if (!h->ae_algo || !h->ae_algo->ops || !h->ae_algo->ops->get_tc_size) if (!h->ae_algo || !h->ae_algo->ops || !h->ae_algo->ops->get_rss_tuple)
return -EOPNOTSUPP; return -EOPNOTSUPP;
switch (cmd->cmd) { switch (cmd->cmd) {
......
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