]> git.ipfire.org Git - thirdparty/kernel/stable.git/blobdiff - drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
bnx2x: Prevent load reordering in tx completion processing
[thirdparty/kernel/stable.git] / drivers / net / ethernet / broadcom / bnx2x / bnx2x_cmn.c
index ecb1bd7eb5080d1d47725e0c98f3153437fb5a42..9f07b85091f376a678dbd0c67e2388ffcabd6715 100644 (file)
@@ -285,6 +285,9 @@ int bnx2x_tx_int(struct bnx2x *bp, struct bnx2x_fp_txdata *txdata)
        hw_cons = le16_to_cpu(*txdata->tx_cons_sb);
        sw_cons = txdata->tx_pkt_cons;
 
+       /* Ensure subsequent loads occur after hw_cons */
+       smp_rmb();
+
        while (sw_cons != hw_cons) {
                u16 pkt_cons;
 
@@ -3858,9 +3861,12 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
        if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
                if (!(bp->flags & TX_TIMESTAMPING_EN)) {
+                       bp->eth_stats.ptp_skip_tx_ts++;
                        BNX2X_ERR("Tx timestamping was not enabled, this packet will not be timestamped\n");
                } else if (bp->ptp_tx_skb) {
-                       BNX2X_ERR("The device supports only a single outstanding packet to timestamp, this packet will not be timestamped\n");
+                       bp->eth_stats.ptp_skip_tx_ts++;
+                       netdev_err_once(bp->dev,
+                                       "Device supports only a single outstanding packet to timestamp, this packet won't be timestamped\n");
                } else {
                        skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
                        /* schedule check for Tx timestamp */