| 3066 | } |
| 3067 | |
| 3068 | static int |
| 3069 | sfc_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 | |
| 3102 | fail_mode: |
| 3103 | fail_kvargs: |
| 3104 | sfc_log_init(sa, "failed: %s", rte_strerror(rc)); |
| 3105 | |
| 3106 | return rc; |
| 3107 | } |
| 3108 | |
| 3109 | static int |
| 3110 | sfc_eth_dev_init(struct rte_eth_dev *dev, void *init_params) |
no test coverage detected