linux/net/smc/smc_pnet.c
/* Append a pnetid to the end of the pnet table if not already on this list.
 */
Append a pnetid to the end of the pnet table if not already on this list.
Append a pnetid to the end of the pnet table if not already on this list .
static int smc_pnet_enter(struct smc_pnetentry *new_pnetelem)
{
	struct smc_pnetentry *pnetelem;
	int rc = -EEXIST;
	write_lock(&smc_pnettable.lock);
	list_for_each_entry(pnetelem, &smc_pnettable.pnetlist, list) {
		if (!strncmp(pnetelem->pnet_name, new_pnetelem->pnet_name,
			     sizeof(new_pnetelem->pnet_name)) ||
		    !strncmp(pnetelem->ndev->name, new_pnetelem->ndev->name,
			     sizeof(new_pnetelem->ndev->name)) ||
		    smc_pnet_same_ibname(pnetelem,
					 new_pnetelem->smcibdev->ibdev->name,
					 new_pnetelem->ib_port)) {
			dev_put(pnetelem->ndev);
			goto found;
		}
	}
	list_add_tail(&new_pnetelem->list, &smc_pnettable.pnetlist);
	rc = 0;
found:
	write_unlock(&smc_pnettable.lock);
	return rc;
}
static int smc_pnet_enter ( struct smc_pnetentry * new_pnetelem ) { struct smc_pnetentry * pnetelem ; int rc = - EEXIST ; write_lock ( & smc_pnettable . lock ) ; list_for_each_entry ( pnetelem , & smc_pnettable . pnetlist , list ) { if ( ! strncmp ( pnetelem -> pnet_name , new_pnetelem -> pnet_name , sizeof ( new_pnetelem -> pnet_name ) ) || ! strncmp ( pnetelem -> ndev -> name , new_pnetelem -> ndev -> name , sizeof ( new_pnetelem -> ndev -> name ) ) || smc_pnet_same_ibname ( pnetelem , new_pnetelem -> smcibdev -> ibdev -> name , new_pnetelem -> ib_port ) ) { dev_put ( pnetelem -> ndev ) ; goto found ; } } list_add_tail ( & new_pnetelem -> list , & smc_pnettable . pnetlist ) ; rc = 0 ; found : write_unlock ( & smc_pnettable . lock ) ; return rc ; }
Append a pnetid to the end of the pnet table if not already on this list.
Append a pnetid to the end of the pnet table if not already on this list .