net: mana: Add handling of CQE_RX_TRUNCATED
authorHaiyang Zhang <haiyangz@microsoft.com>
Fri, 4 Feb 2022 22:45:44 +0000 (14:45 -0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 5 Feb 2022 15:26:00 +0000 (15:26 +0000)
The proper way to drop this kind of CQE is advancing rxq tail
without indicating the packet to the upper network layer.

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/microsoft/mana/mana_en.c

index 69e791e6abc4741454ab3722e27482cf3628243d..d2481a500654b367b47ea4883b67ab23bed1e63b 100644 (file)
@@ -1085,8 +1085,10 @@ static void mana_process_rx_cqe(struct mana_rxq *rxq, struct mana_cq *cq,
                break;
 
        case CQE_RX_TRUNCATED:
-               netdev_err(ndev, "Dropped a truncated packet\n");
-               return;
+               ++ndev->stats.rx_dropped;
+               rxbuf_oob = &rxq->rx_oobs[rxq->buf_index];
+               netdev_warn_once(ndev, "Dropped a truncated packet\n");
+               goto drop;
 
        case CQE_RX_COALESCED_4:
                netdev_err(ndev, "RX coalescing is unsupported\n");
@@ -1154,6 +1156,7 @@ static void mana_process_rx_cqe(struct mana_rxq *rxq, struct mana_cq *cq,
 
        mana_rx_skb(old_buf, oob, rxq);
 
+drop:
        mana_move_wq_tail(rxq->gdma_rq, rxbuf_oob->wqe_inf.wqe_size_in_bu);
 
        mana_post_pkt_rxq(rxq);