MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sfc_parse_switch_mode

Function sfc_parse_switch_mode

dpdk/drivers/net/sfc/sfc_ethdev.c:3068–3107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3066}
3067
3068static int
3069sfc_parse_switch_mode(struct sfc_adapter *sa, bool has_representors)
3070{
3071 const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);
3072 const char *switch_mode = NULL;
3073 int rc;
3074
3075 sfc_log_init(sa, "entry");
3076
3077 rc = sfc_kvargs_process(sa, SFC_KVARG_SWITCH_MODE,
3078 sfc_kvarg_string_handler, &switch_mode);
3079 if (rc != 0)
3080 goto fail_kvargs;
3081
3082 if (switch_mode == NULL) {
3083 sa->switchdev = encp->enc_mae_admin &&
3084 (!encp->enc_datapath_cap_evb ||
3085 has_representors);
3086 } else if (strcasecmp(switch_mode, SFC_KVARG_SWITCH_MODE_LEGACY) == 0) {
3087 sa->switchdev = false;
3088 } else if (strcasecmp(switch_mode,
3089 SFC_KVARG_SWITCH_MODE_SWITCHDEV) == 0) {
3090 sa->switchdev = true;
3091 } else {
3092 sfc_err(sa, "invalid switch mode device argument '%s'",
3093 switch_mode);
3094 rc = EINVAL;
3095 goto fail_mode;
3096 }
3097
3098 sfc_log_init(sa, "done");
3099
3100 return 0;
3101
3102fail_mode:
3103fail_kvargs:
3104 sfc_log_init(sa, "failed: %s", rte_strerror(rc));
3105
3106 return rc;
3107}
3108
3109static int
3110sfc_eth_dev_init(struct rte_eth_dev *dev, void *init_params)

Callers 1

sfc_eth_dev_initFunction · 0.85

Calls 4

efx_nic_cfg_getFunction · 0.85
sfc_kvargs_processFunction · 0.85
strcasecmpFunction · 0.85
rte_strerrorFunction · 0.85

Tested by

no test coverage detected