Skip to content

Commit c797ce1

Browse files
peterdelevoryasdavem330
authored andcommitted
net/ncsi: Simplify Kconfig/dts control flow
Background: 1. CONFIG_NCSI_OEM_CMD_KEEP_PHY If this is enabled, we send an extra OEM Intel command in the probe sequence immediately after discovering a channel (e.g. after "Clear Initial State"). 2. CONFIG_NCSI_OEM_CMD_GET_MAC If this is enabled, we send one of 3 OEM "Get MAC Address" commands from Broadcom, Mellanox (Nvidida), and Intel in the *configuration* sequence for a channel. 3. mellanox,multi-host (or mlx,multi-host) Introduced by this patch: https://lore.kernel.org/all/20200108234341.2590674-1-vijaykhemka@fb.com/ Which was actually originally from cosmo.chou@quantatw.com: facebook/openbmc-linux@9f132a1 Cosmo claimed that the Nvidia ConnectX-4 and ConnectX-6 NIC's don't respond to Get Version ID, et. al in the probe sequence unless you send the Set MC Affinity command first. Problem Statement: We've been using a combination of #ifdef code blocks and IS_ENABLED() conditions to conditionally send these OEM commands. It makes adding any new code around these commands hard to understand. Solution: In this patch, I just want to remove the conditionally compiled blocks of code, and always use IS_ENABLED(...) to do dynamic control flow. I don't think the small amount of code this adds to non-users of the OEM Kconfigs is a big deal. Signed-off-by: Peter Delevoryas <peter@pjd.dev> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f967226 commit c797ce1

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

net/ncsi/ncsi-manage.c

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -689,8 +689,6 @@ static int set_one_vid(struct ncsi_dev_priv *ndp, struct ncsi_channel *nc,
689689
return 0;
690690
}
691691

692-
#if IS_ENABLED(CONFIG_NCSI_OEM_CMD_KEEP_PHY)
693-
694692
static int ncsi_oem_keep_phy_intel(struct ncsi_cmd_arg *nca)
695693
{
696694
unsigned char data[NCSI_OEM_INTEL_CMD_KEEP_PHY_LEN];
@@ -716,10 +714,6 @@ static int ncsi_oem_keep_phy_intel(struct ncsi_cmd_arg *nca)
716714
return ret;
717715
}
718716

719-
#endif
720-
721-
#if IS_ENABLED(CONFIG_NCSI_OEM_CMD_GET_MAC)
722-
723717
/* NCSI OEM Command APIs */
724718
static int ncsi_oem_gma_handler_bcm(struct ncsi_cmd_arg *nca)
725719
{
@@ -856,8 +850,6 @@ static int ncsi_gma_handler(struct ncsi_cmd_arg *nca, unsigned int mf_id)
856850
return nch->handler(nca);
857851
}
858852

859-
#endif /* CONFIG_NCSI_OEM_CMD_GET_MAC */
860-
861853
/* Determine if a given channel from the channel_queue should be used for Tx */
862854
static bool ncsi_channel_is_tx(struct ncsi_dev_priv *ndp,
863855
struct ncsi_channel *nc)
@@ -1039,20 +1031,18 @@ static void ncsi_configure_channel(struct ncsi_dev_priv *ndp)
10391031
goto error;
10401032
}
10411033

1042-
nd->state = ncsi_dev_state_config_oem_gma;
1034+
nd->state = IS_ENABLED(CONFIG_NCSI_OEM_CMD_GET_MAC)
1035+
? ncsi_dev_state_config_oem_gma
1036+
: ncsi_dev_state_config_clear_vids;
10431037
break;
10441038
case ncsi_dev_state_config_oem_gma:
10451039
nd->state = ncsi_dev_state_config_clear_vids;
1046-
ret = -1;
10471040

1048-
#if IS_ENABLED(CONFIG_NCSI_OEM_CMD_GET_MAC)
10491041
nca.type = NCSI_PKT_CMD_OEM;
10501042
nca.package = np->id;
10511043
nca.channel = nc->id;
10521044
ndp->pending_req_num = 1;
10531045
ret = ncsi_gma_handler(&nca, nc->version.mf_id);
1054-
#endif /* CONFIG_NCSI_OEM_CMD_GET_MAC */
1055-
10561046
if (ret < 0)
10571047
schedule_work(&ndp->work);
10581048

@@ -1404,7 +1394,6 @@ static void ncsi_probe_channel(struct ncsi_dev_priv *ndp)
14041394

14051395
schedule_work(&ndp->work);
14061396
break;
1407-
#if IS_ENABLED(CONFIG_NCSI_OEM_CMD_GET_MAC)
14081397
case ncsi_dev_state_probe_mlx_gma:
14091398
ndp->pending_req_num = 1;
14101399

@@ -1429,7 +1418,6 @@ static void ncsi_probe_channel(struct ncsi_dev_priv *ndp)
14291418

14301419
nd->state = ncsi_dev_state_probe_cis;
14311420
break;
1432-
#endif /* CONFIG_NCSI_OEM_CMD_GET_MAC */
14331421
case ncsi_dev_state_probe_cis:
14341422
ndp->pending_req_num = NCSI_RESERVED_CHANNEL;
14351423

@@ -1447,7 +1435,6 @@ static void ncsi_probe_channel(struct ncsi_dev_priv *ndp)
14471435
if (IS_ENABLED(CONFIG_NCSI_OEM_CMD_KEEP_PHY))
14481436
nd->state = ncsi_dev_state_probe_keep_phy;
14491437
break;
1450-
#if IS_ENABLED(CONFIG_NCSI_OEM_CMD_KEEP_PHY)
14511438
case ncsi_dev_state_probe_keep_phy:
14521439
ndp->pending_req_num = 1;
14531440

@@ -1460,7 +1447,6 @@ static void ncsi_probe_channel(struct ncsi_dev_priv *ndp)
14601447

14611448
nd->state = ncsi_dev_state_probe_gvi;
14621449
break;
1463-
#endif /* CONFIG_NCSI_OEM_CMD_KEEP_PHY */
14641450
case ncsi_dev_state_probe_gvi:
14651451
case ncsi_dev_state_probe_gc:
14661452
case ncsi_dev_state_probe_gls:

0 commit comments

Comments
 (0)