linux/net/smc/smc_pnet.c
/* Determine the corresponding IB device port based on the hardware PNETID.
 * Searching stops at the first matching active IB device port with vlan_id
 * configured.
 */
Determine the corresponding IB device port based on the hardware PNETID.
Searching stops at the first matching active IB device port with vlan_id
configured.
Determine the corresponding IB device port based on the hardware PNETID . Searching stops at the first matching active IB device port with vlan_id configured .
static void smc_pnet_find_roce_by_pnetid(struct net_device *ndev,
					 struct smc_ib_device **smcibdev,
					 u8 *ibport, unsigned short vlan_id,
					 u8 gid[])
{
	u8 ndev_pnetid[SMC_MAX_PNETID_LEN];
	struct smc_ib_device *ibdev;
	int i;
	ndev = pnet_find_base_ndev(ndev);
	if (smc_pnetid_by_dev_port(ndev->dev.parent, ndev->dev_port,
				   ndev_pnetid))
		return; 
	spin_lock(&smc_ib_devices.lock);
	list_for_each_entry(ibdev, &smc_ib_devices.list, list) {
		for (i = 1; i <= SMC_MAX_PORTS; i++) {
			if (!rdma_is_port_valid(ibdev->ibdev, i))
				continue;
			if (!memcmp(ibdev->pnetid[i - 1], ndev_pnetid,
				    SMC_MAX_PNETID_LEN) &&
			    smc_ib_port_active(ibdev, i) &&
			    !smc_ib_determine_gid(ibdev, i, vlan_id, gid,
						  NULL))  {
				*smcibdev = ibdev;
				*ibport = i;
				goto out;
			}
		}
	}
out:
	spin_unlock(&smc_ib_devices.lock);
}
static void smc_pnet_find_roce_by_pnetid ( struct net_device * ndev , struct smc_ib_device * * smcibdev , u8 * ibport , unsigned short vlan_id , u8 gid [ ] ) { u8 ndev_pnetid [ SMC_MAX_PNETID_LEN ] ; struct smc_ib_device * ibdev ; int i ; ndev = pnet_find_base_ndev ( ndev ) ; if ( smc_pnetid_by_dev_port ( ndev -> dev . parent , ndev -> dev_port , ndev_pnetid ) ) return ; spin_lock ( & smc_ib_devices . lock ) ; list_for_each_entry ( ibdev , & smc_ib_devices . list , list ) { for ( i = 1 ; i <= SMC_MAX_PORTS ; i ++ ) { if ( ! rdma_is_port_valid ( ibdev -> ibdev , i ) ) continue ; if ( ! memcmp ( ibdev -> pnetid [ i - 1 ] , ndev_pnetid , SMC_MAX_PNETID_LEN ) && smc_ib_port_active ( ibdev , i ) && ! smc_ib_determine_gid ( ibdev , i , vlan_id , gid , NULL ) ) { * smcibdev = ibdev ; * ibport = i ; goto out ; } } } out : spin_unlock ( & smc_ib_devices . lock ) ; }
Determine the corresponding IB device port based on the hardware PNETID.
Determine the corresponding IB device port based on the hardware PNETID .
/* pnetid could not be determined */