Skip to content

Commit bded442

Browse files
committed
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: David S. Miller <davem@davemloft.net>
2 parents 5908064 + 24e750c commit bded442

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,6 @@ static int hclge_parse_func_status(struct hclge_dev *hdev,
837837
else
838838
hdev->flag &= ~HCLGE_FLAG_MAIN;
839839

840-
hdev->num_req_vfs = status->vf_num / status->pf_num;
841840
return 0;
842841
}
843842

@@ -4361,6 +4360,8 @@ static int hclge_pci_init(struct hclge_dev *hdev)
43614360
goto err_clr_master;
43624361
}
43634362

4363+
hdev->num_req_vfs = pci_sriov_get_totalvfs(pdev);
4364+
43644365
return 0;
43654366
err_clr_master:
43664367
pci_clear_master(pdev);

drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,8 +1444,6 @@ static int hns3_alloc_buffer(struct hns3_enet_ring *ring,
14441444
cb->length = hnae_page_size(ring);
14451445
cb->type = DESC_TYPE_PAGE;
14461446

1447-
memset(cb->buf, 0, cb->length);
1448-
14491447
return 0;
14501448
}
14511449

@@ -1555,7 +1553,7 @@ static int hns3_reserve_buffer_map(struct hns3_enet_ring *ring,
15551553
return 0;
15561554

15571555
out_with_buf:
1558-
hns3_free_buffers(ring);
1556+
hns3_free_buffer(ring, cb);
15591557
out:
15601558
return ret;
15611559
}
@@ -1595,7 +1593,7 @@ static int hns3_alloc_ring_buffers(struct hns3_enet_ring *ring)
15951593
static void hns3_replace_buffer(struct hns3_enet_ring *ring, int i,
15961594
struct hns3_desc_cb *res_cb)
15971595
{
1598-
hns3_map_buffer(ring, &ring->desc_cb[i]);
1596+
hns3_unmap_buffer(ring, &ring->desc_cb[i]);
15991597
ring->desc_cb[i] = *res_cb;
16001598
ring->desc[i].addr = cpu_to_le64(ring->desc_cb[i].dma);
16011599
}
@@ -1631,7 +1629,7 @@ static int is_valid_clean_head(struct hns3_enet_ring *ring, int h)
16311629
return u > c ? (h > c && h <= u) : (h > c || h <= u);
16321630
}
16331631

1634-
int hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget)
1632+
bool hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget)
16351633
{
16361634
struct net_device *netdev = ring->tqp->handle->kinfo.netdev;
16371635
struct netdev_queue *dev_queue;
@@ -1642,7 +1640,7 @@ int hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget)
16421640
rmb(); /* Make sure head is ready before touch any data */
16431641

16441642
if (is_ring_empty(ring) || head == ring->next_to_clean)
1645-
return 0; /* no data to poll */
1643+
return true; /* no data to poll */
16461644

16471645
if (!is_valid_clean_head(ring, head)) {
16481646
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)
16511649
u64_stats_update_begin(&ring->syncp);
16521650
ring->stats.io_err_cnt++;
16531651
u64_stats_update_end(&ring->syncp);
1654-
return -EIO;
1652+
return true;
16551653
}
16561654

16571655
bytes = 0;
@@ -2506,16 +2504,16 @@ static int hns3_ring_get_cfg(struct hnae3_queue *q, struct hns3_nic_priv *priv,
25062504

25072505
if (ring_type == HNAE3_RING_TYPE_TX) {
25082506
ring_data[q->tqp_index].ring = ring;
2507+
ring_data[q->tqp_index].queue_index = q->tqp_index;
25092508
ring->io_base = (u8 __iomem *)q->io_base + HNS3_TX_REG_OFFSET;
25102509
} else {
25112510
ring_data[q->tqp_index + queue_num].ring = ring;
2511+
ring_data[q->tqp_index + queue_num].queue_index = q->tqp_index;
25122512
ring->io_base = q->io_base;
25132513
}
25142514

25152515
hnae_set_bit(ring->flag, HNAE3_RING_TYPE_B, ring_type);
25162516

2517-
ring_data[q->tqp_index].queue_index = q->tqp_index;
2518-
25192517
ring->tqp = q;
25202518
ring->desc = NULL;
25212519
ring->desc_cb = NULL;

drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ static inline void hns3_write_reg(void __iomem *base, u32 reg, u32 value)
594594

595595
void hns3_ethtool_set_ops(struct net_device *netdev);
596596

597-
int hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget);
597+
bool hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget);
598598
int hns3_init_all_ring(struct hns3_nic_priv *priv);
599599
int hns3_uninit_all_ring(struct hns3_nic_priv *priv);
600600
netdev_tx_t hns3_nic_net_xmit(struct sk_buff *skb, struct net_device *netdev);

drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ static int hns3_get_rxnfc(struct net_device *netdev,
717717
{
718718
struct hnae3_handle *h = hns3_get_handle(netdev);
719719

720-
if (!h->ae_algo || !h->ae_algo->ops || !h->ae_algo->ops->get_tc_size)
720+
if (!h->ae_algo || !h->ae_algo->ops || !h->ae_algo->ops->get_rss_tuple)
721721
return -EOPNOTSUPP;
722722

723723
switch (cmd->cmd) {

0 commit comments

Comments
 (0)