Skip to contentSkip to conversation

sfc: Convert the normal transmit complete path to dev_consume_skb_any()

PATCH Applied Rick Jones 4 participants 6 messages Sep 9, 2014 – Sep 10, 2014

Subsystems (3)
lore
Share & tools
lore

Rick Jones

author
#0 lore raw

PATCH 1/1 sfc: Convert the normal transmit complete path to dev_consume_skb_any()

From: Rick Jones <[email protected]>

Convert the normal transmit completion path from dev_kfree_skb_any() to dev_consume_skb_any() to help keep dropped packet profiling meaningful.

---

Compile tested only. Also a fixup to make scripts/checkpatch.pl happy.

drivers/net/ethernet/sfc/tx.c +1 -1
index 65c220f..3206098 100644
@@ -78,7 +78,7 @@ static void efx_dequeue_buffer(struct efx_tx_queue *tx_queue,
 	if (buffer->flags & EFX_TX_BUF_SKB) {
 		(*pkts_compl)++;
 		(*bytes_compl) += buffer->skb->len;
-		dev_kfree_skb_any((struct sk_buff *) buffer->skb);
+		dev_consume_skb_any((struct sk_buff *)buffer->skb);
 		netif_vdbg(tx_queue->efx, tx_done, tx_queue->efx->net_dev,
 			   "TX queue %d transmission id %x complete\n",
 			   tx_queue->queue, tx_queue->read_count);
#1 lore raw
Quoted 18 lines · Rick Jones

From: Rick Jones <[email protected]>

Convert the normal transmit completion path from dev_kfree_skb_any() to dev_consume_skb_any() to help keep dropped packet profiling meaningful.

---

Compile tested only. Also a fixup to make scripts/checkpatch.pl happy.

drivers/net/ethernet/sfc/tx.c +0 -0
index 65c220f..3206098 100644

drivers/net/ethernet/sfc/tx.c static void efx_dequeue_buffer(struct efx_tx_queue *tx_queue, · line 84

Quoted 8 lines
drivers/net/ethernet/sfc/tx.c +1 -1
@@ -78,7 +78,7 @@ static void efx_dequeue_buffer(struct efx_tx_queue *tx_queue,
 	if (buffer->flags & EFX_TX_BUF_SKB) {
 		(*pkts_compl)++;
 		(*bytes_compl) += buffer->skb->len;
-		dev_kfree_skb_any((struct sk_buff *) buffer->skb);
+		dev_consume_skb_any((struct sk_buff *)buffer->skb);
 		netif_vdbg(tx_queue->efx, tx_done, tx_queue->efx->net_dev,
 			   "TX queue %d transmission id %x complete\n",
 			   tx_queue->queue, tx_queue->read_count);

Right, but please remove this ugly cast while you are at it ;)

#2 lore raw
Quoted 6 lines · Eric Dumazet
Quoted 5 lines · Rick Jones

From: Rick Jones <[email protected]>
...
Compile tested only. Also a fixup to make scripts/checkpatch.pl happy.

Quoted 16 lines

drivers/net/ethernet/sfc/tx.c static void efx_dequeue_buffer(struct efx_tx_queue *tx_queue, · line 84

Quoted 13 lines
drivers/net/ethernet/sfc/tx.c +1 -1
index 65c220f..3206098 100644
@@ -78,7 +78,7 @@ static void efx_dequeue_buffer(struct efx_tx_queue *tx_queue,
  	if (buffer->flags & EFX_TX_BUF_SKB) {
  		(*pkts_compl)++;
  		(*bytes_compl) += buffer->skb->len;
-		dev_kfree_skb_any((struct sk_buff *) buffer->skb);
+		dev_consume_skb_any((struct sk_buff *)buffer->skb);
  		netif_vdbg(tx_queue->efx, tx_done, tx_queue->efx->net_dev,
  			   "TX queue %d transmission id %x complete\n",
  			   tx_queue->queue, tx_queue->read_count);

Right, but please remove this ugly cast while you are at it ;)

I can remove that const, and then smooth the ripples stemming from it to arrive at something like:

drivers/net/ethernet/sfc/net_driver.h +1 -1
index 9ede320..a75aa08 100644
@@ -148,7 +148,7 @@ struct efx_special_buffer {
  */
 struct efx_tx_buffer {
        union {
-               const struct sk_buff *skb;
+               struct sk_buff *skb;
                void *heap_buf;
        };
        union {
drivers/net/ethernet/sfc/tx.c +2 -2
index 65c220f..a43c0c5 100644
@@ -78,7 +78,7 @@ static void efx_dequeue_buffer(struct efx_tx_queue *tx_queue,
        if (buffer->flags & EFX_TX_BUF_SKB) {
                (*pkts_compl)++;
                (*bytes_compl) += buffer->skb->len;
-               dev_kfree_skb_any((struct sk_buff *) buffer->skb);
+               dev_consume_skb_any(buffer->skb);
                netif_vdbg(tx_queue->efx, tx_done, tx_queue->efx->net_dev,
                           "TX queue %d transmission id %x complete\n",
                           tx_queue->queue, tx_queue->read_count);
@@ -1086,7 +1086,7 @@ static int tso_get_fragment(struct tso_state *st, struct e
  * of fragment or end-of-packet.
  */
 static void tso_fill_packet_with_fragment(struct efx_tx_queue *tx_queue,
-                                         const struct sk_buff *skb,
+                                         struct sk_buff *skb,
                                          struct tso_state *st)
 {
        struct efx_tx_buffer *buffer;

(might be mangled by this email client)

But perhaps someone from SolarFlare can say why that was a const to begin with.

rick

maintainer
#3 lore raw

From: Rick Jones <[email protected]>
Date: Tue, 09 Sep 2014 16:38:32 -0700

Quoted 2 lines

But perhaps someone from SolarFlare can say why that was a const to begin with.

Probably to trap skb->x modifications after the SKB has been placed in these entries, except for these explicit spots where the casts are applied.

maintainer Applied
#5 lore raw

From: Eric Dumazet <[email protected]>
Date: Tue, 09 Sep 2014 17:25:30 -0700

Quoted 9 lines · Rick Jones
Quoted 3 lines

I can remove that const, and then smooth the ripples stemming from it to arrive at something like:

Oh I missed this const, so this will be a different patch, sorry for this.

Applied, thanks everyone.