Skip to content

Commit

Permalink
net/af_packet: fix packet bytes counting
Browse files Browse the repository at this point in the history
On error, we also need to zero the bytes transmitted.

Fixes: f4ff17a ("net/af_packet: guard against buffer overruns in Tx path")
Cc: stable@dpdk.org

Signed-off-by: Chas Williams <ciwillia@brocade.com>
  • Loading branch information
Chas Williams authored and Ferruh Yigit committed Jun 12, 2017
1 parent 92656e9 commit 74b7fc0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/net/af_packet/rte_eth_af_packet.c
Expand Up @@ -252,8 +252,11 @@ eth_af_packet_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
}

/* kick-off transmits */
if (sendto(pkt_q->sockfd, NULL, 0, MSG_DONTWAIT, NULL, 0) == -1)
num_tx = 0; /* error sending -- no packets transmitted */
if (sendto(pkt_q->sockfd, NULL, 0, MSG_DONTWAIT, NULL, 0) == -1) {
/* error sending -- no packets transmitted */
num_tx = 0;
num_tx_bytes = 0;
}

pkt_q->framenum = framenum;
pkt_q->tx_pkts += num_tx;
Expand Down

0 comments on commit 74b7fc0

Please sign in to comment.