ofed: Mechanically convert to IfAPI

Summary:
Because of the intricacies of this code it wasn't purely scripted, but
instead hand-mechanical.

Reviewed by:	hselasky
Sponsored by:	Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D38560
This commit is contained in:
Justin Hibbits 2023-02-08 21:31:24 -05:00 committed by Oscar Zhao
parent f6ab1e562c
commit 72f8fa7978
23 changed files with 401 additions and 379 deletions

View File

@ -82,10 +82,10 @@ void ib_cache_setup(void);
void ib_cache_cleanup(void);
typedef void (*roce_netdev_callback)(struct ib_device *device, u8 port,
struct ifnet *idev, void *cookie);
if_t idev, void *cookie);
typedef int (*roce_netdev_filter)(struct ib_device *device, u8 port,
struct ifnet *idev, void *cookie);
if_t idev, void *cookie);
void ib_enum_roce_netdev(struct ib_device *ib_dev,
roce_netdev_filter filter,
@ -107,7 +107,7 @@ int ib_cache_gid_parse_type_str(const char *buf);
const char *ib_cache_gid_type_str(enum ib_gid_type gid_type);
void ib_cache_gid_set_default_gid(struct ib_device *ib_dev, u8 port,
struct ifnet *ndev,
if_t ndev,
unsigned long gid_type_mask,
enum ib_cache_gid_default_mode mode);
@ -118,8 +118,8 @@ int ib_cache_gid_del(struct ib_device *ib_dev, u8 port,
union ib_gid *gid, struct ib_gid_attr *attr);
int ib_cache_gid_del_all_netdev_gids(struct ib_device *ib_dev, u8 port,
struct ifnet *ndev);
void ib_cache_gid_del_all_by_netdev(struct ifnet *ndev);
if_t ndev);
void ib_cache_gid_del_all_by_netdev(if_t ndev);
int roce_gid_mgmt_init(void);
void roce_gid_mgmt_cleanup(void);

View File

@ -140,32 +140,34 @@ rdma_copy_addr_sub(u8 *dst, const u8 *src, unsigned min, unsigned max)
memset(dst + min, 0, max - min);
}
int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct ifnet *dev,
int rdma_copy_addr(struct rdma_dev_addr *dev_addr, if_t dev,
const unsigned char *dst_dev_addr)
{
int dev_type = if_gettype(dev);
/* check for loopback device */
if (dev->if_flags & IFF_LOOPBACK) {
if (if_getflags(dev) & IFF_LOOPBACK) {
dev_addr->dev_type = ARPHRD_ETHER;
memset(dev_addr->src_dev_addr, 0, MAX_ADDR_LEN);
memset(dev_addr->broadcast, 0, MAX_ADDR_LEN);
memset(dev_addr->dst_dev_addr, 0, MAX_ADDR_LEN);
dev_addr->bound_dev_if = dev->if_index;
dev_addr->bound_dev_if = if_getindex(dev);
return (0);
} else if (dev->if_type == IFT_INFINIBAND)
} else if (dev_type == IFT_INFINIBAND)
dev_addr->dev_type = ARPHRD_INFINIBAND;
else if (dev->if_type == IFT_ETHER || dev->if_type == IFT_L2VLAN)
else if (dev_type == IFT_ETHER || dev_type == IFT_L2VLAN)
dev_addr->dev_type = ARPHRD_ETHER;
else
dev_addr->dev_type = 0;
rdma_copy_addr_sub(dev_addr->src_dev_addr, IF_LLADDR(dev),
dev->if_addrlen, MAX_ADDR_LEN);
rdma_copy_addr_sub(dev_addr->broadcast, dev->if_broadcastaddr,
dev->if_addrlen, MAX_ADDR_LEN);
rdma_copy_addr_sub(dev_addr->src_dev_addr, if_getlladdr(dev),
if_getaddrlen(dev), MAX_ADDR_LEN);
rdma_copy_addr_sub(dev_addr->broadcast, if_getbroadcastaddr(dev),
if_getaddrlen(dev), MAX_ADDR_LEN);
if (dst_dev_addr != NULL) {
rdma_copy_addr_sub(dev_addr->dst_dev_addr, dst_dev_addr,
dev->if_addrlen, MAX_ADDR_LEN);
if_getaddrlen(dev), MAX_ADDR_LEN);
}
dev_addr->bound_dev_if = dev->if_index;
dev_addr->bound_dev_if = if_getindex(dev);
return 0;
}
EXPORT_SYMBOL(rdma_copy_addr);
@ -173,7 +175,7 @@ EXPORT_SYMBOL(rdma_copy_addr);
int rdma_translate_ip(const struct sockaddr *addr,
struct rdma_dev_addr *dev_addr)
{
struct ifnet *dev;
if_t dev;
int ret;
if (dev_addr->bound_dev_if) {
@ -198,7 +200,7 @@ int rdma_translate_ip(const struct sockaddr *addr,
if (dev != NULL) {
/* disallow connections through 127.0.0.1 itself */
if (dev->if_flags & IFF_LOOPBACK)
if (if_getflags(dev) & IFF_LOOPBACK)
ret = -EINVAL;
else
ret = rdma_copy_addr(dev_addr, dev, NULL);
@ -241,7 +243,7 @@ static void queue_req(struct addr_req *req)
}
#if defined(INET) || defined(INET6)
static int addr_resolve_multi(u8 *edst, struct ifnet *ifp, struct sockaddr *dst_in)
static int addr_resolve_multi(u8 *edst, if_t ifp, struct sockaddr *dst_in)
{
struct sockaddr *llsa;
struct sockaddr_dl sdl;
@ -250,14 +252,10 @@ static int addr_resolve_multi(u8 *edst, struct ifnet *ifp, struct sockaddr *dst_
sdl.sdl_len = sizeof(sdl);
llsa = (struct sockaddr *)&sdl;
if (ifp->if_resolvemulti == NULL) {
error = EOPNOTSUPP;
} else {
error = ifp->if_resolvemulti(ifp, &llsa, dst_in);
if (error == 0) {
rdma_copy_addr_sub(edst, LLADDR((struct sockaddr_dl *)llsa),
ifp->if_addrlen, MAX_ADDR_LEN);
}
error = if_resolvemulti(ifp, &llsa, dst_in);
if (error == 0) {
rdma_copy_addr_sub(edst, LLADDR((struct sockaddr_dl *)llsa),
if_getaddrlen(ifp), MAX_ADDR_LEN);
}
return (error);
}
@ -268,7 +266,7 @@ static int addr4_resolve(struct sockaddr_in *src_in,
const struct sockaddr_in *dst_in,
struct rdma_dev_addr *addr,
u8 *edst,
struct ifnet **ifpp)
if_t *ifpp)
{
enum {
ADDR_VALID = 0,
@ -279,7 +277,7 @@ static int addr4_resolve(struct sockaddr_in *src_in,
in_port_t src_port;
struct sockaddr *saddr = NULL;
struct nhop_object *nh;
struct ifnet *ifp;
if_t ifp;
int error;
int type;
@ -332,13 +330,13 @@ static int addr4_resolve(struct sockaddr_in *src_in,
if (ifp == NULL) {
error = ENETUNREACH;
goto done;
} else if (ifp->if_flags & IFF_LOOPBACK) {
} else if (if_getflags(ifp) & IFF_LOOPBACK) {
/*
* Source address cannot be a loopback device.
*/
error = EHOSTUNREACH;
goto error_put_ifp;
} else if (nh->nh_ifp->if_flags & IFF_LOOPBACK) {
} else if (if_getflags(nh->nh_ifp) & IFF_LOOPBACK) {
if (memcmp(&src_in->sin_addr, &dst_in->sin_addr,
sizeof(src_in->sin_addr))) {
/*
@ -364,7 +362,7 @@ static int addr4_resolve(struct sockaddr_in *src_in,
break;
case ADDR_SRC_ANY:
/* check for loopback device */
if (nh->nh_ifp->if_flags & IFF_LOOPBACK)
if (if_getflags(nh->nh_ifp) & IFF_LOOPBACK)
saddr = (struct sockaddr *)&dst_tmp;
else
saddr = nh->nh_ifa->ifa_addr;
@ -381,8 +379,8 @@ static int addr4_resolve(struct sockaddr_in *src_in,
* Step 3 - resolve destination MAC address
*/
if (dst_tmp.sin_addr.s_addr == INADDR_BROADCAST) {
rdma_copy_addr_sub(edst, ifp->if_broadcastaddr,
ifp->if_addrlen, MAX_ADDR_LEN);
rdma_copy_addr_sub(edst, if_getbroadcastaddr(ifp),
if_getaddrlen(ifp), MAX_ADDR_LEN);
error = 0;
} else if (IN_MULTICAST(ntohl(dst_tmp.sin_addr.s_addr))) {
bool is_gw = (nh->nh_flags & NHF_GATEWAY) != 0;
@ -391,7 +389,7 @@ static int addr4_resolve(struct sockaddr_in *src_in,
goto error_put_ifp;
else if (is_gw)
addr->network = RDMA_NETWORK_IPV4;
} else if (ifp->if_flags & IFF_LOOPBACK) {
} else if (if_getflags(ifp) & IFF_LOOPBACK) {
memset(edst, 0, MAX_ADDR_LEN);
error = 0;
} else {
@ -440,7 +438,7 @@ static int addr4_resolve(struct sockaddr_in *src_in,
const struct sockaddr_in *dst_in,
struct rdma_dev_addr *addr,
u8 *edst,
struct ifnet **ifpp)
if_t *ifpp)
{
return -EADDRNOTAVAIL;
}
@ -451,7 +449,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in,
const struct sockaddr_in6 *dst_in,
struct rdma_dev_addr *addr,
u8 *edst,
struct ifnet **ifpp)
if_t *ifpp)
{
enum {
ADDR_VALID = 0,
@ -462,7 +460,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in,
in_port_t src_port;
struct sockaddr *saddr = NULL;
struct nhop_object *nh;
struct ifnet *ifp;
if_t ifp;
int error;
int type;
@ -530,13 +528,13 @@ static int addr6_resolve(struct sockaddr_in6 *src_in,
if (ifp == NULL) {
error = ENETUNREACH;
goto done;
} else if (ifp->if_flags & IFF_LOOPBACK) {
} else if (if_getflags(ifp) & IFF_LOOPBACK) {
/*
* Source address cannot be a loopback device.
*/
error = EHOSTUNREACH;
goto error_put_ifp;
} else if (nh->nh_ifp->if_flags & IFF_LOOPBACK) {
} else if (if_getflags(nh->nh_ifp) & IFF_LOOPBACK) {
if (memcmp(&src_in->sin6_addr, &dst_in->sin6_addr,
sizeof(src_in->sin6_addr))) {
/*
@ -562,7 +560,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in,
break;
case ADDR_SRC_ANY:
/* check for loopback device */
if (nh->nh_ifp->if_flags & IFF_LOOPBACK)
if (if_getflags(nh->nh_ifp) & IFF_LOOPBACK)
saddr = (struct sockaddr *)&dst_tmp;
else
saddr = nh->nh_ifa->ifa_addr;
@ -586,7 +584,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in,
goto error_put_ifp;
else if (is_gw)
addr->network = RDMA_NETWORK_IPV6;
} else if (nh->nh_ifp->if_flags & IFF_LOOPBACK) {
} else if (if_getflags(nh->nh_ifp) & IFF_LOOPBACK) {
memset(edst, 0, MAX_ADDR_LEN);
error = 0;
} else {
@ -628,18 +626,18 @@ static int addr6_resolve(struct sockaddr_in6 *src_in,
const struct sockaddr_in6 *dst_in,
struct rdma_dev_addr *addr,
u8 *edst,
struct ifnet **ifpp)
if_t *ifpp)
{
return -EADDRNOTAVAIL;
}
#endif
static int addr_resolve_neigh(struct ifnet *dev,
static int addr_resolve_neigh(if_t dev,
const struct sockaddr *dst_in,
u8 *edst,
struct rdma_dev_addr *addr)
{
if (dev->if_flags & IFF_LOOPBACK) {
if (if_getflags(dev) & IFF_LOOPBACK) {
int ret;
/*
@ -647,7 +645,7 @@ static int addr_resolve_neigh(struct ifnet *dev,
* sure the destination device address is global by
* clearing the bound device interface:
*/
if (addr->bound_dev_if == dev->if_index)
if (addr->bound_dev_if == if_getindex(dev))
addr->bound_dev_if = 0;
ret = rdma_translate_ip(dst_in, addr);
@ -659,7 +657,7 @@ static int addr_resolve_neigh(struct ifnet *dev,
}
/* If the device doesn't do ARP internally */
if (!(dev->if_flags & IFF_NOARP))
if (!(if_getflags(dev) & IFF_NOARP))
return rdma_copy_addr(addr, dev, edst);
return rdma_copy_addr(addr, dev, NULL);
@ -670,7 +668,7 @@ static int addr_resolve(struct sockaddr *src_in,
struct rdma_dev_addr *addr)
{
struct epoch_tracker et;
struct ifnet *ndev = NULL;
if_t ndev = NULL;
u8 edst[MAX_ADDR_LEN];
int ret;
@ -860,7 +858,7 @@ static void resolve_cb(int status, struct sockaddr *src_addr,
int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid,
const union ib_gid *dgid,
u8 *dmac, struct ifnet *dev,
u8 *dmac, if_t dev,
int *hoplimit)
{
int ret = 0;
@ -874,7 +872,7 @@ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid,
memset(&dev_addr, 0, sizeof(dev_addr));
dev_addr.bound_dev_if = dev->if_index;
dev_addr.bound_dev_if = if_getindex(dev);
dev_addr.net = dev_net(dev);
ctx.addr = &dev_addr;

View File

@ -183,7 +183,7 @@ static int write_gid(struct ib_device *ib_dev, u8 port,
__releases(&table->rwlock) __acquires(&table->rwlock)
{
int ret = 0;
struct ifnet *old_net_dev;
if_t old_net_dev;
enum ib_gid_type old_gid_type;
/* in rdma_cap_roce_gid_table, this funciton should be protected by a
@ -311,12 +311,12 @@ static int find_gid(struct ib_gid_table *table, const union ib_gid *gid,
return found;
}
static void addrconf_ifid_eui48(u8 *eui, struct ifnet *dev)
static void addrconf_ifid_eui48(u8 *eui, if_t dev)
{
if (dev->if_addrlen != ETH_ALEN)
if (if_getaddrlen(dev) != ETH_ALEN)
return;
memcpy(eui, IF_LLADDR(dev), 3);
memcpy(eui + 5, IF_LLADDR(dev) + 3, 3);
memcpy(eui, if_getlladdr(dev), 3);
memcpy(eui + 5, if_getlladdr(dev) + 3, 3);
/* NOTE: The scope ID is added by the GID to IP conversion */
@ -325,7 +325,7 @@ static void addrconf_ifid_eui48(u8 *eui, struct ifnet *dev)
eui[0] ^= 2;
}
static void make_default_gid(struct ifnet *dev, union ib_gid *gid)
static void make_default_gid(if_t dev, union ib_gid *gid)
{
gid->global.subnet_prefix = cpu_to_be64(0xfe80000000000000LL);
addrconf_ifid_eui48(&gid->raw[8], dev);
@ -400,7 +400,7 @@ int ib_cache_gid_del(struct ib_device *ib_dev, u8 port,
}
int ib_cache_gid_del_all_netdev_gids(struct ib_device *ib_dev, u8 port,
struct ifnet *ndev)
if_t ndev)
{
struct ib_gid_table **ports_table = ib_dev->cache.gid_cache;
struct ib_gid_table *table;
@ -447,8 +447,8 @@ static int __ib_cache_gid_get(struct ib_device *ib_dev, u8 port, int index,
memcpy(attr, &table->data_vec[index].attr, sizeof(*attr));
/* make sure network device is valid and attached */
if (attr->ndev != NULL &&
(attr->ndev->if_flags & IFF_DYING) == 0 &&
attr->ndev->if_addr != NULL)
(if_getflags(attr->ndev) & IFF_DYING) == 0 &&
if_getifaddr(attr->ndev) != NULL)
dev_hold(attr->ndev);
else
attr->ndev = NULL;
@ -490,7 +490,7 @@ static int _ib_cache_gid_table_find(struct ib_device *ib_dev,
static int ib_cache_gid_find(struct ib_device *ib_dev,
const union ib_gid *gid,
enum ib_gid_type gid_type,
struct ifnet *ndev, u8 *port,
if_t ndev, u8 *port,
u16 *index)
{
unsigned long mask = GID_ATTR_FIND_MASK_GID |
@ -507,7 +507,7 @@ static int ib_cache_gid_find(struct ib_device *ib_dev,
int ib_find_cached_gid_by_port(struct ib_device *ib_dev,
const union ib_gid *gid,
enum ib_gid_type gid_type,
u8 port, struct ifnet *ndev,
u8 port, if_t ndev,
u16 *index)
{
int local_index;
@ -672,7 +672,7 @@ static void cleanup_gid_table_port(struct ib_device *ib_dev, u8 port,
}
void ib_cache_gid_set_default_gid(struct ib_device *ib_dev, u8 port,
struct ifnet *ndev,
if_t ndev,
unsigned long gid_type_mask,
enum ib_cache_gid_default_mode mode)
{
@ -899,7 +899,7 @@ EXPORT_SYMBOL(ib_get_cached_gid);
int ib_find_cached_gid(struct ib_device *device,
const union ib_gid *gid,
enum ib_gid_type gid_type,
struct ifnet *ndev,
if_t ndev,
u8 *port_num,
u16 *index)
{

View File

@ -503,7 +503,7 @@ static int cm_init_av_by_path(struct ib_sa_path_rec *path, struct cm_av *av,
unsigned long flags;
int ret;
u8 p;
struct ifnet *ndev = ib_get_ndev_from_path(path);
if_t ndev = ib_get_ndev_from_path(path);
read_lock_irqsave(&cm.device_lock, flags);
list_for_each_entry(cm_dev, &cm.device_list, list) {
@ -1819,7 +1819,7 @@ static int cm_req_handler(struct cm_work *work)
&gid, &gid_attr);
if (!ret) {
if (gid_attr.ndev) {
work->path[0].ifindex = gid_attr.ndev->if_index;
work->path[0].ifindex = if_getindex(gid_attr.ndev);
work->path[0].net = dev_net(gid_attr.ndev);
dev_put(gid_attr.ndev);
}
@ -1833,7 +1833,7 @@ static int cm_req_handler(struct cm_work *work)
&work->path[0].sgid,
&gid_attr);
if (!err && gid_attr.ndev) {
work->path[0].ifindex = gid_attr.ndev->if_index;
work->path[0].ifindex = if_getindex(gid_attr.ndev);
work->path[0].net = dev_net(gid_attr.ndev);
dev_put(gid_attr.ndev);
}

View File

@ -461,7 +461,7 @@ static inline void sdp_set_ip_ver(struct sdp_hh *hh, u8 ip_ver)
hh->ipv_cap = (ip_ver << 4) | (hh->ipv_cap & 0xF);
}
static int cma_igmp_send(struct ifnet *ndev, const union ib_gid *mgid, bool join)
static int cma_igmp_send(if_t ndev, const union ib_gid *mgid, bool join)
{
int retval;
@ -470,7 +470,7 @@ static int cma_igmp_send(struct ifnet *ndev, const union ib_gid *mgid, bool join
rdma_gid2ip(&addr._sockaddr, mgid);
CURVNET_SET_QUIET(ndev->if_vnet);
CURVNET_SET_QUIET(if_getvnet(ndev));
if (join)
retval = -if_addmulti(ndev, &addr._sockaddr, NULL);
else
@ -603,7 +603,7 @@ static inline int cma_validate_port(struct ib_device *device, u8 port,
const struct rdma_dev_addr *dev_addr)
{
const int dev_type = dev_addr->dev_type;
struct ifnet *ndev;
if_t ndev;
int ret = -ENODEV;
if ((dev_type == ARPHRD_INFINIBAND) && !rdma_protocol_ib(device, port))
@ -1396,21 +1396,21 @@ static bool validate_ipv4_net_dev_addr(struct vnet *vnet,
}
#endif
static bool validate_ipv4_net_dev(struct ifnet *net_dev,
static bool validate_ipv4_net_dev(if_t net_dev,
const struct sockaddr_in *dst_addr,
const struct sockaddr_in *src_addr)
{
#ifdef INET
__be32 daddr = dst_addr->sin_addr.s_addr,
saddr = src_addr->sin_addr.s_addr;
struct ifnet *dst_dev;
if_t dst_dev;
struct nhop_object *nh;
bool ret;
if (validate_ipv4_net_dev_addr(net_dev->if_vnet, saddr, daddr))
if (validate_ipv4_net_dev_addr(if_getvnet(net_dev), saddr, daddr))
return false;
dst_dev = ip_ifp_find(net_dev->if_vnet, daddr);
dst_dev = ip_ifp_find(if_getvnet(net_dev), daddr);
if (dst_dev != net_dev) {
if (dst_dev != NULL)
dev_put(dst_dev);
@ -1424,7 +1424,7 @@ static bool validate_ipv4_net_dev(struct ifnet *net_dev,
if (saddr == daddr)
return true;
CURVNET_SET(net_dev->if_vnet);
CURVNET_SET(if_getvnet(net_dev));
nh = fib4_lookup(RT_DEFAULT_FIB, src_addr->sin_addr, 0, NHR_NONE, 0);
if (nh != NULL)
ret = (nh->nh_ifp == net_dev);
@ -1437,19 +1437,19 @@ static bool validate_ipv4_net_dev(struct ifnet *net_dev,
#endif
}
static bool validate_ipv6_net_dev(struct ifnet *net_dev,
static bool validate_ipv6_net_dev(if_t net_dev,
const struct sockaddr_in6 *dst_addr,
const struct sockaddr_in6 *src_addr)
{
#ifdef INET6
struct sockaddr_in6 src_tmp = *src_addr;
struct sockaddr_in6 dst_tmp = *dst_addr;
struct ifnet *dst_dev;
if_t dst_dev;
struct nhop_object *nh;
bool ret;
dst_dev = ip6_ifp_find(net_dev->if_vnet, dst_tmp.sin6_addr,
net_dev->if_index);
dst_dev = ip6_ifp_find(if_getvnet(net_dev), dst_tmp.sin6_addr,
if_getindex(net_dev));
if (dst_dev != net_dev) {
if (dst_dev != NULL)
dev_put(dst_dev);
@ -1457,15 +1457,15 @@ static bool validate_ipv6_net_dev(struct ifnet *net_dev,
}
dev_put(dst_dev);
CURVNET_SET(net_dev->if_vnet);
CURVNET_SET(if_getvnet(net_dev));
/*
* Make sure the scope ID gets embedded.
*/
src_tmp.sin6_scope_id = net_dev->if_index;
src_tmp.sin6_scope_id = if_getindex(net_dev);
sa6_embedscope(&src_tmp, 0);
dst_tmp.sin6_scope_id = net_dev->if_index;
dst_tmp.sin6_scope_id = if_getindex(net_dev);
sa6_embedscope(&dst_tmp, 0);
/*
@ -1478,7 +1478,7 @@ static bool validate_ipv6_net_dev(struct ifnet *net_dev,
} else {
/* non-loopback case */
nh = fib6_lookup(RT_DEFAULT_FIB, &src_addr->sin6_addr,
net_dev->if_index, NHR_NONE, 0);
if_getindex(net_dev), NHR_NONE, 0);
if (nh != NULL)
ret = (nh->nh_ifp == net_dev);
else
@ -1491,7 +1491,7 @@ static bool validate_ipv6_net_dev(struct ifnet *net_dev,
#endif
}
static bool validate_net_dev(struct ifnet *net_dev,
static bool validate_net_dev(if_t net_dev,
const struct sockaddr *daddr,
const struct sockaddr *saddr)
{
@ -1514,7 +1514,7 @@ static bool validate_net_dev(struct ifnet *net_dev,
}
}
static struct ifnet *
static if_t
roce_get_net_dev_by_cm_event(struct ib_device *device, u8 port_num,
const struct ib_cm_event *ib_event)
{
@ -1534,13 +1534,13 @@ roce_get_net_dev_by_cm_event(struct ib_device *device, u8 port_num,
return (sgid_attr.ndev);
}
static struct ifnet *cma_get_net_dev(struct ib_cm_event *ib_event,
static if_t cma_get_net_dev(struct ib_cm_event *ib_event,
const struct cma_req_info *req)
{
struct sockaddr_storage listen_addr_storage, src_addr_storage;
struct sockaddr *listen_addr = (struct sockaddr *)&listen_addr_storage,
*src_addr = (struct sockaddr *)&src_addr_storage;
struct ifnet *net_dev;
if_t net_dev;
const union ib_gid *gid = req->has_gid ? &req->local_gid : NULL;
struct epoch_tracker et;
int err;
@ -1672,7 +1672,7 @@ static bool cma_protocol_roce(const struct rdma_cm_id *id)
}
static bool cma_match_net_dev(const struct rdma_cm_id *id,
const struct ifnet *net_dev,
const if_t net_dev,
u8 port_num)
{
const struct rdma_addr *addr = &id->route.addr;
@ -1694,7 +1694,7 @@ static bool cma_match_net_dev(const struct rdma_cm_id *id,
return !addr->dev_addr.bound_dev_if ||
(net_eq(dev_net(net_dev), addr->dev_addr.net) &&
addr->dev_addr.bound_dev_if == net_dev->if_index);
addr->dev_addr.bound_dev_if == if_getindex(net_dev));
}
static struct rdma_id_private *cma_find_listener(
@ -1702,7 +1702,7 @@ static struct rdma_id_private *cma_find_listener(
const struct ib_cm_id *cm_id,
const struct ib_cm_event *ib_event,
const struct cma_req_info *req,
const struct ifnet *net_dev)
const if_t net_dev)
{
struct rdma_id_private *id_priv, *id_priv_dev;
@ -1729,7 +1729,7 @@ static struct rdma_id_private *cma_find_listener(
static struct rdma_id_private *cma_id_from_event(struct ib_cm_id *cm_id,
struct ib_cm_event *ib_event,
struct ifnet **net_dev)
if_t *net_dev)
{
struct cma_req_info req;
struct rdma_bind_list *bind_list;
@ -1864,7 +1864,7 @@ static void cma_leave_mc_groups(struct rdma_id_private *id_priv)
if (mc->igmp_joined) {
struct rdma_dev_addr *dev_addr =
&id_priv->id.route.addr.dev_addr;
struct ifnet *ndev = NULL;
if_t ndev = NULL;
if (dev_addr->bound_dev_if)
ndev = dev_get_by_index(dev_addr->net,
@ -2053,7 +2053,7 @@ static int cma_ib_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event)
static struct rdma_id_private *cma_new_conn_id(struct rdma_cm_id *listen_id,
struct ib_cm_event *ib_event,
struct ifnet *net_dev)
if_t net_dev)
{
struct rdma_id_private *id_priv;
struct rdma_cm_id *id;
@ -2115,7 +2115,7 @@ static struct rdma_id_private *cma_new_conn_id(struct rdma_cm_id *listen_id,
static struct rdma_id_private *cma_new_udp_id(struct rdma_cm_id *listen_id,
struct ib_cm_event *ib_event,
struct ifnet *net_dev)
if_t net_dev)
{
struct rdma_id_private *id_priv;
struct rdma_cm_id *id;
@ -2183,7 +2183,7 @@ static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event)
{
struct rdma_id_private *listen_id, *conn_id = NULL;
struct rdma_cm_event event;
struct ifnet *net_dev;
if_t net_dev;
int offset, ret;
listen_id = cma_id_from_event(cm_id, ib_event, &net_dev);
@ -2731,7 +2731,7 @@ static int cma_resolve_iw_route(struct rdma_id_private *id_priv, int timeout_ms)
return 0;
}
static int iboe_tos_to_sl(struct ifnet *ndev, int tos)
static int iboe_tos_to_sl(if_t ndev, int tos)
{
/* get service level, SL, from IPv4 type of service, TOS */
int sl = (tos >> 5) & 0x7;
@ -2758,7 +2758,7 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
struct rdma_addr *addr = &route->addr;
struct cma_work *work;
int ret;
struct ifnet *ndev = NULL;
if_t ndev = NULL;
work = kzalloc(sizeof *work, GFP_KERNEL);
@ -2786,8 +2786,8 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
goto err2;
}
route->path_rec->net = ndev->if_vnet;
route->path_rec->ifindex = ndev->if_index;
route->path_rec->net = if_getvnet(ndev);
route->path_rec->ifindex = if_getindex(ndev);
supported_gids = roce_gid_type_mask_support(id_priv->id.device,
id_priv->id.port_num);
route->path_rec->gid_type =
@ -2820,7 +2820,7 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
route->path_rec->mtu_selector = IB_SA_EQ;
route->path_rec->sl = iboe_tos_to_sl(ndev, id_priv->tos);
route->path_rec->traffic_class = id_priv->tos;
route->path_rec->mtu = iboe_get_mtu(ndev->if_mtu);
route->path_rec->mtu = iboe_get_mtu(if_getmtu(ndev));
route->path_rec->rate_selector = IB_SA_EQ;
route->path_rec->rate = iboe_get_rate(ndev);
dev_put(ndev);
@ -4083,7 +4083,7 @@ static int cma_ib_mc_handler(int status, struct ib_sa_multicast *multicast)
if (!status) {
struct rdma_dev_addr *dev_addr =
&id_priv->id.route.addr.dev_addr;
struct ifnet *ndev =
if_t ndev =
dev_get_by_index(dev_addr->net, dev_addr->bound_dev_if);
enum ib_gid_type gid_type =
id_priv->cma_dev->default_gid_type[id_priv->id.port_num -
@ -4310,7 +4310,7 @@ static int cma_iboe_join_multicast(struct rdma_id_private *id_priv,
struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr;
int err = 0;
struct sockaddr *addr = (struct sockaddr *)&mc->addr;
struct ifnet *ndev = NULL;
if_t ndev = NULL;
enum ib_gid_type gid_type;
bool send_only;
@ -4345,7 +4345,7 @@ static int cma_iboe_join_multicast(struct rdma_id_private *id_priv,
}
mc->multicast.ib->rec.rate = iboe_get_rate(ndev);
mc->multicast.ib->rec.hop_limit = 1;
mc->multicast.ib->rec.mtu = iboe_get_mtu(ndev->if_mtu);
mc->multicast.ib->rec.mtu = iboe_get_mtu(if_getmtu(ndev));
if (addr->sa_family == AF_INET || addr->sa_family == AF_INET6) {
if (gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP) {
@ -4456,7 +4456,7 @@ void rdma_leave_multicast(struct rdma_cm_id *id, struct sockaddr *addr)
if (mc->igmp_joined) {
struct rdma_dev_addr *dev_addr =
&id->route.addr.dev_addr;
struct ifnet *ndev = NULL;
if_t ndev = NULL;
if (dev_addr->bound_dev_if)
ndev = dev_get_by_index(dev_addr->net,

View File

@ -732,12 +732,12 @@ void ib_enum_roce_netdev(struct ib_device *ib_dev,
for (port = rdma_start_port(ib_dev); port <= rdma_end_port(ib_dev);
port++)
if (rdma_protocol_roce(ib_dev, port)) {
struct ifnet *idev = NULL;
if_t idev = NULL;
if (ib_dev->get_netdev)
idev = ib_dev->get_netdev(ib_dev, port);
if (idev && (idev->if_flags & IFF_DYING)) {
if (idev && (if_getflags(idev) & IFF_DYING)) {
dev_put(idev);
idev = NULL;
}
@ -779,7 +779,7 @@ void ib_enum_all_roce_netdevs(roce_netdev_filter filter,
*
* @ndev: Pointer to netdevice
*/
void ib_cache_gid_del_all_by_netdev(struct ifnet *ndev)
void ib_cache_gid_del_all_by_netdev(if_t ndev)
{
struct ib_device *ib_dev;
u8 port;
@ -875,7 +875,7 @@ EXPORT_SYMBOL(ib_modify_port);
* parameter may be NULL.
*/
int ib_find_gid(struct ib_device *device, union ib_gid *gid,
enum ib_gid_type gid_type, struct ifnet *ndev,
enum ib_gid_type gid_type, if_t ndev,
u8 *port_num, u16 *index)
{
union ib_gid tmp_gid;
@ -959,13 +959,13 @@ EXPORT_SYMBOL(ib_find_pkey);
* @addr: Contains the IP address that the request specified as its
* destination.
*/
struct ifnet *ib_get_net_dev_by_params(struct ib_device *dev,
if_t ib_get_net_dev_by_params(struct ib_device *dev,
u8 port,
u16 pkey,
const union ib_gid *gid,
const struct sockaddr *addr)
{
struct ifnet *net_dev = NULL;
if_t net_dev = NULL;
struct ib_client_data *context;
if (!rdma_protocol_ib(dev, port))

View File

@ -723,7 +723,7 @@ EXPORT_SYMBOL(ib_sa_get_mcmember_rec);
int ib_init_ah_from_mcmember(struct ib_device *device, u8 port_num,
struct ib_sa_mcmember_rec *rec,
struct ifnet *ndev,
if_t ndev,
enum ib_gid_type gid_type,
struct ib_ah_attr *ah_attr)
{

View File

@ -56,7 +56,7 @@ enum gid_op_type {
struct roce_netdev_event_work {
struct work_struct work;
struct ifnet *ndev;
if_t ndev;
};
struct roce_rescan_work {
@ -91,7 +91,7 @@ unsigned long roce_gid_type_mask_support(struct ib_device *ib_dev, u8 port)
EXPORT_SYMBOL(roce_gid_type_mask_support);
static void update_gid(enum gid_op_type gid_op, struct ib_device *ib_dev,
u8 port, union ib_gid *gid, struct ifnet *ndev)
u8 port, union ib_gid *gid, if_t ndev)
{
int i;
unsigned long gid_type_mask = roce_gid_type_mask_support(ib_dev, port);
@ -119,9 +119,9 @@ static void update_gid(enum gid_op_type gid_op, struct ib_device *ib_dev,
static int
roce_gid_match_netdev(struct ib_device *ib_dev, u8 port,
struct ifnet *idev, void *cookie)
if_t idev, void *cookie)
{
struct ifnet *ndev = (struct ifnet *)cookie;
if_t ndev = (if_t )cookie;
if (idev == NULL)
return (0);
return (ndev == idev);
@ -129,7 +129,7 @@ roce_gid_match_netdev(struct ib_device *ib_dev, u8 port,
static int
roce_gid_match_all(struct ib_device *ib_dev, u8 port,
struct ifnet *idev, void *cookie)
if_t idev, void *cookie)
{
if (idev == NULL)
return (0);
@ -138,7 +138,7 @@ roce_gid_match_all(struct ib_device *ib_dev, u8 port,
static int
roce_gid_enum_netdev_default(struct ib_device *ib_dev,
u8 port, struct ifnet *idev)
u8 port, if_t idev)
{
unsigned long gid_type_mask;
@ -150,32 +150,81 @@ roce_gid_enum_netdev_default(struct ib_device *ib_dev,
return (hweight_long(gid_type_mask));
}
struct ipx_entry {
STAILQ_ENTRY(ipx_entry) entry;
union ipx_addr {
struct sockaddr sa[0];
struct sockaddr_in v4;
struct sockaddr_in6 v6;
} ipx_addr;
if_t ndev;
};
STAILQ_HEAD(ipx_queue, ipx_entry);
#ifdef INET
static u_int
roce_gid_update_addr_ifa4_cb(void *arg, struct ifaddr *ifa, u_int count)
{
struct ipx_queue *ipx_head = arg;
struct ipx_entry *entry;
entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
if (entry == NULL) {
pr_warn("roce_gid_update_addr_callback: "
"couldn't allocate entry for IPv4 update\n");
return (0);
}
entry->ipx_addr.v4 = *((struct sockaddr_in *)ifa->ifa_addr);
entry->ndev = ifa->ifa_ifp;
STAILQ_INSERT_TAIL(ipx_head, entry, entry);
return (1);
}
#endif
#ifdef INET6
static u_int
roce_gid_update_addr_ifa6_cb(void *arg, struct ifaddr *ifa, u_int count)
{
struct ipx_queue *ipx_head = arg;
struct ipx_entry *entry;
entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
if (entry == NULL) {
pr_warn("roce_gid_update_addr_callback: "
"couldn't allocate entry for IPv6 update\n");
return (0);
}
entry->ipx_addr.v6 = *((struct sockaddr_in6 *)ifa->ifa_addr);
entry->ndev = ifa->ifa_ifp;
/* trash IPv6 scope ID */
sa6_recoverscope(&entry->ipx_addr.v6);
entry->ipx_addr.v6.sin6_scope_id = 0;
STAILQ_INSERT_TAIL(ipx_head, entry, entry);
return (1);
}
#endif
static void
roce_gid_update_addr_callback(struct ib_device *device, u8 port,
struct ifnet *ndev, void *cookie)
if_t ndev, void *cookie)
{
struct ipx_entry {
STAILQ_ENTRY(ipx_entry) entry;
union ipx_addr {
struct sockaddr sa[0];
struct sockaddr_in v4;
struct sockaddr_in6 v6;
} ipx_addr;
struct ifnet *ndev;
};
struct epoch_tracker et;
struct if_iter iter;
struct ipx_entry *entry;
struct ifnet *idev;
#if defined(INET) || defined(INET6)
struct ifaddr *ifa;
#endif
VNET_ITERATOR_DECL(vnet_iter);
struct ib_gid_attr gid_attr;
union ib_gid gid;
if_t ifp;
int default_gids;
u16 index_num;
int i;
STAILQ_HEAD(, ipx_entry) ipx_head;
struct ipx_queue ipx_head;
STAILQ_INIT(&ipx_head);
@ -185,59 +234,24 @@ roce_gid_update_addr_callback(struct ib_device *device, u8 port,
VNET_LIST_RLOCK();
VNET_FOREACH(vnet_iter) {
CURVNET_SET(vnet_iter);
IFNET_RLOCK();
CK_STAILQ_FOREACH(idev, &V_ifnet, if_link) {
struct epoch_tracker et;
if (idev != ndev) {
if (idev->if_type != IFT_L2VLAN)
NET_EPOCH_ENTER(et);
for (ifp = if_iter_start(&iter); ifp != NULL; ifp = if_iter_next(&iter)) {
if (ifp != ndev) {
if (if_gettype(ifp) != IFT_L2VLAN)
continue;
if (ndev != rdma_vlan_dev_real_dev(idev))
if (ifp != rdma_vlan_dev_real_dev(ifp))
continue;
}
/* clone address information for IPv4 and IPv6 */
NET_EPOCH_ENTER(et);
#if defined(INET)
CK_STAILQ_FOREACH(ifa, &idev->if_addrhead, ifa_link) {
if (ifa->ifa_addr == NULL ||
ifa->ifa_addr->sa_family != AF_INET)
continue;
entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
if (entry == NULL) {
pr_warn("roce_gid_update_addr_callback: "
"couldn't allocate entry for IPv4 update\n");
continue;
}
entry->ipx_addr.v4 = *((struct sockaddr_in *)ifa->ifa_addr);
entry->ndev = idev;
STAILQ_INSERT_TAIL(&ipx_head, entry, entry);
}
if_foreach_addr_type(ifp, AF_INET, roce_gid_update_addr_ifa4_cb, &ipx_head);
#endif
#if defined(INET6)
CK_STAILQ_FOREACH(ifa, &idev->if_addrhead, ifa_link) {
if (ifa->ifa_addr == NULL ||
ifa->ifa_addr->sa_family != AF_INET6)
continue;
entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
if (entry == NULL) {
pr_warn("roce_gid_update_addr_callback: "
"couldn't allocate entry for IPv6 update\n");
continue;
}
entry->ipx_addr.v6 = *((struct sockaddr_in6 *)ifa->ifa_addr);
entry->ndev = idev;
/* trash IPv6 scope ID */
sa6_recoverscope(&entry->ipx_addr.v6);
entry->ipx_addr.v6.sin6_scope_id = 0;
STAILQ_INSERT_TAIL(&ipx_head, entry, entry);
}
if_foreach_addr_type(ifp, AF_INET6, roce_gid_update_addr_ifa6_cb, &ipx_head);
#endif
NET_EPOCH_EXIT(et);
}
IFNET_RUNLOCK();
NET_EPOCH_EXIT(et);
CURVNET_RESTORE();
}
VNET_LIST_RUNLOCK();
@ -315,12 +329,12 @@ roce_gid_queue_scan_event_handler(struct work_struct *_work)
}
static void
roce_gid_queue_scan_event(struct ifnet *ndev)
roce_gid_queue_scan_event(if_t ndev)
{
struct roce_netdev_event_work *work;
retry:
switch (ndev->if_type) {
switch (if_gettype(ndev)) {
case IFT_ETHER:
break;
case IFT_L2VLAN:
@ -358,7 +372,7 @@ roce_gid_delete_all_event_handler(struct work_struct *_work)
}
static void
roce_gid_delete_all_event(struct ifnet *ndev)
roce_gid_delete_all_event(if_t ndev)
{
struct roce_netdev_event_work *work;
@ -380,7 +394,7 @@ roce_gid_delete_all_event(struct ifnet *ndev)
static int
inetaddr_event(struct notifier_block *this, unsigned long event, void *ptr)
{
struct ifnet *ndev = netdev_notifier_info_to_ifp(ptr);
if_t ndev = netdev_notifier_info_to_ifp(ptr);
switch (event) {
case NETDEV_UNREGISTER:
@ -404,7 +418,7 @@ static struct notifier_block nb_inetaddr = {
static eventhandler_tag eh_ifnet_event;
static void
roce_ifnet_event(void *arg, struct ifnet *ifp, int event)
roce_ifnet_event(void *arg, if_t ifp, int event)
{
if (event != IFNET_EVENT_PCP || is_vlan_dev(ifp))
return;

View File

@ -652,7 +652,7 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num,
int ret;
u16 gid_index;
int use_roce;
struct ifnet *ndev = NULL;
if_t ndev = NULL;
memset(ah_attr, 0, sizeof *ah_attr);
ah_attr->dlid = be16_to_cpu(rec->dlid);
@ -665,8 +665,8 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num,
use_roce = rdma_cap_eth_ah(device, port_num);
if (use_roce) {
struct ifnet *idev;
struct ifnet *resolved_dev;
if_t idev;
if_t resolved_dev;
struct rdma_dev_addr dev_addr = {.bound_dev_if = rec->ifindex,
.net = rec->net ? rec->net :
&init_net};

View File

@ -321,7 +321,7 @@ struct ipoib_dev_priv {
spinlock_t lock;
spinlock_t drain_lock;
struct ifnet *dev;
if_t dev;
u8 broadcastaddr[INFINIBAND_ALEN];
@ -384,7 +384,7 @@ struct ipoib_dev_priv {
struct ib_event_handler event_handler;
struct ifnet *parent;
if_t parent;
struct list_head child_intfs;
struct list_head list;
@ -531,7 +531,7 @@ void ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf *mb, unsigned int len
struct mbuf *ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, int align, int size, int max_frags);
void ipoib_set_ethtool_ops(struct ifnet *dev);
void ipoib_set_ethtool_ops(if_t dev);
int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca);
#ifdef CONFIG_INFINIBAND_IPOIB_CM
@ -546,7 +546,7 @@ extern int ipoib_max_conn_qp;
static inline int ipoib_cm_admin_enabled(struct ipoib_dev_priv *priv)
{
return IPOIB_CM_SUPPORTED(IF_LLADDR(priv->dev));
return IPOIB_CM_SUPPORTED(if_getlladdr(priv->dev));
}
static inline int ipoib_cm_enabled(struct ipoib_dev_priv *priv, uint8_t *hwaddr)
@ -752,6 +752,6 @@ extern int ipoib_debug_level;
#define IPOIB_QPN(ha) (be32_to_cpup((__be32 *) ha) & 0xffffff)
void ipoib_start_locked(struct ifnet *, struct ipoib_dev_priv *);
void ipoib_start_locked(if_t, struct ipoib_dev_priv *);
#endif /* _IPOIB_H */

View File

@ -480,7 +480,7 @@ void ipoib_cm_handle_rx_wc(struct ipoib_dev_priv *priv, struct ib_wc *wc)
struct ipoib_cm_rx_buf saverx;
struct ipoib_cm_rx_buf *rx_ring;
unsigned int wr_id = wc->wr_id & ~(IPOIB_OP_CM | IPOIB_OP_RECV);
struct ifnet *dev = priv->dev;
if_t dev = priv->dev;
struct mbuf *mb, *newmb;
struct ipoib_cm_rx *p;
int has_srq;
@ -572,7 +572,7 @@ void ipoib_cm_handle_rx_wc(struct ipoib_dev_priv *priv, struct ib_wc *wc)
memset(ibh->hwaddr, 0, 4);
memcpy(ibh->hwaddr + 4, priv->local_gid.raw, sizeof(union ib_gid));
dev->if_input(dev, mb);
if_input(dev, mb);
} else {
if_inc_counter(dev, IFCOUNTER_IERRORS, 1);
}
@ -620,7 +620,7 @@ static inline int post_send(struct ipoib_dev_priv *priv,
void ipoib_cm_send(struct ipoib_dev_priv *priv, struct mbuf *mb, struct ipoib_cm_tx *tx)
{
struct ipoib_cm_tx_buf *tx_req;
struct ifnet *dev = priv->dev;
if_t dev = priv->dev;
if (unlikely(priv->tx_outstanding > MAX_SEND_CQE)) {
while (ipoib_poll_tx(priv, false))
@ -670,7 +670,7 @@ void ipoib_cm_send(struct ipoib_dev_priv *priv, struct mbuf *mb, struct ipoib_cm
tx->qp->qp_num);
if (ib_req_notify_cq(priv->send_cq, IB_CQ_NEXT_COMP))
ipoib_warn(priv, "request notify on send CQ failed\n");
dev->if_drv_flags |= IFF_DRV_OACTIVE;
if_setdrvflagbits(dev, IFF_DRV_OACTIVE, 0);
}
}
@ -680,7 +680,7 @@ void ipoib_cm_handle_tx_wc(struct ipoib_dev_priv *priv, struct ib_wc *wc)
{
struct ipoib_cm_tx *tx = wc->qp->qp_context;
unsigned int wr_id = wc->wr_id & ~IPOIB_OP_CM;
struct ifnet *dev = priv->dev;
if_t dev = priv->dev;
struct ipoib_cm_tx_buf *tx_req;
ipoib_dbg_data(priv, "cm send completion: id %d, status: %d\n",
@ -703,9 +703,9 @@ void ipoib_cm_handle_tx_wc(struct ipoib_dev_priv *priv, struct ib_wc *wc)
++tx->tx_tail;
if (unlikely(--priv->tx_outstanding == ipoib_sendq_size >> 1) &&
(dev->if_drv_flags & IFF_DRV_OACTIVE) != 0 &&
(if_getdrvflags(dev) & IFF_DRV_OACTIVE) != 0 &&
test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags))
dev->if_drv_flags &= ~IFF_DRV_OACTIVE;
if_setdrvflagbits(dev, 0, IFF_DRV_OACTIVE);
if (wc->status != IB_WC_SUCCESS &&
wc->status != IB_WC_WR_FLUSH_ERR) {
@ -737,7 +737,7 @@ int ipoib_cm_dev_open(struct ipoib_dev_priv *priv)
{
int ret;
if (!IPOIB_CM_SUPPORTED(IF_LLADDR(priv->dev)))
if (!IPOIB_CM_SUPPORTED(if_getlladdr(priv->dev)))
return 0;
priv->cm.id = ib_create_cm_id(priv->ca, ipoib_cm_rx_handler, priv);
@ -791,7 +791,7 @@ void ipoib_cm_dev_stop(struct ipoib_dev_priv *priv)
unsigned long begin;
int ret;
if (!IPOIB_CM_SUPPORTED(IF_LLADDR(priv->dev)) || !priv->cm.id)
if (!IPOIB_CM_SUPPORTED(if_getlladdr(priv->dev)) || !priv->cm.id)
return;
ib_destroy_cm_id(priv->cm.id);
@ -905,12 +905,12 @@ static int ipoib_cm_rep_handler(struct ib_cm_id *cm_id, struct ib_cm_event *even
NET_EPOCH_ENTER(et);
for (;;) {
struct ifnet *dev = p->priv->dev;
if_t dev = p->priv->dev;
_IF_DEQUEUE(&mbqueue, mb);
if (mb == NULL)
break;
mb->m_pkthdr.rcvif = dev;
if (dev->if_transmit(dev, mb))
if (if_transmit(dev, mb))
ipoib_warn(priv, "dev_queue_xmit failed "
"to requeue packet\n");
}
@ -1064,7 +1064,7 @@ static int ipoib_cm_tx_init(struct ipoib_cm_tx *p, u32 qpn,
static void ipoib_cm_tx_destroy(struct ipoib_cm_tx *p)
{
struct ipoib_dev_priv *priv = p->priv;
struct ifnet *dev = priv->dev;
if_t dev = priv->dev;
struct ipoib_cm_tx_buf *tx_req;
unsigned long begin;
@ -1099,9 +1099,9 @@ static void ipoib_cm_tx_destroy(struct ipoib_cm_tx *p)
m_freem(tx_req->mb);
++p->tx_tail;
if (unlikely(--priv->tx_outstanding == ipoib_sendq_size >> 1) &&
(dev->if_drv_flags & IFF_DRV_OACTIVE) != 0 &&
(if_getdrvflags(dev) & IFF_DRV_OACTIVE) != 0 &&
test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags))
dev->if_drv_flags &= ~IFF_DRV_OACTIVE;
if_setdrvflagbits(dev, 0, IFF_DRV_OACTIVE);
}
if (p->qp)
@ -1272,7 +1272,7 @@ static void ipoib_cm_mb_reap(struct work_struct *work)
spin_lock_irqsave(&priv->lock, flags);
CURVNET_SET_QUIET(priv->dev->if_vnet);
CURVNET_SET_QUIET(if_getvnet(priv->dev));
for (;;) {
IF_DEQUEUE(&priv->cm.mb_queue, mb);
@ -1383,7 +1383,7 @@ static void ipoib_cm_create_srq(struct ipoib_dev_priv *priv, int max_sge)
int ipoib_cm_dev_init(struct ipoib_dev_priv *priv)
{
struct ifnet *dev = priv->dev;
if_t dev = priv->dev;
int i;
int max_srq_sge;
@ -1402,7 +1402,7 @@ int ipoib_cm_dev_init(struct ipoib_dev_priv *priv)
bzero(&priv->cm.mb_queue, sizeof(priv->cm.mb_queue));
mtx_init(&priv->cm.mb_queue.ifq_mtx,
dev->if_xname, "if send queue", MTX_DEF);
if_name(dev), "if send queue", MTX_DEF);
max_srq_sge = priv->ca->attrs.max_srq_sge;
@ -1440,7 +1440,7 @@ int ipoib_cm_dev_init(struct ipoib_dev_priv *priv)
}
}
IF_LLADDR(priv->dev)[0] = IPOIB_FLAGS_RC;
if_getlladdr(priv->dev)[0] = IPOIB_FLAGS_RC;
return 0;
}

View File

@ -40,20 +40,20 @@ __FBSDID("$FreeBSD$");
#include "ipoib.h"
static void ipoib_get_drvinfo(struct ifnet *netdev,
static void ipoib_get_drvinfo(if_t netdev,
struct ethtool_drvinfo *drvinfo)
{
strncpy(drvinfo->driver, "ipoib", sizeof(drvinfo->driver) - 1);
}
static u32 ipoib_get_rx_csum(struct ifnet *dev)
static u32 ipoib_get_rx_csum(if_t dev)
{
struct ipoib_dev_priv *priv = dev->if_softc;
return test_bit(IPOIB_FLAG_CSUM, &priv->flags) &&
!test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags);
}
static int ipoib_get_coalesce(struct ifnet *dev,
static int ipoib_get_coalesce(if_t dev,
struct ethtool_coalesce *coal)
{
struct ipoib_dev_priv *priv = dev->if_softc;
@ -66,7 +66,7 @@ static int ipoib_get_coalesce(struct ifnet *dev,
return 0;
}
static int ipoib_set_coalesce(struct ifnet *dev,
static int ipoib_set_coalesce(if_t dev,
struct ethtool_coalesce *coal)
{
struct ipoib_dev_priv *priv = dev->if_softc;
@ -109,7 +109,7 @@ static const char ipoib_stats_keys[][ETH_GSTRING_LEN] = {
"LRO avg aggr", "LRO no desc"
};
static void ipoib_get_strings(struct ifnet *netdev, u32 stringset, u8 *data)
static void ipoib_get_strings(if_t netdev, u32 stringset, u8 *data)
{
switch (stringset) {
case ETH_SS_STATS:
@ -118,7 +118,7 @@ static void ipoib_get_strings(struct ifnet *netdev, u32 stringset, u8 *data)
}
}
static int ipoib_get_sset_count(struct ifnet *dev, int sset)
static int ipoib_get_sset_count(if_t dev, int sset)
{
switch (sset) {
case ETH_SS_STATS:
@ -128,7 +128,7 @@ static int ipoib_get_sset_count(struct ifnet *dev, int sset)
}
}
static void ipoib_get_ethtool_stats(struct ifnet *dev,
static void ipoib_get_ethtool_stats(if_t dev,
struct ethtool_stats *stats, uint64_t *data)
{
struct ipoib_dev_priv *priv = dev->if_softc;
@ -157,7 +157,7 @@ static const struct ethtool_ops ipoib_ethtool_ops = {
.get_ethtool_stats = ipoib_get_ethtool_stats,
};
void ipoib_set_ethtool_ops(struct ifnet *dev)
void ipoib_set_ethtool_ops(if_t dev)
{
SET_ETHTOOL_OPS(dev, &ipoib_ethtool_ops);
}

View File

@ -263,7 +263,7 @@ static const struct file_operations ipoib_path_fops = {
.release = seq_release
};
void ipoib_create_debug_files(struct ifnet *dev)
void ipoib_create_debug_files(if_t dev)
{
struct ipoib_dev_priv *priv = dev->if_softc;
char name[IFNAMSIZ + sizeof "_path"];
@ -281,7 +281,7 @@ void ipoib_create_debug_files(struct ifnet *dev)
ipoib_warn(priv, "failed to create path debug file\n");
}
void ipoib_delete_debug_files(struct ifnet *dev)
void ipoib_delete_debug_files(if_t dev)
{
struct ipoib_dev_priv *priv = dev->if_softc;

View File

@ -203,7 +203,7 @@ ipoib_ib_handle_rx_wc(struct ipoib_dev_priv *priv, struct ib_wc *wc)
{
struct ipoib_rx_buf saverx;
unsigned int wr_id = wc->wr_id & ~IPOIB_OP_RECV;
struct ifnet *dev = priv->dev;
if_t dev = priv->dev;
struct ipoib_header *eh;
struct mbuf *mb;
@ -267,7 +267,7 @@ ipoib_ib_handle_rx_wc(struct ipoib_dev_priv *priv, struct ib_wc *wc)
if (test_bit(IPOIB_FLAG_CSUM, &priv->flags) && likely(wc->wc_flags & IB_WC_IP_CSUM_OK))
mb->m_pkthdr.csum_flags = CSUM_IP_CHECKED | CSUM_IP_VALID;
dev->if_input(dev, mb);
if_input(dev, mb);
repost:
if (unlikely(ipoib_ib_post_receive(priv, wr_id)))
@ -334,7 +334,7 @@ void ipoib_dma_unmap_tx(struct ib_device *ca, struct ipoib_tx_buf *tx_req)
static void ipoib_ib_handle_tx_wc(struct ipoib_dev_priv *priv, struct ib_wc *wc)
{
struct ifnet *dev = priv->dev;
if_t dev = priv->dev;
unsigned int wr_id = wc->wr_id;
struct ipoib_tx_buf *tx_req;
@ -357,9 +357,9 @@ static void ipoib_ib_handle_tx_wc(struct ipoib_dev_priv *priv, struct ib_wc *wc)
++priv->tx_tail;
if (unlikely(--priv->tx_outstanding == ipoib_sendq_size >> 1) &&
(dev->if_drv_flags & IFF_DRV_OACTIVE) &&
(if_getdrvflags(dev) & IFF_DRV_OACTIVE) &&
test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags))
dev->if_drv_flags &= ~IFF_DRV_OACTIVE;
if_setdrvflagbits(dev, 0, IFF_DRV_OACTIVE);
if (wc->status != IB_WC_SUCCESS &&
wc->status != IB_WC_WR_FLUSH_ERR)
@ -428,13 +428,13 @@ void ipoib_ib_completion(struct ib_cq *cq, void *dev_ptr)
static void drain_tx_cq(struct ipoib_dev_priv *priv)
{
struct ifnet *dev = priv->dev;
if_t dev = priv->dev;
spin_lock(&priv->lock);
while (ipoib_poll_tx(priv, true))
; /* nothing */
if (dev->if_drv_flags & IFF_DRV_OACTIVE)
if (if_getdrvflags(dev) & IFF_DRV_OACTIVE)
mod_timer(&priv->poll_timer, jiffies + 1);
spin_unlock(&priv->lock);
@ -482,7 +482,7 @@ void
ipoib_send(struct ipoib_dev_priv *priv, struct mbuf *mb,
struct ipoib_ah *address, u32 qpn)
{
struct ifnet *dev = priv->dev;
if_t dev = priv->dev;
struct ipoib_tx_buf *tx_req;
int hlen;
void *phead;
@ -542,7 +542,7 @@ ipoib_send(struct ipoib_dev_priv *priv, struct mbuf *mb,
ipoib_dbg(priv, "TX ring full, stopping kernel net queue\n");
if (ib_req_notify_cq(priv->send_cq, IB_CQ_NEXT_COMP))
ipoib_warn(priv, "request notify on send CQ failed\n");
dev->if_drv_flags |= IFF_DRV_OACTIVE;
if_setdrvflagbits(dev, IFF_DRV_OACTIVE, 0);
}
if (unlikely(post_send(priv,
@ -553,8 +553,8 @@ ipoib_send(struct ipoib_dev_priv *priv, struct mbuf *mb,
--priv->tx_outstanding;
ipoib_dma_unmap_tx(priv->ca, tx_req);
m_freem(mb);
if (dev->if_drv_flags & IFF_DRV_OACTIVE)
dev->if_drv_flags &= ~IFF_DRV_OACTIVE;
if (if_getdrvflags(dev) & IFF_DRV_OACTIVE)
if_setdrvflagbits(dev, 0, IFF_DRV_OACTIVE);
} else {
address->last_send = priv->tx_head;
++priv->tx_head;
@ -856,7 +856,7 @@ int ipoib_ib_dev_stop(struct ipoib_dev_priv *priv, int flush)
int ipoib_ib_dev_init(struct ipoib_dev_priv *priv, struct ib_device *ca, int port)
{
struct ifnet *dev = priv->dev;
if_t dev = priv->dev;
priv->ca = ca;
priv->port = port;
@ -870,7 +870,7 @@ int ipoib_ib_dev_init(struct ipoib_dev_priv *priv, struct ib_device *ca, int por
setup_timer(&priv->poll_timer, ipoib_ib_tx_timer_func,
(unsigned long) priv);
if (dev->if_flags & IFF_UP) {
if (if_getflags(dev) & IFF_UP) {
if (ipoib_ib_dev_open(priv)) {
ipoib_transport_dev_cleanup(priv);
return -ENODEV;

View File

@ -89,12 +89,12 @@ struct ib_sa_client ipoib_sa_client;
static void ipoib_add_one(struct ib_device *device);
static void ipoib_remove_one(struct ib_device *device, void *client_data);
static struct ifnet *ipoib_get_net_dev_by_params(
static if_t 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);
static void ipoib_start(struct ifnet *dev);
static int ipoib_ioctl(struct ifnet *ifp, u_long command, caddr_t data);
static void ipoib_start(if_t dev);
static int ipoib_ioctl(if_t ifp, u_long command, caddr_t data);
static struct unrhdr *ipoib_unrhdr;
@ -131,7 +131,7 @@ static struct ib_client ipoib_client = {
int
ipoib_open(struct ipoib_dev_priv *priv)
{
struct ifnet *dev = priv->dev;
if_t dev = priv->dev;
ipoib_dbg(priv, "bringing up interface\n");
@ -152,12 +152,11 @@ ipoib_open(struct ipoib_dev_priv *priv)
/* Bring up any child interfaces too */
mutex_lock(&priv->vlan_mutex);
list_for_each_entry(cpriv, &priv->child_intfs, list)
if ((cpriv->dev->if_drv_flags & IFF_DRV_RUNNING) == 0)
if ((if_getdrvflags(cpriv->dev) & IFF_DRV_RUNNING) == 0)
ipoib_open(cpriv);
mutex_unlock(&priv->vlan_mutex);
}
dev->if_drv_flags |= IFF_DRV_RUNNING;
dev->if_drv_flags &= ~IFF_DRV_OACTIVE;
if_setdrvflagbits(dev, IFF_DRV_RUNNING, IFF_DRV_OACTIVE);
return 0;
@ -173,12 +172,12 @@ ipoib_open(struct ipoib_dev_priv *priv)
static void
ipoib_init(void *arg)
{
struct ifnet *dev;
if_t dev;
struct ipoib_dev_priv *priv;
priv = arg;
dev = priv->dev;
if ((dev->if_drv_flags & IFF_DRV_RUNNING) == 0)
if ((if_getdrvflags(dev) & IFF_DRV_RUNNING) == 0)
ipoib_open(priv);
queue_work(ipoib_workqueue, &priv->flush_light);
}
@ -187,13 +186,13 @@ ipoib_init(void *arg)
static int
ipoib_stop(struct ipoib_dev_priv *priv)
{
struct ifnet *dev = priv->dev;
if_t dev = priv->dev;
ipoib_dbg(priv, "stopping interface\n");
clear_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags);
dev->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
if_setdrvflagbits(dev, 0, IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
ipoib_ib_dev_down(priv, 0);
ipoib_ib_dev_stop(priv, 0);
@ -204,7 +203,7 @@ ipoib_stop(struct ipoib_dev_priv *priv)
/* Bring down any child interfaces too */
mutex_lock(&priv->vlan_mutex);
list_for_each_entry(cpriv, &priv->child_intfs, list)
if ((cpriv->dev->if_drv_flags & IFF_DRV_RUNNING) != 0)
if ((if_getdrvflags(cpriv->dev) & IFF_DRV_RUNNING) != 0)
ipoib_stop(cpriv);
mutex_unlock(&priv->vlan_mutex);
}
@ -216,21 +215,21 @@ static int
ipoib_propagate_ifnet_mtu(struct ipoib_dev_priv *priv, int new_mtu,
bool propagate)
{
struct ifnet *ifp;
if_t ifp;
struct ifreq ifr;
int error;
ifp = priv->dev;
if (ifp->if_mtu == new_mtu)
if (if_getmtu(ifp) == new_mtu)
return (0);
if (propagate) {
strlcpy(ifr.ifr_name, if_name(ifp), IFNAMSIZ);
ifr.ifr_mtu = new_mtu;
CURVNET_SET(ifp->if_vnet);
CURVNET_SET(if_getvnet(ifp));
error = ifhwioctl(SIOCSIFMTU, ifp, (caddr_t)&ifr, curthread);
CURVNET_RESTORE();
} else {
ifp->if_mtu = new_mtu;
if_setmtu(ifp, new_mtu);
error = 0;
}
return (error);
@ -270,9 +269,9 @@ ipoib_change_mtu(struct ipoib_dev_priv *priv, int new_mtu, bool propagate)
}
static int
ipoib_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
ipoib_ioctl(if_t ifp, u_long command, caddr_t data)
{
struct ipoib_dev_priv *priv = ifp->if_softc;
struct ipoib_dev_priv *priv = if_getsoftc(ifp);
struct ifaddr *ifa = (struct ifaddr *) data;
struct ifreq *ifr = (struct ifreq *) data;
int error = 0;
@ -289,36 +288,36 @@ ipoib_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
switch (command) {
case SIOCSIFFLAGS:
if (ifp->if_flags & IFF_UP) {
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
if (if_getflags(ifp) & IFF_UP) {
if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0)
error = -ipoib_open(priv);
} else
if (ifp->if_drv_flags & IFF_DRV_RUNNING)
if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
ipoib_stop(priv);
break;
case SIOCADDMULTI:
case SIOCDELMULTI:
if (ifp->if_drv_flags & IFF_DRV_RUNNING)
if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
queue_work(ipoib_workqueue, &priv->restart_task);
break;
case SIOCSIFADDR:
ifp->if_flags |= IFF_UP;
if_setflagbits(ifp, IFF_UP, 0);
switch (ifa->ifa_addr->sa_family) {
#ifdef INET
case AF_INET:
ifp->if_init(ifp->if_softc); /* before arpwhohas */
if_init(ifp, if_getsoftc(ifp)); /* before arpwhohas */
arp_ifinit(ifp, ifa);
break;
#endif
default:
ifp->if_init(ifp->if_softc);
if_init(ifp, if_getsoftc(ifp));
break;
}
break;
case SIOCGIFADDR:
bcopy(IF_LLADDR(ifp), &ifr->ifr_addr.sa_data[0],
bcopy(if_getlladdr(ifp), &ifr->ifr_addr.sa_data[0],
INFINIBAND_ALEN);
break;
@ -512,7 +511,7 @@ path_rec_completion(int status, struct ib_sa_path_rec *pathrec, void *path_ptr)
{
struct ipoib_path *path = path_ptr;
struct ipoib_dev_priv *priv = path->priv;
struct ifnet *dev = priv->dev;
if_t dev = priv->dev;
struct ipoib_ah *ah = NULL;
struct ipoib_ah *old_ah = NULL;
struct epoch_tracker et;
@ -576,7 +575,7 @@ path_rec_completion(int status, struct ib_sa_path_rec *pathrec, void *path_ptr)
if (mb == NULL)
break;
mb->m_pkthdr.rcvif = dev;
if (dev->if_transmit(dev, mb))
if (if_transmit(dev, mb))
ipoib_warn(priv, "dev_queue_xmit failed "
"to requeue packet\n");
}
@ -614,7 +613,7 @@ path_rec_create(struct ipoib_dev_priv *priv, uint8_t *hwaddr)
static int
path_rec_start(struct ipoib_dev_priv *priv, struct ipoib_path *path)
{
struct ifnet *dev = priv->dev;
if_t dev = priv->dev;
ib_sa_comp_mask comp_mask = IB_SA_PATH_REC_MTU_SELECTOR | IB_SA_PATH_REC_MTU;
struct ib_sa_path_rec p_rec;
@ -622,7 +621,7 @@ path_rec_start(struct ipoib_dev_priv *priv, struct ipoib_path *path)
p_rec = path->pathrec;
p_rec.mtu_selector = IB_SA_GT;
switch (roundup_pow_of_two(dev->if_mtu + IPOIB_ENCAP_LEN)) {
switch (roundup_pow_of_two(if_getmtu(dev) + IPOIB_ENCAP_LEN)) {
case 512:
p_rec.mtu = IB_MTU_256;
break;
@ -736,15 +735,15 @@ ipoib_send_one(struct ipoib_dev_priv *priv, struct mbuf *mb)
}
void
ipoib_start_locked(struct ifnet *dev, struct ipoib_dev_priv *priv)
ipoib_start_locked(if_t dev, struct ipoib_dev_priv *priv)
{
struct mbuf *mb;
assert_spin_locked(&priv->lock);
while (!IFQ_DRV_IS_EMPTY(&dev->if_snd) &&
(dev->if_drv_flags & IFF_DRV_OACTIVE) == 0) {
IFQ_DRV_DEQUEUE(&dev->if_snd, mb);
while (!if_sendq_empty(dev) &&
(if_getdrvflags(dev) & IFF_DRV_OACTIVE) == 0) {
mb = if_dequeue(dev);
if (mb == NULL)
break;
infiniband_bpf_mtap(dev, mb);
@ -753,10 +752,10 @@ ipoib_start_locked(struct ifnet *dev, struct ipoib_dev_priv *priv)
}
static void
_ipoib_start(struct ifnet *dev, struct ipoib_dev_priv *priv)
_ipoib_start(if_t dev, struct ipoib_dev_priv *priv)
{
if ((dev->if_drv_flags & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) !=
if ((if_getdrvflags(dev) & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) !=
IFF_DRV_RUNNING)
return;
@ -766,13 +765,13 @@ _ipoib_start(struct ifnet *dev, struct ipoib_dev_priv *priv)
}
static void
ipoib_start(struct ifnet *dev)
ipoib_start(if_t dev)
{
_ipoib_start(dev, dev->if_softc);
_ipoib_start(dev, if_getsoftc(dev));
}
static void
ipoib_vlan_start(struct ifnet *dev)
ipoib_vlan_start(if_t dev)
{
struct ipoib_dev_priv *priv;
struct mbuf *mb;
@ -780,8 +779,8 @@ ipoib_vlan_start(struct ifnet *dev)
priv = VLAN_COOKIE(dev);
if (priv != NULL)
return _ipoib_start(dev, priv);
while (!IFQ_DRV_IS_EMPTY(&dev->if_snd)) {
IFQ_DRV_DEQUEUE(&dev->if_snd, mb);
while (!if_sendq_empty(dev)) {
mb = if_dequeue(dev);
if (mb == NULL)
break;
m_freem(mb);
@ -830,7 +829,7 @@ ipoib_dev_init(struct ipoib_dev_priv *priv, struct ib_device *ca, int port)
static void
ipoib_ifdetach(struct ipoib_dev_priv *priv)
{
struct ifnet *dev;
if_t dev;
dev = priv->dev;
if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) {
@ -842,7 +841,7 @@ ipoib_ifdetach(struct ipoib_dev_priv *priv)
static void
ipoib_detach(struct ipoib_dev_priv *priv)
{
struct ifnet *dev;
if_t dev;
dev = priv->dev;
if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) {
@ -905,7 +904,7 @@ struct ipoib_dev_priv *
ipoib_intf_alloc(const char *name)
{
struct ipoib_dev_priv *priv;
struct ifnet *dev;
if_t dev;
priv = ipoib_priv_alloc();
dev = priv->dev = if_alloc(IFT_INFINIBAND);
@ -913,7 +912,7 @@ ipoib_intf_alloc(const char *name)
free(priv, M_TEMP);
return NULL;
}
dev->if_softc = priv;
if_setsoftc(dev, priv);
priv->gone = 2; /* initializing */
priv->unit = alloc_unr(ipoib_unrhdr);
if (priv->unit == -1) {
@ -922,20 +921,20 @@ ipoib_intf_alloc(const char *name)
return NULL;
}
if_initname(dev, name, priv->unit);
dev->if_flags = IFF_BROADCAST | IFF_MULTICAST;
if_setflags(dev, IFF_BROADCAST | IFF_MULTICAST);
infiniband_ifattach(priv->dev, NULL, priv->broadcastaddr);
dev->if_init = ipoib_init;
dev->if_ioctl = ipoib_ioctl;
dev->if_start = ipoib_start;
if_setinitfn(dev, ipoib_init);
if_setioctlfn(dev, ipoib_ioctl);
if_setstartfn(dev, ipoib_start);
dev->if_snd.ifq_maxlen = ipoib_sendq_size * 2;
if_setsendqlen(dev, ipoib_sendq_size * 2);
priv->dev = dev;
if_link_state_change(priv->dev, LINK_STATE_DOWN);
return dev->if_softc;
return if_getsoftc(dev);
}
int
@ -945,14 +944,14 @@ ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
priv->hca_caps = device_attr->device_cap_flags;
priv->dev->if_hwassist = 0;
priv->dev->if_capabilities = 0;
if_sethwassist(priv->dev, 0);
if_setcapabilities(priv->dev, 0);
#ifndef CONFIG_INFINIBAND_IPOIB_CM
if (priv->hca_caps & IB_DEVICE_UD_IP_CSUM) {
set_bit(IPOIB_FLAG_CSUM, &priv->flags);
priv->dev->if_hwassist = CSUM_IP | CSUM_TCP | CSUM_UDP;
priv->dev->if_capabilities = IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM;
if_sethwassist(priv->dev, CSUM_IP | CSUM_TCP | CSUM_UDP);
if_setcapabilities(priv->dev, IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM);
}
#if 0
@ -962,15 +961,15 @@ ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
}
#endif
#endif
priv->dev->if_capabilities |=
IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_LINKSTATE;
priv->dev->if_capenable = priv->dev->if_capabilities;
if_setcapabilitiesbit(priv->dev,
IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_LINKSTATE, 0);
if_setcapenable(priv->dev, if_getcapabilities(priv->dev));
return 0;
}
static struct ifnet *
static if_t
ipoib_add_port(const char *format, struct ib_device *hca, u8 port)
{
struct ipoib_dev_priv *priv;
@ -990,8 +989,8 @@ ipoib_add_port(const char *format, struct ib_device *hca, u8 port)
}
/* MTU will be reset when mcast join happens */
priv->dev->if_mtu = IPOIB_UD_MTU(priv->max_ib_mtu);
priv->mcast_mtu = priv->admin_mtu = priv->dev->if_mtu;
if_setmtu(priv->dev, IPOIB_UD_MTU(priv->max_ib_mtu));
priv->mcast_mtu = priv->admin_mtu = if_getmtu(priv->dev);
result = ib_query_pkey(hca, port, 0, &priv->pkey);
if (result) {
@ -1018,7 +1017,7 @@ ipoib_add_port(const char *format, struct ib_device *hca, u8 port)
hca->name, port, result);
goto device_init_failed;
}
memcpy(IF_LLADDR(priv->dev) + 4, priv->local_gid.raw, sizeof(union ib_gid));
memcpy(if_getlladdr(priv->dev) + 4, priv->local_gid.raw, sizeof(union ib_gid));
result = ipoib_dev_init(priv, hca, port);
if (result < 0) {
@ -1027,7 +1026,7 @@ ipoib_add_port(const char *format, struct ib_device *hca, u8 port)
goto device_init_failed;
}
if (ipoib_cm_admin_enabled(priv))
priv->dev->if_mtu = IPOIB_CM_MTU(ipoib_cm_max_mtu(priv));
if_setmtu(priv->dev, IPOIB_CM_MTU(ipoib_cm_max_mtu(priv)));
INIT_IB_EVENT_HANDLER(&priv->event_handler,
priv->ca, ipoib_event);
@ -1059,7 +1058,7 @@ static void
ipoib_add_one(struct ib_device *device)
{
struct list_head *dev_list;
struct ifnet *dev;
if_t dev;
struct ipoib_dev_priv *priv;
int s, e, p;
@ -1085,7 +1084,7 @@ ipoib_add_one(struct ib_device *device)
continue;
dev = ipoib_add_port("ib", device, p);
if (!IS_ERR(dev)) {
priv = dev->if_softc;
priv = if_getsoftc(dev);
list_add_tail(&priv->list, dev_list);
}
}
@ -1123,25 +1122,33 @@ ipoib_remove_one(struct ib_device *device, void *client_data)
kfree(dev_list);
}
static u_int
ipoib_match_dev_addr_cb(void *arg, struct ifaddr *ifa, u_int count)
{
struct sockaddr *addr = arg;
/* If a match is already found, skip this. */
if (count > 0)
return (0);
if (ifa->ifa_addr->sa_len != addr->sa_len)
return (0);
if (memcmp(ifa->ifa_addr, addr, addr->sa_len) == 0)
return (1);
return (0);
}
static int
ipoib_match_dev_addr(const struct sockaddr *addr, struct ifnet *dev)
ipoib_match_dev_addr(const struct sockaddr *addr, if_t dev)
{
struct epoch_tracker et;
struct ifaddr *ifa;
int retval = 0;
NET_EPOCH_ENTER(et);
CK_STAILQ_FOREACH(ifa, &dev->if_addrhead, ifa_link) {
if (ifa->ifa_addr == NULL ||
ifa->ifa_addr->sa_family != addr->sa_family ||
ifa->ifa_addr->sa_len != addr->sa_len) {
continue;
}
if (memcmp(ifa->ifa_addr, addr, addr->sa_len) == 0) {
retval = 1;
break;
}
}
retval = if_foreach_addr_type(dev, addr->sa_family,
ipoib_match_dev_addr_cb, __DECONST(void *, addr));
NET_EPOCH_EXIT(et);
return (retval);
@ -1158,7 +1165,7 @@ ipoib_match_dev_addr(const struct sockaddr *addr, struct ifnet *dev)
static int
ipoib_match_gid_pkey_addr(struct ipoib_dev_priv *priv,
const union ib_gid *gid, u16 pkey_index, const struct sockaddr *addr,
struct ifnet **found_net_dev)
if_t *found_net_dev)
{
struct ipoib_dev_priv *child_priv;
int matches = 0;
@ -1167,7 +1174,7 @@ ipoib_match_gid_pkey_addr(struct ipoib_dev_priv *priv,
(!gid || !memcmp(gid, &priv->local_gid, sizeof(*gid)))) {
if (addr == NULL || ipoib_match_dev_addr(addr, priv->dev) != 0) {
if (*found_net_dev == NULL) {
struct ifnet *net_dev;
if_t net_dev;
if (priv->parent != NULL)
net_dev = priv->parent;
@ -1202,7 +1209,7 @@ ipoib_match_gid_pkey_addr(struct ipoib_dev_priv *priv,
static int
__ipoib_get_net_dev_by_params(struct list_head *dev_list, u8 port,
u16 pkey_index, const union ib_gid *gid,
const struct sockaddr *addr, struct ifnet **net_dev)
const struct sockaddr *addr, if_t *net_dev)
{
struct ipoib_dev_priv *priv;
int matches = 0;
@ -1223,11 +1230,11 @@ __ipoib_get_net_dev_by_params(struct list_head *dev_list, u8 port,
return matches;
}
static struct ifnet *
static if_t
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)
{
struct ifnet *net_dev;
if_t net_dev;
struct list_head *dev_list = client_data;
u16 pkey_index;
int matches;
@ -1273,16 +1280,16 @@ ipoib_get_net_dev_by_params(struct ib_device *dev, u8 port, u16 pkey,
}
static void
ipoib_config_vlan(void *arg, struct ifnet *ifp, uint16_t vtag)
ipoib_config_vlan(void *arg, if_t ifp, uint16_t vtag)
{
struct ipoib_dev_priv *parent;
struct ipoib_dev_priv *priv;
struct epoch_tracker et;
struct ifnet *dev;
if_t dev;
uint16_t pkey;
int error;
if (ifp->if_type != IFT_INFINIBAND)
if (if_gettype(ifp) != IFT_INFINIBAND)
return;
NET_EPOCH_ENTER(et);
dev = VLAN_DEVAT(ifp, vtag);
@ -1291,7 +1298,7 @@ ipoib_config_vlan(void *arg, struct ifnet *ifp, uint16_t vtag)
return;
priv = NULL;
error = 0;
parent = ifp->if_softc;
parent = if_getsoftc(ifp);
/* We only support 15 bits of pkey. */
if (vtag & 0x8000)
return;
@ -1310,7 +1317,7 @@ ipoib_config_vlan(void *arg, struct ifnet *ifp, uint16_t vtag)
priv = ipoib_priv_alloc();
priv->dev = dev;
priv->max_ib_mtu = parent->max_ib_mtu;
priv->mcast_mtu = priv->admin_mtu = parent->dev->if_mtu;
priv->mcast_mtu = priv->admin_mtu = if_getmtu(parent->dev);
set_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags);
error = ipoib_set_dev_features(priv, parent->ca);
if (error)
@ -1318,17 +1325,17 @@ ipoib_config_vlan(void *arg, struct ifnet *ifp, uint16_t vtag)
priv->pkey = pkey;
priv->broadcastaddr[8] = pkey >> 8;
priv->broadcastaddr[9] = pkey & 0xff;
dev->if_broadcastaddr = priv->broadcastaddr;
if_setbroadcastaddr(dev, priv->broadcastaddr);
error = ipoib_dev_init(priv, parent->ca, parent->port);
if (error)
goto out;
priv->parent = parent->dev;
list_add_tail(&priv->list, &parent->child_intfs);
VLAN_SETCOOKIE(dev, priv);
dev->if_start = ipoib_vlan_start;
dev->if_drv_flags &= ~IFF_DRV_RUNNING;
dev->if_hdrlen = IPOIB_HEADER_LEN;
if (ifp->if_drv_flags & IFF_DRV_RUNNING)
if_setstartfn(dev, ipoib_vlan_start);
if_setdrvflagbits(dev, 0, IFF_DRV_RUNNING);
if_setifheaderlen(dev, IPOIB_HEADER_LEN);
if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
ipoib_open(priv);
mutex_unlock(&parent->vlan_mutex);
return;
@ -1344,15 +1351,15 @@ ipoib_config_vlan(void *arg, struct ifnet *ifp, uint16_t vtag)
}
static void
ipoib_unconfig_vlan(void *arg, struct ifnet *ifp, uint16_t vtag)
ipoib_unconfig_vlan(void *arg, if_t ifp, uint16_t vtag)
{
struct ipoib_dev_priv *parent;
struct ipoib_dev_priv *priv;
struct epoch_tracker et;
struct ifnet *dev;
if_t dev;
uint16_t pkey;
if (ifp->if_type != IFT_INFINIBAND)
if (if_gettype(ifp) != IFT_INFINIBAND)
return;
NET_EPOCH_ENTER(et);
@ -1361,7 +1368,7 @@ ipoib_unconfig_vlan(void *arg, struct ifnet *ifp, uint16_t vtag)
if (dev)
VLAN_SETCOOKIE(dev, NULL);
pkey = vtag | 0x8000;
parent = ifp->if_softc;
parent = if_getsoftc(ifp);
mutex_lock(&parent->vlan_mutex);
list_for_each_entry(priv, &parent->child_intfs, list) {
if (priv->pkey == pkey) {

View File

@ -63,7 +63,7 @@ struct ipoib_mcast_iter {
static void ipoib_mcast_free(struct ipoib_mcast *mcast)
{
struct ifnet *dev = mcast->priv->dev;
if_t dev = mcast->priv->dev;
int tx_dropped = 0;
ipoib_dbg_mcast(mcast->priv, "deleting multicast group %16D\n",
@ -155,7 +155,7 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast,
struct ib_sa_mcmember_rec *mcmember)
{
struct ipoib_dev_priv *priv = mcast->priv;
struct ifnet *dev = priv->dev;
if_t dev = priv->dev;
struct ipoib_ah *ah;
struct epoch_tracker et;
int ret;
@ -164,7 +164,7 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast,
mcast->mcmember = *mcmember;
/* Set the cached Q_Key before we attach if it's the broadcast group */
if (!memcmp(mcast->mcmember.mgid.raw, dev->if_broadcastaddr + 4,
if (!memcmp(mcast->mcmember.mgid.raw, if_getbroadcastaddr(dev) + 4,
sizeof (union ib_gid))) {
spin_lock_irq(&priv->lock);
if (!priv->broadcast) {
@ -236,7 +236,7 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast,
_IF_DEQUEUE(&mcast->pkt_queue, mb);
mb->m_pkthdr.rcvif = dev;
if (dev->if_transmit(dev, mb))
if (if_transmit(dev, mb))
ipoib_warn(priv, "dev_queue_xmit failed to requeue packet\n");
}
@ -474,7 +474,7 @@ void ipoib_mcast_join_task(struct work_struct *work)
{
struct ipoib_dev_priv *priv =
container_of(work, struct ipoib_dev_priv, mcast_task.work);
struct ifnet *dev = priv->dev;
if_t dev = priv->dev;
struct ib_port_attr attr;
ipoib_dbg_mcast(priv, "Running join task. flags 0x%lX\n", priv->flags);
@ -492,7 +492,7 @@ void ipoib_mcast_join_task(struct work_struct *work)
if (ib_query_gid(priv->ca, priv->port, 0, &priv->local_gid, NULL))
ipoib_warn(priv, "ib_query_gid() failed\n");
else
memcpy(IF_LLADDR(dev) + 4, priv->local_gid.raw, sizeof (union ib_gid));
memcpy(if_getlladdr(dev) + 4, priv->local_gid.raw, sizeof (union ib_gid));
{
struct ib_port_attr attr;
@ -521,7 +521,7 @@ void ipoib_mcast_join_task(struct work_struct *work)
}
spin_lock_irq(&priv->lock);
memcpy(broadcast->mcmember.mgid.raw, dev->if_broadcastaddr + 4,
memcpy(broadcast->mcmember.mgid.raw, if_getbroadcastaddr(dev) + 4,
sizeof (union ib_gid));
priv->broadcast = broadcast;
@ -629,7 +629,7 @@ static int ipoib_mcast_leave(struct ipoib_dev_priv *priv, struct ipoib_mcast *mc
void
ipoib_mcast_send(struct ipoib_dev_priv *priv, void *mgid, struct mbuf *mb)
{
struct ifnet *dev = priv->dev;
if_t dev = priv->dev;
struct ipoib_mcast *mcast;
if (!test_bit(IPOIB_FLAG_OPER_UP, &priv->flags) ||
@ -757,7 +757,7 @@ ipoib_process_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
addr = LLADDR(sdl);
addrlen = sdl->sdl_alen;
if (!ipoib_mcast_addr_is_valid(addr, addrlen,
priv->dev->if_broadcastaddr))
if_getbroadcastaddr(priv->dev)))
return (0);
memcpy(mgid.raw, addr + 4, sizeof mgid);
@ -811,7 +811,7 @@ void ipoib_mcast_restart(struct ipoib_dev_priv *priv)
{
struct ipoib_mcast_ctx ctx = { priv,
{ &ctx.remove_list, &ctx.remove_list }};
struct ifnet *dev = priv->dev;
if_t dev = priv->dev;
struct ipoib_mcast *mcast, *tmcast;
ipoib_dbg_mcast(priv, "restarting multicast task flags 0x%lX\n",

View File

@ -143,6 +143,7 @@ int ipoib_transport_dev_init(struct ipoib_dev_priv *priv, struct ib_device *ca)
.qp_type = IB_QPT_UD
};
struct ib_cq_init_attr cq_attr = {};
caddr_t lla;
int ret, size;
int i;
@ -212,9 +213,10 @@ int ipoib_transport_dev_init(struct ipoib_dev_priv *priv, struct ib_device *ca)
goto out_free_send_cq;
}
IF_LLADDR(priv->dev)[1] = (priv->qp->qp_num >> 16) & 0xff;
IF_LLADDR(priv->dev)[2] = (priv->qp->qp_num >> 8) & 0xff;
IF_LLADDR(priv->dev)[3] = (priv->qp->qp_num ) & 0xff;
lla = if_getlladdr(priv->dev);
lla[1] = (priv->qp->qp_num >> 16) & 0xff;
lla[2] = (priv->qp->qp_num >> 8) & 0xff;
lla[3] = (priv->qp->qp_num ) & 0xff;
for (i = 0; i < IPOIB_MAX_TX_SG; ++i)
priv->tx_sge[i].lkey = priv->pd->local_dma_lkey;

View File

@ -48,14 +48,14 @@ __FBSDID("$FreeBSD$");
static ssize_t show_parent(struct device *d, struct device_attribute *attr,
char *buf)
{
struct ifnet *dev = to_net_dev(d);
if_t dev = to_net_dev(d);
struct ipoib_dev_priv *priv = dev->if_softc;
return sprintf(buf, "%s\n", priv->parent->name);
}
static DEVICE_ATTR(parent, S_IRUGO, show_parent, NULL);
int ipoib_vlan_add(struct ifnet *pdev, unsigned short pkey)
int ipoib_vlan_add(if_t pdev, unsigned short pkey)
{
struct ipoib_dev_priv *ppriv, *priv;
char intf_name[IFNAMSIZ];
@ -107,7 +107,7 @@ int ipoib_vlan_add(struct ifnet *pdev, unsigned short pkey)
priv->pkey = pkey;
memcpy(IF_LLADDR(priv->dev), ppriv->dev->dev_addr, INFINIBAND_ALEN);
memcpy(if_getlladdr(priv->dev), ppriv->dev->dev_addr, INFINIBAND_ALEN);
priv->broadcastaddr[8] = pkey >> 8;
priv->broadcastaddr[9] = pkey & 0xff;
@ -162,10 +162,10 @@ int ipoib_vlan_add(struct ifnet *pdev, unsigned short pkey)
return result;
}
int ipoib_vlan_delete(struct ifnet *pdev, unsigned short pkey)
int ipoib_vlan_delete(if_t pdev, unsigned short pkey)
{
struct ipoib_dev_priv *ppriv, *priv, *tpriv;
struct ifnet *dev = NULL;
if_t dev = NULL;
if (!capable(CAP_NET_ADMIN))
return -EPERM;

View File

@ -54,7 +54,7 @@
/* Linux netdevice.h but for working on an ifnet rather than a net_device. */
#define dev_hold(d) if_ref(d)
#define dev_put(d) if_rele(d)
#define dev_net(d) ((d)->if_vnet)
#define dev_net(d) if_getvnet(d)
#define net_eq(a,b) ((a) == (b))
@ -142,7 +142,7 @@ int rdma_resolve_ip_route(struct sockaddr *src_addr,
void rdma_addr_cancel(struct rdma_dev_addr *addr);
int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct ifnet *dev,
int rdma_copy_addr(struct rdma_dev_addr *dev_addr, if_t dev,
const unsigned char *dst_dev_addr);
int rdma_addr_size(struct sockaddr *addr);
@ -151,7 +151,7 @@ int rdma_addr_size_kss(struct sockaddr_storage *addr);
int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid,
const union ib_gid *dgid,
u8 *smac, struct ifnet *dev,
u8 *smac, if_t dev,
int *hoplimit);
static inline u16 ib_addr_get_pkey(struct rdma_dev_addr *dev_addr)
@ -176,13 +176,13 @@ static inline int rdma_addr_gid_offset(struct rdma_dev_addr *dev_addr)
return dev_addr->dev_type == ARPHRD_INFINIBAND ? 4 : 0;
}
static inline u16 rdma_vlan_dev_vlan_id(const struct ifnet *dev)
static inline u16 rdma_vlan_dev_vlan_id(if_t dev)
{
uint16_t tag;
if (dev->if_type == IFT_ETHER && dev->if_pcp != IFNET_PCP_NONE)
if (if_gettype(dev) != IFT_ETHER || if_getpcp(dev) == IFNET_PCP_NONE)
return 0x0000; /* prio-tagged traffic */
if (VLAN_TAG(__DECONST(struct ifnet *, dev), &tag) != 0)
if (VLAN_TAG(__DECONST(if_t, dev), &tag) != 0)
return 0xffff;
return tag;
}
@ -228,11 +228,19 @@ static inline void rdma_gid2ip(struct sockaddr *out, const union ib_gid *gid)
}
}
static u_int
_iboe_addr_get_sgid_ia_cb(void *arg, struct ifaddr *ifa, u_int count __unused)
{
ipv6_addr_set_v4mapped(((struct sockaddr_in *)
ifa->ifa_addr)->sin_addr.s_addr,
(struct in6_addr *)arg);
return (0);
}
static inline void iboe_addr_get_sgid(struct rdma_dev_addr *dev_addr,
union ib_gid *gid)
{
struct ifnet *dev;
struct ifaddr *ifa;
if_t dev;
#ifdef VIMAGE
if (dev_addr->net == NULL)
@ -240,15 +248,8 @@ static inline void iboe_addr_get_sgid(struct rdma_dev_addr *dev_addr,
#endif
dev = dev_get_by_index(dev_addr->net, dev_addr->bound_dev_if);
if (dev) {
CK_STAILQ_FOREACH(ifa, &dev->if_addrhead, ifa_link) {
if (ifa->ifa_addr == NULL ||
ifa->ifa_addr->sa_family != AF_INET)
continue;
ipv6_addr_set_v4mapped(((struct sockaddr_in *)
ifa->ifa_addr)->sin_addr.s_addr,
(struct in6_addr *)gid);
break;
}
if_foreach_addr_type(dev, AF_INET,
_iboe_addr_get_sgid_ia_cb, gid);
dev_put(dev);
}
}
@ -300,9 +301,9 @@ static inline enum ib_mtu iboe_get_mtu(int mtu)
return 0;
}
static inline int iboe_get_rate(struct ifnet *dev)
static inline int iboe_get_rate(if_t dev)
{
uint64_t baudrate = dev->if_baudrate;
uint64_t baudrate = if_getbaudrate(dev);
#ifdef if_baudrate_pf
int exp;
for (exp = dev->if_baudrate_pf; exp > 0; exp--)
@ -365,12 +366,12 @@ static inline u16 rdma_get_vlan_id(union ib_gid *dgid)
return vid < 0x1000 ? vid : 0xffff;
}
static inline struct ifnet *rdma_vlan_dev_real_dev(struct ifnet *dev)
static inline if_t rdma_vlan_dev_real_dev(if_t dev)
{
struct epoch_tracker et;
NET_EPOCH_ENTER(et);
if (dev->if_type != IFT_ETHER || dev->if_pcp == IFNET_PCP_NONE)
if (if_gettype(dev) != IFT_ETHER || if_getpcp(dev) == IFNET_PCP_NONE)
dev = VLAN_TRUNKDEV(dev); /* non prio-tagged traffic */
NET_EPOCH_EXIT(et);
return (dev);

View File

@ -32,13 +32,13 @@
#define _RDMA_IB_ADDR_FREEBSD_H
#ifdef INET
static inline struct ifnet *
static inline if_t
ip_ifp_find(struct vnet *vnet, uint32_t addr)
{
struct sockaddr_in sin;
struct epoch_tracker et;
struct ifaddr *ifa;
struct ifnet *ifp;
if_t ifp;
memset(&sin, 0, sizeof(sin));
sin.sin_addr.s_addr = addr;
@ -60,13 +60,13 @@ ip_ifp_find(struct vnet *vnet, uint32_t addr)
#endif
#ifdef INET6
static inline struct ifnet *
static inline if_t
ip6_ifp_find(struct vnet *vnet, struct in6_addr addr, uint16_t scope_id)
{
struct sockaddr_in6 sin6;
struct epoch_tracker et;
struct ifaddr *ifa;
struct ifnet *ifp;
if_t ifp;
memset(&sin6, 0, sizeof(sin6));
sin6.sin6_addr = addr;
@ -92,11 +92,11 @@ ip6_ifp_find(struct vnet *vnet, struct in6_addr addr, uint16_t scope_id)
}
#endif
static inline struct ifnet *
static inline if_t
dev_get_by_index(struct vnet *vnet, int if_index)
{
struct epoch_tracker et;
struct ifnet *retval;
if_t retval;
NET_EPOCH_ENTER(et);
CURVNET_SET(vnet);

View File

@ -76,7 +76,7 @@ int ib_get_cached_gid(struct ib_device *device,
int ib_find_cached_gid(struct ib_device *device,
const union ib_gid *gid,
enum ib_gid_type gid_type,
struct ifnet *ndev,
if_t ndev,
u8 *port_num,
u16 *index);
@ -99,7 +99,7 @@ int ib_find_cached_gid_by_port(struct ib_device *device,
const union ib_gid *gid,
enum ib_gid_type gid_type,
u8 port_num,
struct ifnet *ndev,
if_t ndev,
u16 *index);
int ib_find_gid_by_filter(struct ib_device *device,

View File

@ -181,7 +181,7 @@ struct ib_sa_path_rec {
enum ib_gid_type gid_type;
};
static inline struct ifnet *ib_get_ndev_from_path(struct ib_sa_path_rec *rec)
static inline if_t ib_get_ndev_from_path(struct ib_sa_path_rec *rec)
{
#ifdef VIMAGE
if (rec->net == NULL)
@ -425,7 +425,7 @@ int ib_sa_get_mcmember_rec(struct ib_device *device, u8 port_num,
*/
int ib_init_ah_from_mcmember(struct ib_device *device, u8 port_num,
struct ib_sa_mcmember_rec *rec,
struct ifnet *ndev,
if_t ndev,
enum ib_gid_type gid_type,
struct ib_ah_attr *ah_attr);

View File

@ -106,7 +106,7 @@ enum ib_gid_type {
#define ROCE_V2_UDP_DPORT 4791
struct ib_gid_attr {
enum ib_gid_type gid_type;
struct ifnet *ndev;
if_t ndev;
};
enum rdma_node_type {
@ -2165,7 +2165,7 @@ struct ib_device {
* that this function returns NULL before the net device reaches
* NETDEV_UNREGISTER_FINAL state.
*/
struct ifnet *(*get_netdev)(struct ib_device *device,
if_t (*get_netdev)(struct ib_device *device,
u8 port_num);
int (*query_gid)(struct ib_device *device,
u8 port_num, int index,
@ -2443,7 +2443,7 @@ struct ib_client {
*
* The caller is responsible for calling dev_put on the returned
* netdev. */
struct ifnet *(*get_net_dev_by_params)(
if_t (*get_net_dev_by_params)(
struct ib_device *dev,
u8 port,
u16 pkey,
@ -2931,7 +2931,7 @@ int ib_modify_port(struct ib_device *device,
struct ib_port_modify *port_modify);
int ib_find_gid(struct ib_device *device, union ib_gid *gid,
enum ib_gid_type gid_type, struct ifnet *ndev,
enum ib_gid_type gid_type, if_t ndev,
u8 *port_num, u16 *index);
int ib_find_pkey(struct ib_device *device,
@ -3918,7 +3918,7 @@ static inline bool ib_access_writable(int access_flags)
int ib_check_mr_status(struct ib_mr *mr, u32 check_mask,
struct ib_mr_status *mr_status);
struct ifnet *ib_get_net_dev_by_params(struct ib_device *dev, u8 port,
if_t ib_get_net_dev_by_params(struct ib_device *dev, u8 port,
u16 pkey, const union ib_gid *gid,
const struct sockaddr *addr);
struct ib_wq *ib_create_wq(struct ib_pd *pd,