Skip to content

Commit

Permalink
Merge branch 'hns3-next'
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David S. Miller committed Oct 24, 2017
2 parents 5908064 + 24e750c commit bded442
Showing 4 changed files with 11 additions and 12 deletions.
3 changes: 2 additions & 1 deletion drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
Original file line number Diff line number Diff line change
@@ -837,7 +837,6 @@ static int hclge_parse_func_status(struct hclge_dev *hdev,
else
hdev->flag &= ~HCLGE_FLAG_MAIN;

hdev->num_req_vfs = status->vf_num / status->pf_num;
return 0;
}

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

hdev->num_req_vfs = pci_sriov_get_totalvfs(pdev);

return 0;
err_clr_master:
pci_clear_master(pdev);
16 changes: 7 additions & 9 deletions drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c
Original file line number Diff line number Diff line change
@@ -1444,8 +1444,6 @@ static int hns3_alloc_buffer(struct hns3_enet_ring *ring,
cb->length = hnae_page_size(ring);
cb->type = DESC_TYPE_PAGE;

memset(cb->buf, 0, cb->length);

return 0;
}

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

out_with_buf:
hns3_free_buffers(ring);
hns3_free_buffer(ring, cb);
out:
return ret;
}
@@ -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,
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[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)
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 netdev_queue *dev_queue;
@@ -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 */

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)) {
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)
u64_stats_update_begin(&ring->syncp);
ring->stats.io_err_cnt++;
u64_stats_update_end(&ring->syncp);
return -EIO;
return true;
}

bytes = 0;
@@ -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) {
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;
} else {
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;
}

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->desc = NULL;
ring->desc_cb = NULL;
2 changes: 1 addition & 1 deletion drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.h
Original file line number Diff line number Diff line change
@@ -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);

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_uninit_all_ring(struct hns3_nic_priv *priv);
netdev_tx_t hns3_nic_net_xmit(struct sk_buff *skb, struct net_device *netdev);
2 changes: 1 addition & 1 deletion drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c
Original file line number Diff line number Diff line change
@@ -717,7 +717,7 @@ static int hns3_get_rxnfc(struct net_device *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;

switch (cmd->cmd) {

0 comments on commit bded442

Please sign in to comment.