Re: [net-next PATCH 2/2] net: dsa: qca8k: add LAG support

From: kernel test robot
Date: Tue Nov 23 2021 - 10:33:50 EST


Hi Ansuel,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url: https://github.com/0day-ci/linux/commits/Ansuel-Smith/Add-mirror-and-LAG-support-to-qca8k/20211123-110018
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 3b0e04140bc30f9f5c254a68013a901e5390b0a8
config: i386-randconfig-a012-20211123 (https://download.01.org/0day-ci/archive/20211123/202111232352.6wBDdqCJ-lkp@xxxxxxxxx/config.gz)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 49e3838145dff1ec91c2e67a2cb562775c8d2a08)
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
# https://github.com/0day-ci/linux/commit/8fe5def54ec185d13c952a5f4da988ee7757ad78
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Ansuel-Smith/Add-mirror-and-LAG-support-to-qca8k/20211123-110018
git checkout 8fe5def54ec185d13c952a5f4da988ee7757ad78
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=i386

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/dsa/qca8k.c:2231:44: warning: overlapping comparisons always evaluate to true [-Wtautological-overlap-compare]
if (info->hash_type != NETDEV_LAG_HASH_L2 ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
>> drivers/net/dsa/qca8k.c:2252:3: warning: variable 'hash' is uninitialized when used here [-Wuninitialized]
hash |= QCA8K_TRUNK_HASH_SIP_EN;
^~~~
drivers/net/dsa/qca8k.c:2246:10: note: initialize the variable 'hash' to silence this warning
u32 hash;
^
= 0
2 warnings generated.


vim +2231 drivers/net/dsa/qca8k.c

2208
2209 static bool
2210 qca8k_lag_can_offload(struct dsa_switch *ds,
2211 struct net_device *lag,
2212 struct netdev_lag_upper_info *info)
2213 {
2214 struct dsa_port *dp;
2215 int id, members = 0;
2216
2217 id = dsa_lag_id(ds->dst, lag);
2218 if (id < 0 || id >= ds->num_lag_ids)
2219 return false;
2220
2221 dsa_lag_foreach_port(dp, ds->dst, lag)
2222 /* Includes the port joining the LAG */
2223 members++;
2224
2225 if (members > QCA8K_NUM_PORTS_FOR_LAG)
2226 return false;
2227
2228 if (info->tx_type != NETDEV_LAG_TX_TYPE_HASH)
2229 return false;
2230
> 2231 if (info->hash_type != NETDEV_LAG_HASH_L2 ||
2232 info->hash_type != NETDEV_LAG_HASH_L23)
2233 return false;
2234
2235 return true;
2236 }
2237
2238 static int
2239 qca8k_lag_setup_hash(struct dsa_switch *ds,
2240 struct net_device *lag,
2241 struct netdev_lag_upper_info *info)
2242 {
2243 struct qca8k_priv *priv = ds->priv;
2244 bool unique_lag = true;
2245 int i, id;
2246 u32 hash;
2247
2248 id = dsa_lag_id(ds->dst, lag);
2249
2250 switch (info->hash_type) {
2251 case NETDEV_LAG_HASH_L23:
> 2252 hash |= QCA8K_TRUNK_HASH_SIP_EN;
2253 hash |= QCA8K_TRUNK_HASH_DIP_EN;
2254 fallthrough;
2255 case NETDEV_LAG_HASH_L2:
2256 hash |= QCA8K_TRUNK_HASH_SA_EN;
2257 hash |= QCA8K_TRUNK_HASH_DA_EN;
2258 break;
2259 default: /* We should NEVER reach this */
2260 return -EOPNOTSUPP;
2261 }
2262
2263 /* Check if we are the unique configured LAG */
2264 dsa_lags_foreach_id(i, ds->dst)
2265 if (i != id && dsa_lag_dev(ds->dst, i)) {
2266 unique_lag = false;
2267 break;
2268 }
2269
2270 /* Hash Mode is global. Make sure the same Hash Mode
2271 * is set to all the 4 possible lag.
2272 * If we are the unique LAG we can set whatever hash
2273 * mode we want.
2274 * To change hash mode it's needed to remove all LAG
2275 * and change the mode with the latest.
2276 */
2277 if (unique_lag) {
2278 priv->lag_hash_mode = hash;
2279 } else if (priv->lag_hash_mode != hash) {
2280 netdev_err(lag, "Error: Mismateched Hash Mode across different lag is not supported\n");
2281 return -EOPNOTSUPP;
2282 }
2283
2284 return regmap_update_bits(priv->regmap, QCA8K_TRUNK_HASH_EN_CTRL,
2285 QCA8K_TRUNK_HASH_MASK, hash);
2286 }
2287

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