Thread (25 messages) 25 messages, 5 authors, 2019-07-11

Re: [dpdk-dev] [PATCH v7] net/i40e: i40e get link status update from ipn3ke

From: Zhang, Qi Z <hidden>
Date: 2019-07-11 08:45:40

-----Original Message-----
From: Pei, Andy
Sent: Thursday, July 11, 2019 2:39 PM
To: dev@dpdk.org
Cc: Pei, Andy <redacted>; Zhang, Qi Z <redacted>; Wu,
Jingjing [off-list ref]; Xing, Beilei [off-list ref]; Yigit,
Ferruh [off-list ref]; Xu, Rosen [off-list ref]; Ye,
Xiaolong [off-list ref]; Zhang, Roy Fan
[off-list ref]; stable@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 <redacted>
....
+	/* An example of cfg_str is "IPN3KE_0@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.

...
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help