[dpdk-stable] [PATCH v7] net/i40e: i40e get link status update from ipn3ke
Zhang, Qi Z
qi.z.zhang at intel.com
Thu Jul 11 10:45:33 CEST 2019
> -----Original Message-----
> From: Pei, Andy
> Sent: Thursday, July 11, 2019 2:39 PM
> To: dev at dpdk.org
> Cc: Pei, Andy <andy.pei at intel.com>; Zhang, Qi Z <qi.z.zhang at intel.com>; Wu,
> Jingjing <jingjing.wu at intel.com>; Xing, Beilei <beilei.xing at intel.com>; Yigit,
> Ferruh <ferruh.yigit at intel.com>; Xu, Rosen <rosen.xu at intel.com>; Ye,
> Xiaolong <xiaolong.ye at intel.com>; Zhang, Roy Fan
> <roy.fan.zhang at intel.com>; stable at dpdk.org
> Subject: [PATCH v7] net/i40e: i40e get link status update from ipn3ke
>
> Add switch_mode argument for i40e PF to specify the specific FPGA that i40e
> PF is connected to. i40e PF get link status update via the connected FPGA.
> Add bool switch_ethdev_support_flag to struct i40e_pf to specify if there are
> switch_mode argues in cmd.
> Add switch_ethdev to struct i40e_pf to track the bind switch device.
> Try to bind i40e pf to switch device when i40e device is initialized.
> If it fail to find correct switch device, bind will occur again when update i40e
> device link status.
>
> Signed-off-by: Andy Pei <andy.pei at intel.com>
....
> + /* An example of cfg_str is "IPN3KE_0 at b3:00.0_0" */
My understanding, in above example you want to have
Swtich_name = "0|b3:00.0" and port_name = "0", right?
> + if (!strncmp(cfg_str, "IPN3KE", strlen("IPN3KE"))) {
> + p_src = cfg_str;
> + PMD_DRV_LOG(DEBUG, "cfg_str is %s", cfg_str);
> +
> + /* move over "IPN3KE" */
> + while ((*p_src != '_') && (*p_src))
> + p_src++;
p_src = strchr(p_src, '_') should do the same thing?
> +
> + /* move over the first underline */
> + p_src++;
What if *p_src == null ?, error handle needed.
> +
> + p_dst = switch_name;
> + while ((*p_src != '_') && (*p_src)) {
> + if (*p_src == '@') {
> + *p_dst++ = '|';
Are you replace '@' to '|"? why not define the expected argument as "IPN3KE_0|b3:00.0_0", so can simply do strncpy here.
> + p_src++;
> + } else {
> + *p_dst++ = *p_src++;
> + }
> + }
> + *p_dst = 0;
> + PMD_DRV_LOG(DEBUG, "switch_name is %s", switch_name);
> +
> + /* move over the second underline */
> + p_src++;
Same as above, error handle.
> +
> + p_dst = port_name;
> + while (*p_src)
> + *p_dst++ = *p_src++;
> + *p_dst = 0;
Use strncpy.
...
More information about the stable
mailing list