Skip to content

Commit bfc6c67

Browse files
Guangguan Wangdavem330
authored andcommitted
net/smc: use the correct ndev to find pnetid by pnetid table
When using smc_pnet in SMC, it will only search the pnetid in the base_ndev of the netdev hierarchy(both HW PNETID and User-defined sw pnetid). This may not work for some scenarios when using SMC in container on cloud environment. In container, there have choices of different container network, such as directly using host network, virtual network IPVLAN, veth, etc. Different choices of container network have different netdev hierarchy. Examples of netdev hierarchy show below. (eth0 and eth1 in host below is the netdev directly related to the physical device). _______________________________ | _________________ | | |POD | | | | | | | | eth0_________ | | | |____| |__| | | | | | | | | | | eth1|base_ndev| eth0_______ | | | | | RDMA || | host |_________| |_______|| --------------------------------- netdev hierarchy if directly using host network ________________________________ | _________________ | | |POD __________ | | | | |upper_ndev| | | | |eth0|__________| | | | |_______|_________| | | |lower netdev | | __|______ | | eth1| | eth0_______ | | |base_ndev| | RDMA || | host |_________| |_______|| --------------------------------- netdev hierarchy if using IPVLAN _______________________________ | _____________________ | | |POD _________ | | | | |base_ndev|| | | |eth0(veth)|_________|| | | |____________|________| | | |pairs | | _______|_ | | | | eth0_______ | | veth|base_ndev| | RDMA || | |_________| |_______|| | _________ | | eth1|base_ndev| | | host |_________| | --------------------------------- netdev hierarchy if using veth Due to some reasons, the eth1 in host is not RDMA attached netdevice, pnetid is needed to map the eth1(in host) with RDMA device so that POD can do SMC-R. Because the eth1(in host) is managed by CNI plugin(such as Terway, network management plugin in container environment), and in cloud environment the eth(in host) can dynamically be inserted by CNI when POD create and dynamically be removed by CNI when POD destroy and no POD related to the eth(in host) anymore. It is hard to config the pnetid to the eth1(in host). But it is easy to config the pnetid to the netdevice which can be seen in POD. When do SMC-R, both the container directly using host network and the container using veth network can successfully match the RDMA device, because the configured pnetid netdev is a base_ndev. But the container using IPVLAN can not successfully match the RDMA device and 0x03030000 fallback happens, because the configured pnetid netdev is not a base_ndev. Additionally, if config pnetid to the eth1(in host) also can not work for matching RDMA device when using veth network and doing SMC-R in POD. To resolve the problems list above, this patch extends to search user -defined sw pnetid in the clc handshake ndev when no pnetid can be found in the base_ndev, and the base_ndev take precedence over ndev for backward compatibility. This patch also can unify the pnetid setup of different network choices list above in container(Config user-defined sw pnetid in the netdevice can be seen in POD). Signed-off-by: Guangguan Wang <[email protected]> Reviewed-by: Wenjia Zhang <[email protected]> Reviewed-by: Halil Pasic <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a1e36ec commit bfc6c67

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

net/smc/smc_pnet.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,14 +1079,16 @@ static void smc_pnet_find_roce_by_pnetid(struct net_device *ndev,
10791079
struct smc_init_info *ini)
10801080
{
10811081
u8 ndev_pnetid[SMC_MAX_PNETID_LEN];
1082+
struct net_device *base_ndev;
10821083
struct net *net;
10831084

1084-
ndev = pnet_find_base_ndev(ndev);
1085+
base_ndev = pnet_find_base_ndev(ndev);
10851086
net = dev_net(ndev);
1086-
if (smc_pnetid_by_dev_port(ndev->dev.parent, ndev->dev_port,
1087+
if (smc_pnetid_by_dev_port(base_ndev->dev.parent, base_ndev->dev_port,
10871088
ndev_pnetid) &&
1089+
smc_pnet_find_ndev_pnetid_by_table(base_ndev, ndev_pnetid) &&
10881090
smc_pnet_find_ndev_pnetid_by_table(ndev, ndev_pnetid)) {
1089-
smc_pnet_find_rdma_dev(ndev, ini);
1091+
smc_pnet_find_rdma_dev(base_ndev, ini);
10901092
return; /* pnetid could not be determined */
10911093
}
10921094
_smc_pnet_find_roce_by_pnetid(ndev_pnetid, ini, NULL, net);

0 commit comments

Comments
 (0)