Skip to content

Commit 6b16f9e

Browse files
Florian Westphaldavem330
authored andcommitted
net: move skb->xmit_more hint to softnet data
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 <[email protected]> Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 97cdcf3 commit 6b16f9e

File tree

29 files changed

+35
-32
lines changed

29 files changed

+35
-32
lines changed

drivers/net/ethernet/amazon/ena/ena_netdev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2236,7 +2236,7 @@ static netdev_tx_t ena_start_xmit(struct sk_buff *skb, struct net_device *dev)
22362236
}
22372237
}
22382238

2239-
if (netif_xmit_stopped(txq) || !skb->xmit_more) {
2239+
if (netif_xmit_stopped(txq) || !netdev_xmit_more()) {
22402240
/* trigger the dma engine. ena_com_write_sq_doorbell()
22412241
* has a mb
22422242
*/

drivers/net/ethernet/amd/xgbe/xgbe-dev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1887,7 +1887,7 @@ static void xgbe_dev_xmit(struct xgbe_channel *channel)
18871887
smp_wmb();
18881888

18891889
ring->cur = cur_index + 1;
1890-
if (!packet->skb->xmit_more ||
1890+
if (!netdev_xmit_more() ||
18911891
netif_xmit_stopped(netdev_get_tx_queue(pdata->netdev,
18921892
channel->queue_index)))
18931893
xgbe_tx_start_xmit(channel, ring);

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,15 +551,15 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
551551
prod = NEXT_TX(prod);
552552
txr->tx_prod = prod;
553553

554-
if (!skb->xmit_more || netif_xmit_stopped(txq))
554+
if (!netdev_xmit_more() || netif_xmit_stopped(txq))
555555
bnxt_db_write(bp, &txr->tx_db, prod);
556556

557557
tx_done:
558558

559559
mmiowb();
560560

561561
if (unlikely(bnxt_tx_avail(bp, txr) <= MAX_SKB_FRAGS + 1)) {
562-
if (skb->xmit_more && !tx_buf->is_push)
562+
if (netdev_xmit_more() && !tx_buf->is_push)
563563
bnxt_db_write(bp, &txr->tx_db, prod);
564564

565565
netif_tx_stop_queue(txq);

drivers/net/ethernet/broadcom/genet/bcmgenet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1665,7 +1665,7 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
16651665
if (ring->free_bds <= (MAX_SKB_FRAGS + 1))
16661666
netif_tx_stop_queue(txq);
16671667

1668-
if (!skb->xmit_more || netif_xmit_stopped(txq))
1668+
if (!netdev_xmit_more() || netif_xmit_stopped(txq))
16691669
/* Packets are ready, update producer index */
16701670
bcmgenet_tdma_ring_writel(priv, ring->index,
16711671
ring->prod_index, TDMA_PROD_INDEX);

drivers/net/ethernet/broadcom/tg3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8156,7 +8156,7 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
81568156
netif_tx_wake_queue(txq);
81578157
}
81588158

8159-
if (!skb->xmit_more || netif_xmit_stopped(txq)) {
8159+
if (!netdev_xmit_more() || netif_xmit_stopped(txq)) {
81608160
/* Packets are ready, update Tx producer idx on card. */
81618161
tw32_tx_mbox(tnapi->prodmbox, entry);
81628162
mmiowb();

drivers/net/ethernet/cavium/liquidio/lio_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2522,7 +2522,7 @@ static netdev_tx_t liquidio_xmit(struct sk_buff *skb, struct net_device *netdev)
25222522
irh->vlan = skb_vlan_tag_get(skb) & 0xfff;
25232523
}
25242524

2525-
xmit_more = skb->xmit_more;
2525+
xmit_more = netdev_xmit_more();
25262526

25272527
if (unlikely(cmdsetup.s.timestamp))
25282528
status = send_nic_timestamp_pkt(oct, &ndata, finfo, xmit_more);

drivers/net/ethernet/cavium/liquidio/lio_vf_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1585,7 +1585,7 @@ static netdev_tx_t liquidio_xmit(struct sk_buff *skb, struct net_device *netdev)
15851585
irh->vlan = skb_vlan_tag_get(skb) & VLAN_VID_MASK;
15861586
}
15871587

1588-
xmit_more = skb->xmit_more;
1588+
xmit_more = netdev_xmit_more();
15891589

15901590
if (unlikely(cmdsetup.s.timestamp))
15911591
status = send_nic_timestamp_pkt(oct, &ndata, finfo, xmit_more);

drivers/net/ethernet/cisco/enic/enic_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ static netdev_tx_t enic_hard_start_xmit(struct sk_buff *skb,
897897
if (vnic_wq_desc_avail(wq) < MAX_SKB_FRAGS + ENIC_DESC_MAX_SPLITS)
898898
netif_tx_stop_queue(txq);
899899
skb_tx_timestamp(skb);
900-
if (!skb->xmit_more || netif_xmit_stopped(txq))
900+
if (!netdev_xmit_more() || netif_xmit_stopped(txq))
901901
vnic_wq_doorbell(wq);
902902

903903
spin_unlock(&enic->wq_lock[txq_map]);

drivers/net/ethernet/emulex/benet/be_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1376,7 +1376,7 @@ static netdev_tx_t be_xmit(struct sk_buff *skb, struct net_device *netdev)
13761376
u16 q_idx = skb_get_queue_mapping(skb);
13771377
struct be_tx_obj *txo = &adapter->tx_obj[q_idx];
13781378
struct be_wrb_params wrb_params = { 0 };
1379-
bool flush = !skb->xmit_more;
1379+
bool flush = !netdev_xmit_more();
13801380
u16 wrb_cnt;
13811381

13821382
skb = be_xmit_workarounds(adapter, skb, &wrb_params);

drivers/net/ethernet/huawei/hinic/hinic_tx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ netdev_tx_t hinic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
518518

519519
flush_skbs:
520520
netdev_txq = netdev_get_tx_queue(netdev, q_id);
521-
if ((!skb->xmit_more) || (netif_xmit_stopped(netdev_txq)))
521+
if ((!netdev_xmit_more()) || (netif_xmit_stopped(netdev_txq)))
522522
hinic_sq_write_db(txq->sq, prod_idx, wqe_size, 0);
523523

524524
return err;

drivers/net/ethernet/intel/e1000/e1000_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3267,7 +3267,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
32673267
/* Make sure there is space in the ring for the next send. */
32683268
e1000_maybe_stop_tx(netdev, tx_ring, desc_needed);
32693269

3270-
if (!skb->xmit_more ||
3270+
if (!netdev_xmit_more() ||
32713271
netif_xmit_stopped(netdev_get_tx_queue(netdev, 0))) {
32723272
writel(tx_ring->next_to_use, hw->hw_addr + tx_ring->tdt);
32733273
/* we need this if more than one processor can write to

drivers/net/ethernet/intel/e1000e/netdev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5897,7 +5897,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
58975897
DIV_ROUND_UP(PAGE_SIZE,
58985898
adapter->tx_fifo_limit) + 2));
58995899

5900-
if (!skb->xmit_more ||
5900+
if (!netdev_xmit_more() ||
59015901
netif_xmit_stopped(netdev_get_tx_queue(netdev, 0))) {
59025902
if (adapter->flags2 & FLAG2_PCIM2PCI_ARBITER_WA)
59035903
e1000e_update_tdt_wa(tx_ring,

drivers/net/ethernet/intel/fm10k/fm10k_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,7 @@ static void fm10k_tx_map(struct fm10k_ring *tx_ring,
10351035
fm10k_maybe_stop_tx(tx_ring, DESC_NEEDED);
10361036

10371037
/* notify HW of packet */
1038-
if (netif_xmit_stopped(txring_txq(tx_ring)) || !skb->xmit_more) {
1038+
if (netif_xmit_stopped(txring_txq(tx_ring)) || !netdev_xmit_more()) {
10391039
writel(i, tx_ring->tail);
10401040

10411041
/* we need this if more than one processor can write to our tail

drivers/net/ethernet/intel/i40e/i40e_txrx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3469,7 +3469,7 @@ static inline int i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb,
34693469
first->next_to_watch = tx_desc;
34703470

34713471
/* notify HW of packet */
3472-
if (netif_xmit_stopped(txring_txq(tx_ring)) || !skb->xmit_more) {
3472+
if (netif_xmit_stopped(txring_txq(tx_ring)) || !netdev_xmit_more()) {
34733473
writel(i, tx_ring->tail);
34743474

34753475
/* we need this if more than one processor can write to our tail

drivers/net/ethernet/intel/iavf/iavf_txrx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2358,7 +2358,7 @@ static inline void iavf_tx_map(struct iavf_ring *tx_ring, struct sk_buff *skb,
23582358
first->next_to_watch = tx_desc;
23592359

23602360
/* notify HW of packet */
2361-
if (netif_xmit_stopped(txring_txq(tx_ring)) || !skb->xmit_more) {
2361+
if (netif_xmit_stopped(txring_txq(tx_ring)) || !netdev_xmit_more()) {
23622362
writel(i, tx_ring->tail);
23632363

23642364
/* we need this if more than one processor can write to our tail

drivers/net/ethernet/intel/ice/ice_txrx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1646,7 +1646,7 @@ ice_tx_map(struct ice_ring *tx_ring, struct ice_tx_buf *first,
16461646
ice_maybe_stop_tx(tx_ring, DESC_NEEDED);
16471647

16481648
/* notify HW of packet */
1649-
if (netif_xmit_stopped(txring_txq(tx_ring)) || !skb->xmit_more) {
1649+
if (netif_xmit_stopped(txring_txq(tx_ring)) || !netdev_xmit_more()) {
16501650
writel(i, tx_ring->tail);
16511651

16521652
/* we need this if more than one processor can write to our tail

drivers/net/ethernet/intel/igb/igb_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6029,7 +6029,7 @@ static int igb_tx_map(struct igb_ring *tx_ring,
60296029
/* Make sure there is space in the ring for the next send. */
60306030
igb_maybe_stop_tx(tx_ring, DESC_NEEDED);
60316031

6032-
if (netif_xmit_stopped(txring_txq(tx_ring)) || !skb->xmit_more) {
6032+
if (netif_xmit_stopped(txring_txq(tx_ring)) || !netdev_xmit_more()) {
60336033
writel(i, tx_ring->tail);
60346034

60356035
/* we need this if more than one processor can write to our tail

drivers/net/ethernet/intel/igc/igc_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,7 @@ static int igc_tx_map(struct igc_ring *tx_ring,
939939
/* Make sure there is space in the ring for the next send. */
940940
igc_maybe_stop_tx(tx_ring, DESC_NEEDED);
941941

942-
if (netif_xmit_stopped(txring_txq(tx_ring)) || !skb->xmit_more) {
942+
if (netif_xmit_stopped(txring_txq(tx_ring)) || !netdev_xmit_more()) {
943943
writel(i, tx_ring->tail);
944944

945945
/* we need this if more than one processor can write to our tail

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8297,7 +8297,7 @@ static int ixgbe_tx_map(struct ixgbe_ring *tx_ring,
82978297

82988298
ixgbe_maybe_stop_tx(tx_ring, DESC_NEEDED);
82998299

8300-
if (netif_xmit_stopped(txring_txq(tx_ring)) || !skb->xmit_more) {
8300+
if (netif_xmit_stopped(txring_txq(tx_ring)) || !netdev_xmit_more()) {
83018301
writel(i, tx_ring->tail);
83028302

83038303
/* we need this if more than one processor can write to our tail

drivers/net/ethernet/marvell/mvneta.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2467,7 +2467,7 @@ static netdev_tx_t mvneta_tx(struct sk_buff *skb, struct net_device *dev)
24672467
if (txq->count >= txq->tx_stop_threshold)
24682468
netif_tx_stop_queue(nq);
24692469

2470-
if (!skb->xmit_more || netif_xmit_stopped(nq) ||
2470+
if (!netdev_xmit_more() || netif_xmit_stopped(nq) ||
24712471
txq->pending + frags > MVNETA_TXQ_DEC_SENT_MASK)
24722472
mvneta_txq_pend_desc_add(pp, txq, frags);
24732473
else

drivers/net/ethernet/mediatek/mtk_eth_soc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,8 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev,
767767
*/
768768
wmb();
769769

770-
if (netif_xmit_stopped(netdev_get_tx_queue(dev, 0)) || !skb->xmit_more)
770+
if (netif_xmit_stopped(netdev_get_tx_queue(dev, 0)) ||
771+
!netdev_xmit_more())
771772
mtk_w32(eth, txd->txd2, MTK_QTX_CTX_PTR);
772773

773774
return 0;

drivers/net/ethernet/netronome/nfp/nfp_net_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ static int nfp_net_tx(struct sk_buff *skb, struct net_device *netdev)
909909
nfp_net_tx_ring_stop(nd_q, tx_ring);
910910

911911
tx_ring->wr_ptr_add += nr_frags + 1;
912-
if (__netdev_tx_sent_queue(nd_q, txbuf->real_len, skb->xmit_more))
912+
if (__netdev_tx_sent_queue(nd_q, txbuf->real_len, netdev_xmit_more()))
913913
nfp_net_tx_xmit_more_flush(tx_ring);
914914

915915
return NETDEV_TX_OK;

drivers/net/ethernet/qlogic/qede/qede_fp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,12 +1665,12 @@ netdev_tx_t qede_start_xmit(struct sk_buff *skb, struct net_device *ndev)
16651665
txq->tx_db.data.bd_prod =
16661666
cpu_to_le16(qed_chain_get_prod_idx(&txq->tx_pbl));
16671667

1668-
if (!skb->xmit_more || netif_xmit_stopped(netdev_txq))
1668+
if (!netdev_xmit_more() || netif_xmit_stopped(netdev_txq))
16691669
qede_update_tx_producer(txq);
16701670

16711671
if (unlikely(qed_chain_get_elem_left(&txq->tx_pbl)
16721672
< (MAX_SKB_FRAGS + 1))) {
1673-
if (skb->xmit_more)
1673+
if (netdev_xmit_more())
16741674
qede_update_tx_producer(txq);
16751675

16761676
netif_tx_stop_queue(netdev_txq);

drivers/net/ethernet/rdc/r6040.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ static netdev_tx_t r6040_start_xmit(struct sk_buff *skb,
840840
skb_tx_timestamp(skb);
841841

842842
/* Trigger the MAC to check the TX descriptor */
843-
if (!skb->xmit_more || netif_queue_stopped(dev))
843+
if (!netdev_xmit_more() || netif_queue_stopped(dev))
844844
iowrite16(TM2TX, ioaddr + MTPR);
845845
lp->tx_insert_ptr = descptr->vndescp;
846846

drivers/net/ethernet/synopsys/dwc-xlgmac-hw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,7 @@ static void xlgmac_dev_xmit(struct xlgmac_channel *channel)
995995
smp_wmb();
996996

997997
ring->cur = cur_index + 1;
998-
if (!pkt_info->skb->xmit_more ||
998+
if (!netdev_xmit_more() ||
999999
netif_xmit_stopped(netdev_get_tx_queue(pdata->netdev,
10001000
channel->queue_index)))
10011001
xlgmac_tx_start_xmit(channel, ring);

drivers/net/hyperv/netvsc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ int netvsc_send(struct net_device *ndev,
964964
/* Keep aggregating only if stack says more data is coming
965965
* and not doing mixed modes send and not flow blocked
966966
*/
967-
xmit_more = skb->xmit_more &&
967+
xmit_more = netdev_xmit_more() &&
968968
!packet->cp_partial &&
969969
!netif_xmit_stopped(netdev_get_tx_queue(ndev, packet->q_idx));
970970

drivers/net/virtio_net.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1568,7 +1568,7 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
15681568
struct send_queue *sq = &vi->sq[qnum];
15691569
int err;
15701570
struct netdev_queue *txq = netdev_get_tx_queue(dev, qnum);
1571-
bool kick = !skb->xmit_more;
1571+
bool kick = !netdev_xmit_more();
15721572
bool use_napi = sq->napi.weight;
15731573

15741574
/* Free up any pending old buffers before queueing new ones. */

drivers/staging/mt7621-eth/mtk_eth_soc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,8 @@ static int mtk_pdma_tx_map(struct sk_buff *skb, struct net_device *dev,
741741
wmb();
742742
atomic_set(&ring->tx_free_count, mtk_pdma_empty_txd(ring));
743743

744-
if (netif_xmit_stopped(netdev_get_tx_queue(dev, 0)) || !skb->xmit_more)
744+
if (netif_xmit_stopped(netdev_get_tx_queue(dev, 0)) ||
745+
!netdev_xmit_more())
745746
mtk_reg_w32(eth, ring->tx_next_idx, MTK_REG_TX_CTX_IDX0);
746747

747748
return 0;
@@ -935,7 +936,8 @@ static int mtk_qdma_tx_map(struct sk_buff *skb, struct net_device *dev,
935936
*/
936937
wmb();
937938

938-
if (netif_xmit_stopped(netdev_get_tx_queue(dev, 0)) || !skb->xmit_more)
939+
if (netif_xmit_stopped(netdev_get_tx_queue(dev, 0)) ||
940+
!netdev_xmit_more())
939941
mtk_w32(eth, txd->txd2, MTK_QTX_CTX_PTR);
940942

941943
return 0;

include/linux/netdevice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4424,7 +4424,7 @@ static inline netdev_tx_t __netdev_start_xmit(const struct net_device_ops *ops,
44244424
struct sk_buff *skb, struct net_device *dev,
44254425
bool more)
44264426
{
4427-
skb->xmit_more = more ? 1 : 0;
4427+
__this_cpu_write(softnet_data.xmit.more, more);
44284428
return ops->ndo_start_xmit(skb, dev);
44294429
}
44304430

0 commit comments

Comments
 (0)