All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: habetsm.xilinx@gmail.com
Cc: kernel-janitors@vger.kernel.org
Subject: [bug report] sfc/siena: Remove build references to missing functionality
Date: Mon, 16 May 2022 10:13:56 +0300	[thread overview]
Message-ID: <YoH5tJMnwuGTrn1Z@kili> (raw)

Hello Martin Habets,

The patch 956f2d86cb37: "sfc/siena: Remove build references to
missing functionality" from May 9, 2022, leads to the following
Smatch static checker warning:

	drivers/net/ethernet/sfc/siena/tx.c:184 __efx_siena_enqueue_skb()
	warn: duplicate check 'segments' (previous on line 158)

drivers/net/ethernet/sfc/siena/tx.c
    139 netdev_tx_t __efx_siena_enqueue_skb(struct efx_tx_queue *tx_queue,
    140                                     struct sk_buff *skb)
    141 {
    142         unsigned int old_insert_count = tx_queue->insert_count;
    143         bool xmit_more = netdev_xmit_more();
    144         bool data_mapped = false;
    145         unsigned int segments;
    146         unsigned int skb_len;
    147         int rc;
    148 
    149         skb_len = skb->len;
    150         segments = skb_is_gso(skb) ? skb_shinfo(skb)->gso_segs : 0;
    151         if (segments == 1)
    152                 segments = 0; /* Don't use TSO for a single segment. */
    153 
    154         /* Handle TSO first - it's *possible* (although unlikely) that we might
    155          * be passed a packet to segment that's smaller than the copybreak/PIO
    156          * size limit.
    157          */
    158         if (segments) {
    159                 rc = efx_siena_tx_tso_fallback(tx_queue, skb);
    160                 tx_queue->tso_fallbacks++;
    161                 if (rc == 0)
    162                         return 0;
    163                 goto err;

If segments is non-zero then we hit this goto.

    164         } else if (skb->data_len && skb_len <= EFX_TX_CB_SIZE) {
    165                 /* Pad short packets or coalesce short fragmented packets. */
    166                 if (efx_enqueue_skb_copy(tx_queue, skb))
    167                         goto err;
    168                 tx_queue->cb_packets++;
    169                 data_mapped = true;
    170         }
    171 
    172         /* Map for DMA and create descriptors if we haven't done so already. */
    173         if (!data_mapped && (efx_siena_tx_map_data(tx_queue, skb, segments)))
    174                 goto err;
    175 
    176         efx_tx_maybe_stop_queue(tx_queue);
    177 
    178         tx_queue->xmit_pending = true;
    179 
    180         /* Pass off to hardware */
    181         if (__netdev_tx_sent_queue(tx_queue->core_txq, skb_len, xmit_more))
    182                 efx_tx_send_pending(tx_queue->channel);
    183 
--> 184         if (segments) {

So this if statement can be deleted.

    185                 tx_queue->tso_bursts++;
    186                 tx_queue->tso_packets += segments;
    187                 tx_queue->tx_packets  += segments;
    188         } else {
    189                 tx_queue->tx_packets++;
    190         }
    191 
    192         return NETDEV_TX_OK;
    193 
    194 
    195 err:
    196         efx_siena_enqueue_unwind(tx_queue, old_insert_count);
    197         dev_kfree_skb_any(skb);
    198 
    199         /* If we're not expecting another transmit and we had something to push
    200          * on this queue or a partner queue then we need to push here to get the
    201          * previous packets out.
    202          */
    203         if (!xmit_more)
    204                 efx_tx_send_pending(tx_queue->channel);
    205 
    206         return NETDEV_TX_OK;
    207 }

regards,
dan carpenter

             reply	other threads:[~2022-05-16  7:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16  7:13 Dan Carpenter [this message]
2022-05-18 15:07 ` [bug report] sfc/siena: Remove build references to missing functionality Martin Habets

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YoH5tJMnwuGTrn1Z@kili \
    --to=dan.carpenter@oracle.com \
    --cc=habetsm.xilinx@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.