Changeset View
Changeset View
Standalone View
Standalone View
sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
Show First 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
struct workqueue_struct *ipoib_workqueue; | struct workqueue_struct *ipoib_workqueue; | ||||
struct ib_sa_client ipoib_sa_client; | struct ib_sa_client ipoib_sa_client; | ||||
static void ipoib_add_one(struct ib_device *device); | static void ipoib_add_one(struct ib_device *device); | ||||
static void ipoib_remove_one(struct ib_device *device, void *client_data); | static void ipoib_remove_one(struct ib_device *device, void *client_data); | ||||
static struct net_device *ipoib_get_net_dev_by_params( | static struct ifnet *ipoib_get_net_dev_by_params( | ||||
struct ib_device *dev, u8 port, u16 pkey, | struct ib_device *dev, u8 port, u16 pkey, | ||||
const union ib_gid *gid, const struct sockaddr *addr, | const union ib_gid *gid, const struct sockaddr *addr, | ||||
void *client_data); | void *client_data); | ||||
static void ipoib_start(struct ifnet *dev); | static void ipoib_start(struct ifnet *dev); | ||||
static int ipoib_ioctl(struct ifnet *ifp, u_long command, caddr_t data); | static int ipoib_ioctl(struct ifnet *ifp, u_long command, caddr_t data); | ||||
static struct unrhdr *ipoib_unrhdr; | static struct unrhdr *ipoib_unrhdr; | ||||
▲ Show 20 Lines • Show All 998 Lines • ▼ Show 20 Lines | list_for_each_entry_safe(priv, tmp, dev_list, list) { | ||||
ipoib_dev_cleanup(priv); | ipoib_dev_cleanup(priv); | ||||
ipoib_detach(priv); | ipoib_detach(priv); | ||||
} | } | ||||
kfree(dev_list); | kfree(dev_list); | ||||
} | } | ||||
static int | static int | ||||
ipoib_match_dev_addr(const struct sockaddr *addr, struct net_device *dev) | ipoib_match_dev_addr(const struct sockaddr *addr, struct ifnet *dev) | ||||
{ | { | ||||
struct epoch_tracker et; | struct epoch_tracker et; | ||||
struct ifaddr *ifa; | struct ifaddr *ifa; | ||||
int retval = 0; | int retval = 0; | ||||
NET_EPOCH_ENTER(et); | NET_EPOCH_ENTER(et); | ||||
CK_STAILQ_FOREACH(ifa, &dev->if_addrhead, ifa_link) { | CK_STAILQ_FOREACH(ifa, &dev->if_addrhead, ifa_link) { | ||||
if (ifa->ifa_addr == NULL || | if (ifa->ifa_addr == NULL || | ||||
Show All 17 Lines | |||||
* exists. | * exists. | ||||
* | * | ||||
* @found_net_dev: contains a matching net_device if the return value | * @found_net_dev: contains a matching net_device if the return value | ||||
* >= 1, with a reference held. | * >= 1, with a reference held. | ||||
*/ | */ | ||||
static int | static int | ||||
ipoib_match_gid_pkey_addr(struct ipoib_dev_priv *priv, | ipoib_match_gid_pkey_addr(struct ipoib_dev_priv *priv, | ||||
const union ib_gid *gid, u16 pkey_index, const struct sockaddr *addr, | const union ib_gid *gid, u16 pkey_index, const struct sockaddr *addr, | ||||
struct net_device **found_net_dev) | struct ifnet **found_net_dev) | ||||
{ | { | ||||
struct ipoib_dev_priv *child_priv; | struct ipoib_dev_priv *child_priv; | ||||
int matches = 0; | int matches = 0; | ||||
if (priv->pkey_index == pkey_index && | if (priv->pkey_index == pkey_index && | ||||
(!gid || !memcmp(gid, &priv->local_gid, sizeof(*gid)))) { | (!gid || !memcmp(gid, &priv->local_gid, sizeof(*gid)))) { | ||||
if (addr == NULL || ipoib_match_dev_addr(addr, priv->dev) != 0) { | if (addr == NULL || ipoib_match_dev_addr(addr, priv->dev) != 0) { | ||||
if (*found_net_dev == NULL) { | if (*found_net_dev == NULL) { | ||||
struct net_device *net_dev; | struct ifnet *net_dev; | ||||
if (priv->parent != NULL) | if (priv->parent != NULL) | ||||
net_dev = priv->parent; | net_dev = priv->parent; | ||||
else | else | ||||
net_dev = priv->dev; | net_dev = priv->dev; | ||||
*found_net_dev = net_dev; | *found_net_dev = net_dev; | ||||
dev_hold(net_dev); | dev_hold(net_dev); | ||||
} | } | ||||
Show All 18 Lines | |||||
* __ipoib_get_net_dev_by_params - returns the number of matching | * __ipoib_get_net_dev_by_params - returns the number of matching | ||||
* net_devs found (between 0 and 2). Also return the matching | * net_devs found (between 0 and 2). Also return the matching | ||||
* net_device in the @net_dev parameter, holding a reference to the | * net_device in the @net_dev parameter, holding a reference to the | ||||
* net_device, if the number of matches >= 1 | * net_device, if the number of matches >= 1 | ||||
*/ | */ | ||||
static int | static int | ||||
__ipoib_get_net_dev_by_params(struct list_head *dev_list, u8 port, | __ipoib_get_net_dev_by_params(struct list_head *dev_list, u8 port, | ||||
u16 pkey_index, const union ib_gid *gid, | u16 pkey_index, const union ib_gid *gid, | ||||
const struct sockaddr *addr, struct net_device **net_dev) | const struct sockaddr *addr, struct ifnet **net_dev) | ||||
{ | { | ||||
struct ipoib_dev_priv *priv; | struct ipoib_dev_priv *priv; | ||||
int matches = 0; | int matches = 0; | ||||
*net_dev = NULL; | *net_dev = NULL; | ||||
list_for_each_entry(priv, dev_list, list) { | list_for_each_entry(priv, dev_list, list) { | ||||
if (priv->port != port) | if (priv->port != port) | ||||
continue; | continue; | ||||
matches += ipoib_match_gid_pkey_addr(priv, gid, pkey_index, | matches += ipoib_match_gid_pkey_addr(priv, gid, pkey_index, | ||||
addr, net_dev); | addr, net_dev); | ||||
if (matches > 1) | if (matches > 1) | ||||
break; | break; | ||||
} | } | ||||
return matches; | return matches; | ||||
} | } | ||||
static struct net_device * | static struct ifnet * | ||||
ipoib_get_net_dev_by_params(struct ib_device *dev, u8 port, u16 pkey, | ipoib_get_net_dev_by_params(struct ib_device *dev, u8 port, u16 pkey, | ||||
const union ib_gid *gid, const struct sockaddr *addr, void *client_data) | const union ib_gid *gid, const struct sockaddr *addr, void *client_data) | ||||
{ | { | ||||
struct net_device *net_dev; | struct ifnet *net_dev; | ||||
struct list_head *dev_list = client_data; | struct list_head *dev_list = client_data; | ||||
u16 pkey_index; | u16 pkey_index; | ||||
int matches; | int matches; | ||||
int ret; | int ret; | ||||
if (!rdma_protocol_ib(dev, port)) | if (!rdma_protocol_ib(dev, port)) | ||||
return NULL; | return NULL; | ||||
▲ Show 20 Lines • Show All 220 Lines • Show Last 20 Lines |