提交 a9847a07 编写于 作者: S shenhao 提交者: Yang Yingliang

net: hns3: add one parameter for function hns3_nic_maybe_stop_tx()

driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

--------------------------------------------

Function hns3_nic_net_xmit() and functioin hns3_nic_maybe_stop_tx() both
get ring pointer from priv->ring[]. According to opinion of community to
reduce this kind of operation, this patch adds parameter ring for function
hns3_nic_maybe_stop_tx().
Signed-off-by: NGuangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: Nshenhao <shenhao21@huawei.com>
Reviewed-by: NZhong Zhaohui <zhongzhaohui@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 8de8e84f
...@@ -1296,15 +1296,14 @@ void hns3_shinfo_pack(struct skb_shared_info *shinfo, __u32 *size) ...@@ -1296,15 +1296,14 @@ void hns3_shinfo_pack(struct skb_shared_info *shinfo, __u32 *size)
size[i] = skb_frag_size(&shinfo->frags[i]); size[i] = skb_frag_size(&shinfo->frags[i]);
} }
static int hns3_nic_maybe_stop_tx(struct net_device *netdev, static int hns3_nic_maybe_stop_tx(struct hns3_enet_ring *ring,
struct net_device *netdev,
struct sk_buff *skb) struct sk_buff *skb)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hns3_nic_priv *priv = netdev_priv(netdev);
unsigned int bd_size[HNS3_MAX_TSO_BD_NUM + 1U]; unsigned int bd_size[HNS3_MAX_TSO_BD_NUM + 1U];
struct hns3_enet_ring *ring;
unsigned int bd_num; unsigned int bd_num;
ring = &priv->ring[skb->queue_mapping];
bd_num = hns3_tx_bd_num(skb, bd_size); bd_num = hns3_tx_bd_num(skb, bd_size);
if (unlikely(bd_num > HNS3_MAX_NON_TSO_BD_NUM)) { if (unlikely(bd_num > HNS3_MAX_NON_TSO_BD_NUM)) {
...@@ -1430,7 +1429,7 @@ netdev_tx_t hns3_nic_net_xmit(struct sk_buff *skb, struct net_device *netdev) ...@@ -1430,7 +1429,7 @@ netdev_tx_t hns3_nic_net_xmit(struct sk_buff *skb, struct net_device *netdev)
/* Prefetch the data used later */ /* Prefetch the data used later */
prefetch(skb->data); prefetch(skb->data);
ret = hns3_nic_maybe_stop_tx(netdev, skb); ret = hns3_nic_maybe_stop_tx(ring, netdev, skb);
if (unlikely(ret <= 0)) { if (unlikely(ret <= 0)) {
if (ret == -EBUSY) { if (ret == -EBUSY) {
u64_stats_update_begin(&ring->syncp); u64_stats_update_begin(&ring->syncp);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册