Skip to content

Commit 151e887

Browse files
LiangChen77davem330
authored andcommitted
veth: Fixing transmit return status for dropped packets
The veth_xmit function returns NETDEV_TX_OK even when packets are dropped. This behavior leads to incorrect calculations of statistics counts, as well as things like txq->trans_start updates. Fixes: e314dbd ("[NET]: Virtual ethernet device driver.") Signed-off-by: Liang Chen <liangchen.linux@gmail.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 817c7cd commit 151e887

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/net/veth.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
344344
{
345345
struct veth_priv *rcv_priv, *priv = netdev_priv(dev);
346346
struct veth_rq *rq = NULL;
347+
int ret = NETDEV_TX_OK;
347348
struct net_device *rcv;
348349
int length = skb->len;
349350
bool use_napi = false;
@@ -378,11 +379,12 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
378379
} else {
379380
drop:
380381
atomic64_inc(&priv->dropped);
382+
ret = NET_XMIT_DROP;
381383
}
382384

383385
rcu_read_unlock();
384386

385-
return NETDEV_TX_OK;
387+
return ret;
386388
}
387389

388390
static u64 veth_stats_tx(struct net_device *dev, u64 *packets, u64 *bytes)

0 commit comments

Comments
 (0)