Skip to content
This repository has been archived by the owner on Sep 28, 2024. It is now read-only.

Commit

Permalink
RH6: hv_netvsc: Fix for packet drop during xmit from VF
Browse files Browse the repository at this point in the history
Data transmission from VF txq will cause packet drop when queue is stopped
or frozen. In such case sythetic datapath should be used to continue tx.
This patch also improves the performance when the number of connection
increases.
  • Loading branch information
Johnson authored and johnsongeorge-w committed Mar 26, 2019
1 parent 28b2562 commit 5e95fe7
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions hv-rhel6.x/hv/netvsc_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,19 +253,14 @@ static u16 netvsc_select_queue(struct net_device *ndev, struct sk_buff *skb)
{
struct net_device_context *ndc = netdev_priv(ndev);
struct net_device *vf_netdev;
u16 txq;
u16 txq = 0;

rcu_read_lock();
vf_netdev = rcu_dereference(ndc->vf_netdev);
if (vf_netdev) {
const struct net_device_ops *vf_ops = vf_netdev->netdev_ops;

if (vf_ops->ndo_select_queue)
txq = vf_ops->ndo_select_queue(vf_netdev, skb);
else
txq = 0;

qdisc_skb_cb(skb)->slave_dev_queue_mapping = txq;
} else {
txq = netvsc_pick_tx(ndev, skb);
}
Expand All @@ -278,6 +273,21 @@ static u16 netvsc_select_queue(struct net_device *ndev, struct sk_buff *skb)
}


static int netvsc_txq_stopped_or_frozen(struct net_device *vf_netdev, struct sk_buff *skb)
{
u16 txq_index = 0;
struct netdev_queue *txq;
const struct net_device_ops *vf_ops = vf_netdev->netdev_ops;

if (vf_ops->ndo_select_queue)
txq_index = vf_ops->ndo_select_queue(vf_netdev, skb);

qdisc_skb_cb(skb)->slave_dev_queue_mapping = txq_index;
txq = netdev_get_tx_queue(vf_netdev, txq_index);

return (netif_tx_queue_stopped(txq) || netif_tx_queue_frozen(txq));
}

/* Send skb on the slave VF device. */
static int netvsc_vf_xmit(struct net_device *net, struct net_device *vf_netdev,
struct sk_buff *skb)
Expand Down Expand Up @@ -567,8 +577,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
*/
vf_netdev = rcu_dereference_bh(net_device_ctx->vf_netdev);
if (vf_netdev && netif_running(vf_netdev) &&
!netpoll_tx_running(net) && !in_serving_softirq() &&
!netif_queue_stopped(vf_netdev)) {
!netpoll_tx_running(net) && !netvsc_txq_stopped_or_frozen(vf_netdev, skb)) {
return netvsc_vf_xmit(net, vf_netdev, skb);
}
#endif
Expand Down

0 comments on commit 5e95fe7

Please sign in to comment.