[ti:ti-rt-linux-5.10.y 7157/9316] drivers/net/ethernet/ti/cpsw.c:916:22: warning: variable 'len' set but not used

From: kernel test robot
Date: Tue Sep 14 2021 - 21:28:39 EST


Hi Grygorii,

FYI, the error/warning still remains.

tree: git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git ti-rt-linux-5.10.y
head: 43939f54c26e9885d7f59f18ee97dd76393606f9
commit: 6853acd9be4e17522e3c3b2ec30c3ce8e46b6b9e [7157/9316] HACK: net: ethernet: ti: cpsw: allow to configure min tx packet size
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git remote add ti git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git
git fetch --no-tags ti ti-rt-linux-5.10.y
git checkout 6853acd9be4e17522e3c3b2ec30c3ce8e46b6b9e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=mips

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

drivers/net/ethernet/ti/cpsw.c: In function 'cpsw_ndo_start_xmit':
>> drivers/net/ethernet/ti/cpsw.c:916:22: warning: variable 'len' set but not used [-Wunused-but-set-variable]
916 | unsigned int len;
| ^~~


vim +/len +916 drivers/net/ethernet/ti/cpsw.c

907
908 static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb,
909 struct net_device *ndev)
910 {
911 struct cpsw_priv *priv = netdev_priv(ndev);
912 struct cpsw_common *cpsw = priv->cpsw;
913 struct cpts *cpts = cpsw->cpts;
914 struct netdev_queue *txq;
915 struct cpdma_chan *txch;
> 916 unsigned int len;
917 int ret, q_idx;
918
919 if (skb_padto(skb, tx_packet_min)) {
920 cpsw_err(priv, tx_err, "packet pad failed\n");
921 ndev->stats.tx_dropped++;
922 return NET_XMIT_DROP;
923 }
924
925 len = skb->len < tx_packet_min ? tx_packet_min : skb->len;
926
927 if (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP &&
928 priv->tx_ts_enabled && cpts_can_timestamp(cpts, skb))
929 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
930
931 q_idx = skb_get_queue_mapping(skb);
932 if (q_idx >= cpsw->tx_ch_num)
933 q_idx = q_idx % cpsw->tx_ch_num;
934
935 txch = cpsw->txv[q_idx].ch;
936 txq = netdev_get_tx_queue(ndev, q_idx);
937 skb_tx_timestamp(skb);
938 ret = cpdma_chan_submit(txch, skb, skb->data, skb->len,
939 priv->emac_port + cpsw->data.dual_emac);
940 if (unlikely(ret != 0)) {
941 cpsw_err(priv, tx_err, "desc submit failed\n");
942 goto fail;
943 }
944
945 /* If there is no more tx desc left free then we need to
946 * tell the kernel to stop sending us tx frames.
947 */
948 if (unlikely(!cpdma_check_free_tx_desc(txch))) {
949 netif_tx_stop_queue(txq);
950
951 /* Barrier, so that stop_queue visible to other cpus */
952 smp_mb__after_atomic();
953
954 if (cpdma_check_free_tx_desc(txch))
955 netif_tx_wake_queue(txq);
956 }
957
958 return NETDEV_TX_OK;
959 fail:
960 ndev->stats.tx_dropped++;
961 netif_tx_stop_queue(txq);
962
963 /* Barrier, so that stop_queue visible to other cpus */
964 smp_mb__after_atomic();
965
966 if (cpdma_check_free_tx_desc(txch))
967 netif_tx_wake_queue(txq);
968
969 return NETDEV_TX_BUSY;
970 }
971

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip