]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net: move skb->xmit_more hint to softnet data
authorFlorian Westphal <fw@strlen.de>
Mon, 1 Apr 2019 14:42:14 +0000 (16:42 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 2 Apr 2019 01:35:02 +0000 (18:35 -0700)
There are two reasons for this.

First, the xmit_more flag conceptually doesn't fit into the skb, as
xmit_more is not a property related to the skb.
Its only a hint to the driver that the stack is about to transmit another
packet immediately.

Second, it was only done this way to not have to pass another argument
to ndo_start_xmit().

We can place xmit_more in the softnet data, next to the device recursion.
The recursion counter is already written to on each transmit. The "more"
indicator is placed right next to it.

Drivers can use the netdev_xmit_more() helper instead of skb->xmit_more
to check the "more packets coming" hint.

skb->xmit_more is retained (but always 0) to not cause build breakage.

This change takes care of the simple s/skb->xmit_more/netdev_xmit_more()/
conversions.  Remaining drivers are converted in the next patches.

Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
29 files changed:
drivers/net/ethernet/amazon/ena/ena_netdev.c
drivers/net/ethernet/amd/xgbe/xgbe-dev.c
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/genet/bcmgenet.c
drivers/net/ethernet/broadcom/tg3.c
drivers/net/ethernet/cavium/liquidio/lio_main.c
drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
drivers/net/ethernet/cisco/enic/enic_main.c
drivers/net/ethernet/emulex/benet/be_main.c
drivers/net/ethernet/huawei/hinic/hinic_tx.c
drivers/net/ethernet/intel/e1000/e1000_main.c
drivers/net/ethernet/intel/e1000e/netdev.c
drivers/net/ethernet/intel/fm10k/fm10k_main.c
drivers/net/ethernet/intel/i40e/i40e_txrx.c
drivers/net/ethernet/intel/iavf/iavf_txrx.c
drivers/net/ethernet/intel/ice/ice_txrx.c
drivers/net/ethernet/intel/igb/igb_main.c
drivers/net/ethernet/intel/igc/igc_main.c
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
drivers/net/ethernet/marvell/mvneta.c
drivers/net/ethernet/mediatek/mtk_eth_soc.c
drivers/net/ethernet/netronome/nfp/nfp_net_common.c
drivers/net/ethernet/qlogic/qede/qede_fp.c
drivers/net/ethernet/rdc/r6040.c
drivers/net/ethernet/synopsys/dwc-xlgmac-hw.c
drivers/net/hyperv/netvsc.c
drivers/net/virtio_net.c
drivers/staging/mt7621-eth/mtk_eth_soc.c
include/linux/netdevice.h

index 71c8cac6e44e4dcc2a95472dd493527e0d4d13df..7e40d14682f7a78a8e4646afde29cf305101c73e 100644 (file)
@@ -2236,7 +2236,7 @@ static netdev_tx_t ena_start_xmit(struct sk_buff *skb, struct net_device *dev)
                }
        }
 
-       if (netif_xmit_stopped(txq) || !skb->xmit_more) {
+       if (netif_xmit_stopped(txq) || !netdev_xmit_more()) {
                /* trigger the dma engine. ena_com_write_sq_doorbell()
                 * has a mb
                 */
index 4666084eda16a318a4042b81c2d3a03cb7664a19..d5fd49dd25f336aedbe166a8c6bdd74ef6296204 100644 (file)
@@ -1887,7 +1887,7 @@ static void xgbe_dev_xmit(struct xgbe_channel *channel)
        smp_wmb();
 
        ring->cur = cur_index + 1;
-       if (!packet->skb->xmit_more ||
+       if (!netdev_xmit_more() ||
            netif_xmit_stopped(netdev_get_tx_queue(pdata->netdev,
                                                   channel->queue_index)))
                xgbe_tx_start_xmit(channel, ring);
index 35e34e23ba33fb397cc4496ae4ff7025b0b9c918..d22691403d288363d56d72a877eedfb612071a36 100644 (file)
@@ -551,7 +551,7 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
        prod = NEXT_TX(prod);
        txr->tx_prod = prod;
 
-       if (!skb->xmit_more || netif_xmit_stopped(txq))
+       if (!netdev_xmit_more() || netif_xmit_stopped(txq))
                bnxt_db_write(bp, &txr->tx_db, prod);
 
 tx_done:
@@ -559,7 +559,7 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
        mmiowb();
 
        if (unlikely(bnxt_tx_avail(bp, txr) <= MAX_SKB_FRAGS + 1)) {
-               if (skb->xmit_more && !tx_buf->is_push)
+               if (netdev_xmit_more() && !tx_buf->is_push)
                        bnxt_db_write(bp, &txr->tx_db, prod);
 
                netif_tx_stop_queue(txq);
index 983245c0867c268be95b1ae52f57a2c0b4051507..4fd973571e4cd245d819c75f345de737d0fb4269 100644 (file)
@@ -1665,7 +1665,7 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
        if (ring->free_bds <= (MAX_SKB_FRAGS + 1))
                netif_tx_stop_queue(txq);
 
-       if (!skb->xmit_more || netif_xmit_stopped(txq))
+       if (!netdev_xmit_more() || netif_xmit_stopped(txq))
                /* Packets are ready, update producer index */
                bcmgenet_tdma_ring_writel(priv, ring->index,
                                          ring->prod_index, TDMA_PROD_INDEX);
index 328373e0578ff83bf5d5bb336103deba33144e99..45ccadee02afcec74f25cb32c1f7c2df666eb357 100644 (file)
@@ -8156,7 +8156,7 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
                        netif_tx_wake_queue(txq);
        }
 
-       if (!skb->xmit_more || netif_xmit_stopped(txq)) {
+       if (!netdev_xmit_more() || netif_xmit_stopped(txq)) {
                /* Packets are ready, update Tx producer idx on card. */
                tw32_tx_mbox(tnapi->prodmbox, entry);
                mmiowb();
index fb6f813cff65dcb7f608d4e1b859be9f38a6b13d..eab805579f9646b42a30e71757e3f6d6432ba7e2 100644 (file)
@@ -2522,7 +2522,7 @@ static netdev_tx_t liquidio_xmit(struct sk_buff *skb, struct net_device *netdev)
                irh->vlan = skb_vlan_tag_get(skb) & 0xfff;
        }
 
-       xmit_more = skb->xmit_more;
+       xmit_more = netdev_xmit_more();
 
        if (unlikely(cmdsetup.s.timestamp))
                status = send_nic_timestamp_pkt(oct, &ndata, finfo, xmit_more);
index 54b245797d2e61e1844a25c9674255c2dd80e69c..db0b90555acbcb368626757b803474710d135082 100644 (file)
@@ -1585,7 +1585,7 @@ static netdev_tx_t liquidio_xmit(struct sk_buff *skb, struct net_device *netdev)
                irh->vlan = skb_vlan_tag_get(skb) & VLAN_VID_MASK;
        }
 
-       xmit_more = skb->xmit_more;
+       xmit_more = netdev_xmit_more();
 
        if (unlikely(cmdsetup.s.timestamp))
                status = send_nic_timestamp_pkt(oct, &ndata, finfo, xmit_more);
index 733d9172425bf46398714c8a003c99fdfbd91f67..acb2856936d2027babd1c06b02896a91b4d3d2e5 100644 (file)
@@ -897,7 +897,7 @@ static netdev_tx_t enic_hard_start_xmit(struct sk_buff *skb,
        if (vnic_wq_desc_avail(wq) < MAX_SKB_FRAGS + ENIC_DESC_MAX_SPLITS)
                netif_tx_stop_queue(txq);
        skb_tx_timestamp(skb);
-       if (!skb->xmit_more || netif_xmit_stopped(txq))
+       if (!netdev_xmit_more() || netif_xmit_stopped(txq))
                vnic_wq_doorbell(wq);
 
        spin_unlock(&enic->wq_lock[txq_map]);
index 3c7c04406a2bfa55d1f3c67e0019d488c7dff4a8..e2f9fbced17457b481a3e9ac2f1a9bc358a66b59 100644 (file)
@@ -1376,7 +1376,7 @@ static netdev_tx_t be_xmit(struct sk_buff *skb, struct net_device *netdev)
        u16 q_idx = skb_get_queue_mapping(skb);
        struct be_tx_obj *txo = &adapter->tx_obj[q_idx];
        struct be_wrb_params wrb_params = { 0 };
-       bool flush = !skb->xmit_more;
+       bool flush = !netdev_xmit_more();
        u16 wrb_cnt;
 
        skb = be_xmit_workarounds(adapter, skb, &wrb_params);
index e17bf33eba0c5e09f7708dc52566b342f4777dc6..0fbe8046824b2106eed2bbf62e54b477c97de7e7 100644 (file)
@@ -518,7 +518,7 @@ netdev_tx_t hinic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
 
 flush_skbs:
        netdev_txq = netdev_get_tx_queue(netdev, q_id);
-       if ((!skb->xmit_more) || (netif_xmit_stopped(netdev_txq)))
+       if ((!netdev_xmit_more()) || (netif_xmit_stopped(netdev_txq)))
                hinic_sq_write_db(txq->sq, prod_idx, wqe_size, 0);
 
        return err;
index a7c76732849fd13f7fe827dce6115caa4da3d4b5..6f72ab139fd9283ecf29cd609539804cca9c6095 100644 (file)
@@ -3267,7 +3267,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
                /* Make sure there is space in the ring for the next send. */
                e1000_maybe_stop_tx(netdev, tx_ring, desc_needed);
 
-               if (!skb->xmit_more ||
+               if (!netdev_xmit_more() ||
                    netif_xmit_stopped(netdev_get_tx_queue(netdev, 0))) {
                        writel(tx_ring->next_to_use, hw->hw_addr + tx_ring->tdt);
                        /* we need this if more than one processor can write to
index 745c1242a2d9be848b0548f44c81fae048814369..a8fa4a1628f5d0432797489ecca2d021d02611e8 100644 (file)
@@ -5897,7 +5897,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
                                     DIV_ROUND_UP(PAGE_SIZE,
                                                  adapter->tx_fifo_limit) + 2));
 
-               if (!skb->xmit_more ||
+               if (!netdev_xmit_more() ||
                    netif_xmit_stopped(netdev_get_tx_queue(netdev, 0))) {
                        if (adapter->flags2 & FLAG2_PCIM2PCI_ARBITER_WA)
                                e1000e_update_tdt_wa(tx_ring,
index 5a0419421511fd7a9a3e44a1a7fa2c4e21f26217..e2fa112bed9ae772ced378789c246834ea948e82 100644 (file)
@@ -1035,7 +1035,7 @@ static void fm10k_tx_map(struct fm10k_ring *tx_ring,
        fm10k_maybe_stop_tx(tx_ring, DESC_NEEDED);
 
        /* notify HW of packet */
-       if (netif_xmit_stopped(txring_txq(tx_ring)) || !skb->xmit_more) {
+       if (netif_xmit_stopped(txring_txq(tx_ring)) || !netdev_xmit_more()) {
                writel(i, tx_ring->tail);
 
                /* we need this if more than one processor can write to our tail
index 6c97667d20eff136cde56c0447c54892c464fe31..1a95223c9f99af3738641b85c46f2b09ac88f384 100644 (file)
@@ -3469,7 +3469,7 @@ static inline int i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb,
        first->next_to_watch = tx_desc;
 
        /* notify HW of packet */
-       if (netif_xmit_stopped(txring_txq(tx_ring)) || !skb->xmit_more) {
+       if (netif_xmit_stopped(txring_txq(tx_ring)) || !netdev_xmit_more()) {
                writel(i, tx_ring->tail);
 
                /* we need this if more than one processor can write to our tail
index 9b4d7cec2e18af2c5c092096dfc7cfa513829636..b64187753ad67ce6a6fdf3efcd020d16fdea3872 100644 (file)
@@ -2358,7 +2358,7 @@ static inline void iavf_tx_map(struct iavf_ring *tx_ring, struct sk_buff *skb,
        first->next_to_watch = tx_desc;
 
        /* notify HW of packet */
-       if (netif_xmit_stopped(txring_txq(tx_ring)) || !skb->xmit_more) {
+       if (netif_xmit_stopped(txring_txq(tx_ring)) || !netdev_xmit_more()) {
                writel(i, tx_ring->tail);
 
                /* we need this if more than one processor can write to our tail
index f2462799154a0e65acfb2d34794591c50944f567..a6f7b7feaf3c7f0dc479abb3bac96b958318a304 100644 (file)
@@ -1646,7 +1646,7 @@ ice_tx_map(struct ice_ring *tx_ring, struct ice_tx_buf *first,
        ice_maybe_stop_tx(tx_ring, DESC_NEEDED);
 
        /* notify HW of packet */
-       if (netif_xmit_stopped(txring_txq(tx_ring)) || !skb->xmit_more) {
+       if (netif_xmit_stopped(txring_txq(tx_ring)) || !netdev_xmit_more()) {
                writel(i, tx_ring->tail);
 
                /* we need this if more than one processor can write to our tail
index bea7175d171b9f281caaa1e166b1364855d09f97..32d61d5a2706dcf11cc14c632a7c445a1d9c9760 100644 (file)
@@ -6029,7 +6029,7 @@ static int igb_tx_map(struct igb_ring *tx_ring,
        /* Make sure there is space in the ring for the next send. */
        igb_maybe_stop_tx(tx_ring, DESC_NEEDED);
 
-       if (netif_xmit_stopped(txring_txq(tx_ring)) || !skb->xmit_more) {
+       if (netif_xmit_stopped(txring_txq(tx_ring)) || !netdev_xmit_more()) {
                writel(i, tx_ring->tail);
 
                /* we need this if more than one processor can write to our tail
index a883b3f357e7a26bafa2627e155b4f2bb04020dc..f79728381e8a8255e4be5d4b77d4ad5c8b3242cf 100644 (file)
@@ -939,7 +939,7 @@ static int igc_tx_map(struct igc_ring *tx_ring,
        /* Make sure there is space in the ring for the next send. */
        igc_maybe_stop_tx(tx_ring, DESC_NEEDED);
 
-       if (netif_xmit_stopped(txring_txq(tx_ring)) || !skb->xmit_more) {
+       if (netif_xmit_stopped(txring_txq(tx_ring)) || !netdev_xmit_more()) {
                writel(i, tx_ring->tail);
 
                /* we need this if more than one processor can write to our tail
index 16c72898416477ebac2d083adc80005262a1db62..60cec3540dd783e6e079451a719a9d71fb14898e 100644 (file)
@@ -8297,7 +8297,7 @@ static int ixgbe_tx_map(struct ixgbe_ring *tx_ring,
 
        ixgbe_maybe_stop_tx(tx_ring, DESC_NEEDED);
 
-       if (netif_xmit_stopped(txring_txq(tx_ring)) || !skb->xmit_more) {
+       if (netif_xmit_stopped(txring_txq(tx_ring)) || !netdev_xmit_more()) {
                writel(i, tx_ring->tail);
 
                /* we need this if more than one processor can write to our tail
index a944be3c57b1416bae5929c28facae10abdea507..bb68737dce56319bc8f20b42bec37aca9b9faecd 100644 (file)
@@ -2467,7 +2467,7 @@ static netdev_tx_t mvneta_tx(struct sk_buff *skb, struct net_device *dev)
                if (txq->count >= txq->tx_stop_threshold)
                        netif_tx_stop_queue(nq);
 
-               if (!skb->xmit_more || netif_xmit_stopped(nq) ||
+               if (!netdev_xmit_more() || netif_xmit_stopped(nq) ||
                    txq->pending + frags > MVNETA_TXQ_DEC_SENT_MASK)
                        mvneta_txq_pend_desc_add(pp, txq, frags);
                else
index 549d36497b8c10767e29333f90c80bababe783da..53abe925ecb11cb14de40c4f3f23ab67b49b396d 100644 (file)
@@ -767,7 +767,8 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev,
         */
        wmb();
 
-       if (netif_xmit_stopped(netdev_get_tx_queue(dev, 0)) || !skb->xmit_more)
+       if (netif_xmit_stopped(netdev_get_tx_queue(dev, 0)) ||
+           !netdev_xmit_more())
                mtk_w32(eth, txd->txd2, MTK_QTX_CTX_PTR);
 
        return 0;
index 99200b5dac76d50f5669243da2949d4f45b5c155..961cd5e7bf2b82ccdc5da0bd0789dcdfc61a04a8 100644 (file)
@@ -909,7 +909,7 @@ static int nfp_net_tx(struct sk_buff *skb, struct net_device *netdev)
                nfp_net_tx_ring_stop(nd_q, tx_ring);
 
        tx_ring->wr_ptr_add += nr_frags + 1;
-       if (__netdev_tx_sent_queue(nd_q, txbuf->real_len, skb->xmit_more))
+       if (__netdev_tx_sent_queue(nd_q, txbuf->real_len, netdev_xmit_more()))
                nfp_net_tx_xmit_more_flush(tx_ring);
 
        return NETDEV_TX_OK;
index c342b07e3a93767966e61465bd5814b960abb693..954015d2011a80c9564f9f320581507e53f30be0 100644 (file)
@@ -1665,12 +1665,12 @@ netdev_tx_t qede_start_xmit(struct sk_buff *skb, struct net_device *ndev)
        txq->tx_db.data.bd_prod =
                cpu_to_le16(qed_chain_get_prod_idx(&txq->tx_pbl));
 
-       if (!skb->xmit_more || netif_xmit_stopped(netdev_txq))
+       if (!netdev_xmit_more() || netif_xmit_stopped(netdev_txq))
                qede_update_tx_producer(txq);
 
        if (unlikely(qed_chain_get_elem_left(&txq->tx_pbl)
                      < (MAX_SKB_FRAGS + 1))) {
-               if (skb->xmit_more)
+               if (netdev_xmit_more())
                        qede_update_tx_producer(txq);
 
                netif_tx_stop_queue(netdev_txq);
index 04aa592f35c36f9782d891c65e2c0d810c9fd4cf..ad335bca3273dc4c1f29108116e8248952de5db8 100644 (file)
@@ -840,7 +840,7 @@ static netdev_tx_t r6040_start_xmit(struct sk_buff *skb,
        skb_tx_timestamp(skb);
 
        /* Trigger the MAC to check the TX descriptor */
-       if (!skb->xmit_more || netif_queue_stopped(dev))
+       if (!netdev_xmit_more() || netif_queue_stopped(dev))
                iowrite16(TM2TX, ioaddr + MTPR);
        lp->tx_insert_ptr = descptr->vndescp;
 
index 99d86e39ff541c29a239b176ccfcb704c50e4ce8..bf6c1c6779ff37826fa27bf89be1a23bc6d33744 100644 (file)
@@ -995,7 +995,7 @@ static void xlgmac_dev_xmit(struct xlgmac_channel *channel)
        smp_wmb();
 
        ring->cur = cur_index + 1;
-       if (!pkt_info->skb->xmit_more ||
+       if (!netdev_xmit_more() ||
            netif_xmit_stopped(netdev_get_tx_queue(pdata->netdev,
                                                   channel->queue_index)))
                xlgmac_tx_start_xmit(channel, ring);
index 813d195bbd57fed2ef96ea708b637ca8197be458..9a022539d30570ef224d5b54b788ccde6d1643e9 100644 (file)
@@ -964,7 +964,7 @@ int netvsc_send(struct net_device *ndev,
        /* Keep aggregating only if stack says more data is coming
         * and not doing mixed modes send and not flow blocked
         */
-       xmit_more = skb->xmit_more &&
+       xmit_more = netdev_xmit_more() &&
                !packet->cp_partial &&
                !netif_xmit_stopped(netdev_get_tx_queue(ndev, packet->q_idx));
 
index 1b03c4b6ebff3b2c4c0945957d6ec322eb45a5b2..ba246fc475ae58c8baddd282e81af19a401ef280 100644 (file)
@@ -1568,7 +1568,7 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
        struct send_queue *sq = &vi->sq[qnum];
        int err;
        struct netdev_queue *txq = netdev_get_tx_queue(dev, qnum);
-       bool kick = !skb->xmit_more;
+       bool kick = !netdev_xmit_more();
        bool use_napi = sq->napi.weight;
 
        /* Free up any pending old buffers before queueing new ones. */
index 6027b19f7bc2b3d3fb15970097a79b0de1190373..02a8584b3d1d1f42a4ae731e772dddaa8cddf1af 100644 (file)
@@ -741,7 +741,8 @@ static int mtk_pdma_tx_map(struct sk_buff *skb, struct net_device *dev,
        wmb();
        atomic_set(&ring->tx_free_count, mtk_pdma_empty_txd(ring));
 
-       if (netif_xmit_stopped(netdev_get_tx_queue(dev, 0)) || !skb->xmit_more)
+       if (netif_xmit_stopped(netdev_get_tx_queue(dev, 0)) ||
+           !netdev_xmit_more())
                mtk_reg_w32(eth, ring->tx_next_idx, MTK_REG_TX_CTX_IDX0);
 
        return 0;
@@ -935,7 +936,8 @@ static int mtk_qdma_tx_map(struct sk_buff *skb, struct net_device *dev,
         */
        wmb();
 
-       if (netif_xmit_stopped(netdev_get_tx_queue(dev, 0)) || !skb->xmit_more)
+       if (netif_xmit_stopped(netdev_get_tx_queue(dev, 0)) ||
+           !netdev_xmit_more())
                mtk_w32(eth, txd->txd2, MTK_QTX_CTX_PTR);
 
        return 0;
index 2b25824642fab6545f51c3d2895c08619659cccf..eb9f05e0863dc5d6faea2274db2b3be5b5a99f33 100644 (file)
@@ -4424,7 +4424,7 @@ static inline netdev_tx_t __netdev_start_xmit(const struct net_device_ops *ops,
                                              struct sk_buff *skb, struct net_device *dev,
                                              bool more)
 {
-       skb->xmit_more = more ? 1 : 0;
+       __this_cpu_write(softnet_data.xmit.more, more);
        return ops->ndo_start_xmit(skb, dev);
 }