mlx5_translate_port_name(const char *port_name_in,
struct mlx5_switch_info *port_info_out)
{
- char pf_c1, pf_c2, vf_c1, vf_c2, eol;
+ char ctrl = 0, pf_c1, pf_c2, vf_c1, vf_c2, eol;
char *end;
int sc_items;
- /*
- * Check for port-name as a string of the form pf0vf0
- * (support kernel ver >= 5.0 or OFED ver >= 4.6).
- */
+ sc_items = sscanf(port_name_in, "%c%d",
+ &ctrl, &port_info_out->ctrl_num);
+ if (sc_items == 2 && ctrl == 'c') {
+ port_name_in++; /* 'c' */
+ port_name_in += snprintf(NULL, 0, "%d",
+ port_info_out->ctrl_num);
+ }
+ /* Check for port-name as a string of the form pf0vf0 or pf0sf0 */
sc_items = sscanf(port_name_in, "%c%c%d%c%c%d%c",
&pf_c1, &pf_c2, &port_info_out->pf_num,
&vf_c1, &vf_c2, &port_info_out->port_name, &eol);
- if (sc_items == 6 &&
- pf_c1 == 'p' && pf_c2 == 'f' &&
- vf_c1 == 'v' && vf_c2 == 'f') {
- port_info_out->name_type = MLX5_PHYS_PORT_NAME_TYPE_PFVF;
- return;
+ if (sc_items == 6 && pf_c1 == 'p' && pf_c2 == 'f') {
+ if (vf_c1 == 'v' && vf_c2 == 'f') {
+ /* Kernel ver >= 5.0 or OFED ver >= 4.6 */
+ port_info_out->name_type =
+ MLX5_PHYS_PORT_NAME_TYPE_PFVF;
+ return;
+ }
+ if (vf_c1 == 's' && vf_c2 == 'f') {
+ /* Kernel ver >= 5.11 or OFED ver >= 5.1 */
+ port_info_out->name_type =
+ MLX5_PHYS_PORT_NAME_TYPE_PFSF;
+ return;
+ }
}
/*
* Check for port-name as a string of the form p0
int i;
int ret;
+ memset(macs, 0, n * sizeof(macs[0]));
ret = mlx5_nl_mac_addr_list(nlsk_fd, iface_idx, &macs, &macs_n);
if (ret)
return;
case MLX5_PHYS_PORT_NAME_TYPE_PFHPF:
/* Fallthrough */
case MLX5_PHYS_PORT_NAME_TYPE_PFVF:
+ /* Fallthrough */
+ case MLX5_PHYS_PORT_NAME_TYPE_PFSF:
/* New representors naming schema. */
switch_info->representor = 1;
break;
MLX5_PHYS_PORT_NAME_TYPE_UPLINK, /* p0, kernel ver >= 5.0 */
MLX5_PHYS_PORT_NAME_TYPE_PFVF, /* pf0vf0, kernel ver >= 5.0 */
MLX5_PHYS_PORT_NAME_TYPE_PFHPF, /* pf0, kernel ver >= 5.7, HPF rep */
+ MLX5_PHYS_PORT_NAME_TYPE_PFSF, /* pf0sf0, kernel ver >= 5.0 */
MLX5_PHYS_PORT_NAME_TYPE_UNKNOWN, /* Unrecognized. */
};
uint32_t master:1; /**< Master device. */
uint32_t representor:1; /**< Representor device. */
enum mlx5_nl_phys_port_name_type name_type; /** < Port name type. */
+ int32_t ctrl_num; /**< Controller number (valid for c#pf#vf# format). */
int32_t pf_num; /**< PF number (valid for pfxvfx format only). */
int32_t port_name; /**< Representor port name. */
uint64_t switch_id; /**< Switch identifier. */