Skip to contentSkip to conversation

net: Adding support for Cavium ThunderX network controller

DISCUSSION Dan Carpenter 1 participant 2 messages May 29, 2015 Kernel janitors

lore
Share & tools
lore
#0 lore raw

Hello Sunil Goutham,

The patch 4863dea3fab0: "net: Adding support for Cavium ThunderX network controller" from May 26, 2015, leads to the following static checker warning:

drivers/net/ethernet/cavium/thunder/thunder_bgx.c:485 bgx_xaui_check_link()
warn: we tested 'lmac_type = 3' before and it was 'false'

drivers/net/ethernet/cavium/thunder/thunder_bgx.c
484
485 if ((lmac_type = BGX_MODE_10G_KR) || (lmac_type = BGX_MODE_XFI) ||

                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^      ^^^^^^^^^^^^^^^^^^^^^^^^^

These are the both 3. That seems like it could lead to bugs down the line.

   486              (lmac_type = BGX_MODE_40G_KR) || (lmac_type = BGX_MODE_XLAUI)) {
                                  ^^^^^^^^^^^^^^^                   ^^^^^^^^^^^^^^

These are both 4.

   487                  if (bgx_poll_reg(bgx, lmacid, BGX_SPUX_BR_STATUS1,
   488                                   SPU_BR_STATUS_BLK_LOCK, false)) {
   489                          dev_err(&bgx->pdev->dev,
   490                                  "SPU_BR_STATUS_BLK_LOCK not completed\n");
   491                          return -1;
   492                  }
   493          } else {

regards,
dan carpenter

#1 lore raw

Hello Sunil Goutham,

The patch 4863dea3fab0: "net: Adding support for Cavium ThunderX network controller" from May 26, 2015, leads to the following static checker warning:

drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c:517 nicvf_set_rxfh()
warn: we tested 'hkey' before and it was 'false'

drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c
506 /* We do not allow change in unsupported parameters */
507 if (hkey ||

                    ^^^^

We return here.

508 (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP))
509 return -EOPNOTSUPP;
510
511 rss->enable = true;
512 if (indir) {
513 for (idx = 0; idx < rss->rss_size; idx++)
514 rss->ind_tbl[idx] = indir[idx];
515 }
516

   517          if (hkey) {
                    ^^^^

So this is dead code.

   518                  memcpy(rss->key, hkey, RSS_HASH_KEY_SIZE * sizeof(u64));
   519                  nicvf_set_rss_key(nic);
   520          }
   521  
   522          nicvf_config_rss(nic);
   523          return 0;
   524  }

regards,
dan carpenter