Skip to content

Commit ad2eceb

Browse files
Sunil Gouthamdavem330
authored andcommitted
net: thunderx: Fix receive packet stats
Counting rx packets for every CQE_RX in CQ irq handler is incorrect. Synchronization is missing when multiple queues are receiving packets simultaneously. Like transmit packet stats use HW stats here. Also removed unused 'cqe_type' parameter in nicvf_rcv_pkt_handler(). Signed-off-by: Sunil Goutham <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8d210d5 commit ad2eceb

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

drivers/net/ethernet/cavium/thunder/nicvf_main.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,7 @@ static inline void nicvf_set_rxhash(struct net_device *netdev,
574574

575575
static void nicvf_rcv_pkt_handler(struct net_device *netdev,
576576
struct napi_struct *napi,
577-
struct cmp_queue *cq,
578-
struct cqe_rx_t *cqe_rx, int cqe_type)
577+
struct cqe_rx_t *cqe_rx)
579578
{
580579
struct sk_buff *skb;
581580
struct nicvf *nic = netdev_priv(netdev);
@@ -591,7 +590,7 @@ static void nicvf_rcv_pkt_handler(struct net_device *netdev,
591590
}
592591

593592
/* Check for errors */
594-
err = nicvf_check_cqe_rx_errs(nic, cq, cqe_rx);
593+
err = nicvf_check_cqe_rx_errs(nic, cqe_rx);
595594
if (err && !cqe_rx->rb_cnt)
596595
return;
597596

@@ -682,8 +681,7 @@ static int nicvf_cq_intr_handler(struct net_device *netdev, u8 cq_idx,
682681
cq_idx, cq_desc->cqe_type);
683682
switch (cq_desc->cqe_type) {
684683
case CQE_TYPE_RX:
685-
nicvf_rcv_pkt_handler(netdev, napi, cq,
686-
cq_desc, CQE_TYPE_RX);
684+
nicvf_rcv_pkt_handler(netdev, napi, cq_desc);
687685
work_done++;
688686
break;
689687
case CQE_TYPE_SEND:
@@ -1353,6 +1351,9 @@ void nicvf_update_stats(struct nicvf *nic)
13531351
drv_stats->tx_frames_ok = stats->tx_ucast_frames_ok +
13541352
stats->tx_bcast_frames_ok +
13551353
stats->tx_mcast_frames_ok;
1354+
drv_stats->rx_frames_ok = stats->rx_ucast_frames +
1355+
stats->rx_bcast_frames +
1356+
stats->rx_mcast_frames;
13561357
drv_stats->rx_drops = stats->rx_drop_red +
13571358
stats->rx_drop_overrun;
13581359
drv_stats->tx_drops = stats->tx_drops;

drivers/net/ethernet/cavium/thunder/nicvf_queues.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,16 +1329,12 @@ void nicvf_update_sq_stats(struct nicvf *nic, int sq_idx)
13291329
}
13301330

13311331
/* Check for errors in the receive cmp.queue entry */
1332-
int nicvf_check_cqe_rx_errs(struct nicvf *nic,
1333-
struct cmp_queue *cq, struct cqe_rx_t *cqe_rx)
1332+
int nicvf_check_cqe_rx_errs(struct nicvf *nic, struct cqe_rx_t *cqe_rx)
13341333
{
13351334
struct nicvf_hw_stats *stats = &nic->hw_stats;
1336-
struct nicvf_drv_stats *drv_stats = &nic->drv_stats;
13371335

1338-
if (!cqe_rx->err_level && !cqe_rx->err_opcode) {
1339-
drv_stats->rx_frames_ok++;
1336+
if (!cqe_rx->err_level && !cqe_rx->err_opcode)
13401337
return 0;
1341-
}
13421338

13431339
if (netif_msg_rx_err(nic))
13441340
netdev_err(nic->netdev,

drivers/net/ethernet/cavium/thunder/nicvf_queues.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,7 @@ u64 nicvf_queue_reg_read(struct nicvf *nic,
338338
/* Stats */
339339
void nicvf_update_rq_stats(struct nicvf *nic, int rq_idx);
340340
void nicvf_update_sq_stats(struct nicvf *nic, int sq_idx);
341-
int nicvf_check_cqe_rx_errs(struct nicvf *nic,
342-
struct cmp_queue *cq, struct cqe_rx_t *cqe_rx);
341+
int nicvf_check_cqe_rx_errs(struct nicvf *nic, struct cqe_rx_t *cqe_rx);
343342
int nicvf_check_cqe_tx_errs(struct nicvf *nic,
344343
struct cmp_queue *cq, struct cqe_send_t *cqe_tx);
345344
#endif /* NICVF_QUEUES_H */

0 commit comments

Comments
 (0)