irdma: Convert to IfAPI
Mostly mechanical changes, with some reworking in irdma_cm for iterating over interfaces and addresses. Further rework by Bartosz Sobczak. Reviewed by: bartosz.sobczak_intel.com Tested by: mateusz.moga_intel.com Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D38960
This commit is contained in:
parent
95e4f5ef7c
commit
cfaab41c95
@ -1988,7 +1988,7 @@ krping_get_ipv6_scope_id(char *name)
|
|||||||
CURVNET_RESTORE();
|
CURVNET_RESTORE();
|
||||||
if (ifp == NULL)
|
if (ifp == NULL)
|
||||||
return (0);
|
return (0);
|
||||||
retval = ifp->if_index;
|
retval = if_getindex(ifp);
|
||||||
if_rele(ifp);
|
if_rele(ifp);
|
||||||
return (retval);
|
return (retval);
|
||||||
}
|
}
|
||||||
|
@ -183,28 +183,20 @@ irdma_ieq_check_mpacrc(void *desc,
|
|||||||
return ret_code;
|
return ret_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static u_int
|
||||||
* irdma_add_ipv6_addr - add ipv6 address to the hw arp table
|
irdma_add_ipv6_cb(void *arg, struct ifaddr *addr, u_int count __unused)
|
||||||
* @iwdev: irdma device
|
|
||||||
* @ifp: interface network device pointer
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
irdma_add_ipv6_addr(struct irdma_device *iwdev, struct ifnet *ifp)
|
|
||||||
{
|
{
|
||||||
struct ifaddr *ifa, *tmp;
|
struct irdma_device *iwdev = arg;
|
||||||
struct sockaddr_in6 *sin6;
|
struct sockaddr_in6 *sin6;
|
||||||
u32 local_ipaddr6[4];
|
u32 local_ipaddr6[4] = {};
|
||||||
u8 *mac_addr;
|
|
||||||
char ip6buf[INET6_ADDRSTRLEN];
|
char ip6buf[INET6_ADDRSTRLEN];
|
||||||
|
u8 *mac_addr;
|
||||||
|
|
||||||
if_addr_rlock(ifp);
|
sin6 = (struct sockaddr_in6 *)addr->ifa_addr;
|
||||||
IRDMA_TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, tmp) {
|
|
||||||
sin6 = (struct sockaddr_in6 *)ifa->ifa_addr;
|
|
||||||
if (sin6->sin6_family != AF_INET6)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
irdma_copy_ip_ntohl(local_ipaddr6, (u32 *)&sin6->sin6_addr);
|
irdma_copy_ip_ntohl(local_ipaddr6, (u32 *)&sin6->sin6_addr);
|
||||||
mac_addr = IF_LLADDR(ifp);
|
|
||||||
|
mac_addr = if_getlladdr(addr->ifa_ifp);
|
||||||
|
|
||||||
printf("%s:%d IP=%s, MAC=%02x:%02x:%02x:%02x:%02x:%02x\n",
|
printf("%s:%d IP=%s, MAC=%02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||||
__func__, __LINE__,
|
__func__, __LINE__,
|
||||||
@ -214,32 +206,35 @@ irdma_add_ipv6_addr(struct irdma_device *iwdev, struct ifnet *ifp)
|
|||||||
|
|
||||||
irdma_manage_arp_cache(iwdev->rf, mac_addr, local_ipaddr6,
|
irdma_manage_arp_cache(iwdev->rf, mac_addr, local_ipaddr6,
|
||||||
IRDMA_ARP_ADD);
|
IRDMA_ARP_ADD);
|
||||||
|
return (0);
|
||||||
}
|
|
||||||
if_addr_runlock(ifp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* irdma_add_ipv4_addr - add ipv4 address to the hw arp table
|
* irdma_add_ipv6_addr - add ipv6 address to the hw arp table
|
||||||
* @iwdev: irdma device
|
* @iwdev: irdma device
|
||||||
* @ifp: interface network device pointer
|
* @ifp: interface network device pointer
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
irdma_add_ipv4_addr(struct irdma_device *iwdev, struct ifnet *ifp)
|
irdma_add_ipv6_addr(struct irdma_device *iwdev, struct ifnet *ifp)
|
||||||
{
|
{
|
||||||
struct ifaddr *ifa;
|
if_addr_rlock(ifp);
|
||||||
|
if_foreach_addr_type(ifp, AF_INET6, irdma_add_ipv6_cb, iwdev);
|
||||||
|
if_addr_runlock(ifp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static u_int
|
||||||
|
irdma_add_ipv4_cb(void *arg, struct ifaddr *addr, u_int count __unused)
|
||||||
|
{
|
||||||
|
struct irdma_device *iwdev = arg;
|
||||||
struct sockaddr_in *sin;
|
struct sockaddr_in *sin;
|
||||||
u32 ip_addr[4] = {};
|
u32 ip_addr[4] = {};
|
||||||
u8 *mac_addr;
|
uint8_t *mac_addr;
|
||||||
|
|
||||||
if_addr_rlock(ifp);
|
sin = (struct sockaddr_in *)addr->ifa_addr;
|
||||||
IRDMA_TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
|
|
||||||
sin = (struct sockaddr_in *)ifa->ifa_addr;
|
|
||||||
if (sin->sin_family != AF_INET)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
ip_addr[0] = ntohl(sin->sin_addr.s_addr);
|
ip_addr[0] = ntohl(sin->sin_addr.s_addr);
|
||||||
mac_addr = IF_LLADDR(ifp);
|
|
||||||
|
mac_addr = if_getlladdr(addr->ifa_ifp);
|
||||||
|
|
||||||
printf("%s:%d IP=%d.%d.%d.%d, MAC=%02x:%02x:%02x:%02x:%02x:%02x\n",
|
printf("%s:%d IP=%d.%d.%d.%d, MAC=%02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||||
__func__, __LINE__,
|
__func__, __LINE__,
|
||||||
@ -252,7 +247,19 @@ irdma_add_ipv4_addr(struct irdma_device *iwdev, struct ifnet *ifp)
|
|||||||
|
|
||||||
irdma_manage_arp_cache(iwdev->rf, mac_addr, ip_addr,
|
irdma_manage_arp_cache(iwdev->rf, mac_addr, ip_addr,
|
||||||
IRDMA_ARP_ADD);
|
IRDMA_ARP_ADD);
|
||||||
}
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* irdma_add_ipv4_addr - add ipv4 address to the hw arp table
|
||||||
|
* @iwdev: irdma device
|
||||||
|
* @ifp: interface network device pointer
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
irdma_add_ipv4_addr(struct irdma_device *iwdev, struct ifnet *ifp)
|
||||||
|
{
|
||||||
|
if_addr_rlock(ifp);
|
||||||
|
if_foreach_addr_type(ifp, AF_INET, irdma_add_ipv4_cb, iwdev);
|
||||||
if_addr_runlock(ifp);
|
if_addr_runlock(ifp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,7 +278,7 @@ irdma_add_ip(struct irdma_device *iwdev)
|
|||||||
|
|
||||||
irdma_add_ipv4_addr(iwdev, ifp);
|
irdma_add_ipv4_addr(iwdev, ifp);
|
||||||
irdma_add_ipv6_addr(iwdev, ifp);
|
irdma_add_ipv6_addr(iwdev, ifp);
|
||||||
for (i = 0; ifp->if_vlantrunk != NULL && i < VLAN_N_VID; ++i) {
|
for (i = 0; if_getvlantrunk(ifp) != NULL && i < VLAN_N_VID; ++i) {
|
||||||
ifv = VLAN_DEVAT(ifp, i);
|
ifv = VLAN_DEVAT(ifp, i);
|
||||||
if (!ifv)
|
if (!ifv)
|
||||||
continue;
|
continue;
|
||||||
@ -293,7 +300,7 @@ irdma_ifaddrevent_handler(void *arg, struct ifnet *ifp, struct ifaddr *ifa, int
|
|||||||
if (!ifa || !ifa->ifa_addr || !ifp)
|
if (!ifa || !ifa->ifa_addr || !ifp)
|
||||||
return;
|
return;
|
||||||
if (rf->iwdev->netdev != ifp) {
|
if (rf->iwdev->netdev != ifp) {
|
||||||
for (i = 0; rf->iwdev->netdev->if_vlantrunk != NULL && i < VLAN_N_VID; ++i) {
|
for (i = 0; if_getvlantrunk(rf->iwdev->netdev) != NULL && i < VLAN_N_VID; ++i) {
|
||||||
NET_EPOCH_ENTER(et);
|
NET_EPOCH_ENTER(et);
|
||||||
ifv = VLAN_DEVAT(rf->iwdev->netdev, i);
|
ifv = VLAN_DEVAT(rf->iwdev->netdev, i);
|
||||||
NET_EPOCH_EXIT(et);
|
NET_EPOCH_EXIT(et);
|
||||||
@ -467,7 +474,7 @@ irdma_addr_resolve_neigh_ipv6(struct irdma_cm_node *cm_node,
|
|||||||
|
|
||||||
dst_addr.sin6_family = AF_INET6;
|
dst_addr.sin6_family = AF_INET6;
|
||||||
dst_addr.sin6_len = sizeof(dst_addr);
|
dst_addr.sin6_len = sizeof(dst_addr);
|
||||||
dst_addr.sin6_scope_id = iwdev->netdev->if_index;
|
dst_addr.sin6_scope_id = if_getindex(iwdev->netdev);
|
||||||
|
|
||||||
irdma_copy_ip_htonl(dst_addr.sin6_addr.__u6_addr.__u6_addr32, dest);
|
irdma_copy_ip_htonl(dst_addr.sin6_addr.__u6_addr.__u6_addr32, dest);
|
||||||
err = irdma_get_dst_mac(cm_node, (struct sockaddr *)&dst_addr, dst_mac);
|
err = irdma_get_dst_mac(cm_node, (struct sockaddr *)&dst_addr, dst_mac);
|
||||||
|
@ -55,8 +55,6 @@
|
|||||||
*/
|
*/
|
||||||
char irdma_driver_version[] = "1.1.11-k";
|
char irdma_driver_version[] = "1.1.11-k";
|
||||||
|
|
||||||
#define pf_if_d(peer) peer->ifp->if_dunit
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* irdma_init_tunable - prepare tunables
|
* irdma_init_tunable - prepare tunables
|
||||||
* @rf: RDMA PCI function
|
* @rf: RDMA PCI function
|
||||||
@ -247,7 +245,7 @@ irdma_event_handler(struct ice_rdma_peer *peer, struct ice_rdma_event *event)
|
|||||||
(event->type == 1) ? "LINK CHANGE" :
|
(event->type == 1) ? "LINK CHANGE" :
|
||||||
(event->type == 2) ? "MTU CHANGE" :
|
(event->type == 2) ? "MTU CHANGE" :
|
||||||
(event->type == 3) ? "TC CHANGE" : "UNKNOWN",
|
(event->type == 3) ? "TC CHANGE" : "UNKNOWN",
|
||||||
event->type, peer->pf_id, pf_if_d(peer));
|
event->type, peer->pf_id, if_getdunit(peer->ifp));
|
||||||
iwdev = peer_to_iwdev(peer);
|
iwdev = peer_to_iwdev(peer);
|
||||||
if (!iwdev) {
|
if (!iwdev) {
|
||||||
printf("%s:%d rdma device not found\n", __func__, __LINE__);
|
printf("%s:%d rdma device not found\n", __func__, __LINE__);
|
||||||
@ -257,7 +255,8 @@ irdma_event_handler(struct ice_rdma_peer *peer, struct ice_rdma_event *event)
|
|||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
case ICE_RDMA_EVENT_LINK_CHANGE:
|
case ICE_RDMA_EVENT_LINK_CHANGE:
|
||||||
printf("%s:%d PF: %x (%x), state: %d, speed: %lu\n", __func__, __LINE__,
|
printf("%s:%d PF: %x (%x), state: %d, speed: %lu\n", __func__, __LINE__,
|
||||||
peer->pf_id, pf_if_d(peer), event->linkstate, event->baudrate);
|
peer->pf_id, if_getdunit(peer->ifp), event->linkstate,
|
||||||
|
event->baudrate);
|
||||||
break;
|
break;
|
||||||
case ICE_RDMA_EVENT_MTU_CHANGE:
|
case ICE_RDMA_EVENT_MTU_CHANGE:
|
||||||
if (iwdev->vsi.mtu != event->mtu) {
|
if (iwdev->vsi.mtu != event->mtu) {
|
||||||
@ -317,7 +316,7 @@ static void
|
|||||||
irdma_link_change(struct ice_rdma_peer *peer, int linkstate, uint64_t baudrate)
|
irdma_link_change(struct ice_rdma_peer *peer, int linkstate, uint64_t baudrate)
|
||||||
{
|
{
|
||||||
printf("%s:%d PF: %x (%x), state: %d, speed: %lu\n", __func__, __LINE__,
|
printf("%s:%d PF: %x (%x), state: %d, speed: %lu\n", __func__, __LINE__,
|
||||||
peer->pf_id, pf_if_d(peer), linkstate, baudrate);
|
peer->pf_id, if_getdunit(peer->ifp), linkstate, baudrate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -342,7 +341,7 @@ irdma_finalize_task(void *context, int pending)
|
|||||||
if (iwdev->iw_status) {
|
if (iwdev->iw_status) {
|
||||||
irdma_debug(&rf->sc_dev, IRDMA_DEBUG_INIT,
|
irdma_debug(&rf->sc_dev, IRDMA_DEBUG_INIT,
|
||||||
"Starting deferred closing %d (%d)\n",
|
"Starting deferred closing %d (%d)\n",
|
||||||
rf->peer_info->pf_id, pf_if_d(peer));
|
rf->peer_info->pf_id, if_getdunit(peer->ifp));
|
||||||
irdma_dereg_ipaddr_event_cb(rf);
|
irdma_dereg_ipaddr_event_cb(rf);
|
||||||
irdma_ib_unregister_device(iwdev);
|
irdma_ib_unregister_device(iwdev);
|
||||||
req.type = ICE_RDMA_EVENT_VSI_FILTER_UPDATE;
|
req.type = ICE_RDMA_EVENT_VSI_FILTER_UPDATE;
|
||||||
@ -353,7 +352,7 @@ irdma_finalize_task(void *context, int pending)
|
|||||||
} else {
|
} else {
|
||||||
irdma_debug(&rf->sc_dev, IRDMA_DEBUG_INIT,
|
irdma_debug(&rf->sc_dev, IRDMA_DEBUG_INIT,
|
||||||
"Starting deferred opening %d (%d)\n",
|
"Starting deferred opening %d (%d)\n",
|
||||||
rf->peer_info->pf_id, pf_if_d(peer));
|
rf->peer_info->pf_id, if_getdunit(peer->ifp));
|
||||||
irdma_get_qos_info(&l2params, &peer->initial_qos_info);
|
irdma_get_qos_info(&l2params, &peer->initial_qos_info);
|
||||||
if (iwdev->rf->protocol_used != IRDMA_IWARP_PROTOCOL_ONLY)
|
if (iwdev->rf->protocol_used != IRDMA_IWARP_PROTOCOL_ONLY)
|
||||||
iwdev->dcb_vlan_mode = l2params.num_tc > 1 && !l2params.dscp_mode;
|
iwdev->dcb_vlan_mode = l2params.num_tc > 1 && !l2params.dscp_mode;
|
||||||
@ -377,7 +376,7 @@ irdma_finalize_task(void *context, int pending)
|
|||||||
irdma_reg_ipaddr_event_cb(rf);
|
irdma_reg_ipaddr_event_cb(rf);
|
||||||
irdma_debug(&rf->sc_dev, IRDMA_DEBUG_INIT,
|
irdma_debug(&rf->sc_dev, IRDMA_DEBUG_INIT,
|
||||||
"Deferred opening finished %d (%d)\n",
|
"Deferred opening finished %d (%d)\n",
|
||||||
rf->peer_info->pf_id, pf_if_d(peer));
|
rf->peer_info->pf_id, if_getdunit(peer->ifp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -516,7 +515,7 @@ irdma_probe(struct ice_rdma_peer *peer)
|
|||||||
|
|
||||||
irdma_pr_info("probe: irdma-%s peer=%p, peer->pf_id=%d, peer->ifp=%p, peer->ifp->if_dunit=%d, peer->pci_mem->r_bustag=%p\n",
|
irdma_pr_info("probe: irdma-%s peer=%p, peer->pf_id=%d, peer->ifp=%p, peer->ifp->if_dunit=%d, peer->pci_mem->r_bustag=%p\n",
|
||||||
irdma_driver_version, peer, peer->pf_id, peer->ifp,
|
irdma_driver_version, peer, peer->pf_id, peer->ifp,
|
||||||
pf_if_d(peer), (void *)(uintptr_t)peer->pci_mem->r_bustag);
|
if_getdunit(peer->ifp), (void *)(uintptr_t)peer->pci_mem->r_bustag);
|
||||||
|
|
||||||
hdl = irdma_find_handler(peer);
|
hdl = irdma_find_handler(peer);
|
||||||
if (hdl)
|
if (hdl)
|
||||||
@ -541,7 +540,7 @@ irdma_probe(struct ice_rdma_peer *peer)
|
|||||||
hdl->iwdev = iwdev;
|
hdl->iwdev = iwdev;
|
||||||
iwdev->hdl = hdl;
|
iwdev->hdl = hdl;
|
||||||
|
|
||||||
irdma_init_tunable(iwdev->rf, pf_if_d(peer));
|
irdma_init_tunable(iwdev->rf, if_getdunit(peer->ifp));
|
||||||
irdma_fill_device_info(iwdev, peer);
|
irdma_fill_device_info(iwdev, peer);
|
||||||
rf = iwdev->rf;
|
rf = iwdev->rf;
|
||||||
|
|
||||||
@ -594,7 +593,7 @@ irdma_remove(struct ice_rdma_peer *peer)
|
|||||||
struct irdma_device *iwdev;
|
struct irdma_device *iwdev;
|
||||||
|
|
||||||
irdma_debug((struct irdma_sc_dev *)NULL, IRDMA_DEBUG_INIT,
|
irdma_debug((struct irdma_sc_dev *)NULL, IRDMA_DEBUG_INIT,
|
||||||
"removing %s irdma%d\n", __func__, pf_if_d(peer));
|
"removing %s irdma%d\n", __func__, if_getdunit(peer->ifp));
|
||||||
|
|
||||||
hdl = irdma_find_handler(peer);
|
hdl = irdma_find_handler(peer);
|
||||||
if (!hdl)
|
if (!hdl)
|
||||||
@ -626,7 +625,7 @@ irdma_remove(struct ice_rdma_peer *peer)
|
|||||||
kfree(iwdev->rf);
|
kfree(iwdev->rf);
|
||||||
ib_dealloc_device(&iwdev->ibdev);
|
ib_dealloc_device(&iwdev->ibdev);
|
||||||
irdma_pr_info("IRDMA hardware deinitialization complete irdma%d\n",
|
irdma_pr_info("IRDMA hardware deinitialization complete irdma%d\n",
|
||||||
pf_if_d(peer));
|
if_getdunit(peer->ifp));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1630,11 +1630,12 @@ static u8 irdma_get_egress_vlan_prio(u32 *loc_addr, u8 prio, bool ipv4){
|
|||||||
* Returns the net_device of the IPv6 address and also sets the
|
* Returns the net_device of the IPv6 address and also sets the
|
||||||
* vlan id and mac for that address.
|
* vlan id and mac for that address.
|
||||||
*/
|
*/
|
||||||
struct ifnet *
|
if_t
|
||||||
irdma_netdev_vlan_ipv6(u32 *addr, u16 *vlan_id, u8 *mac)
|
irdma_netdev_vlan_ipv6(u32 *addr, u16 *vlan_id, u8 *mac)
|
||||||
{
|
{
|
||||||
struct ifnet *ip_dev = NULL;
|
if_t ip_dev = NULL;
|
||||||
struct in6_addr laddr6;
|
struct in6_addr laddr6;
|
||||||
|
struct ifaddr *ifa;
|
||||||
u16 scope_id = 0;
|
u16 scope_id = 0;
|
||||||
|
|
||||||
irdma_copy_ip_htonl(laddr6.__u6_addr.__u6_addr32, addr);
|
irdma_copy_ip_htonl(laddr6.__u6_addr.__u6_addr32, addr);
|
||||||
@ -1651,8 +1652,9 @@ irdma_netdev_vlan_ipv6(u32 *addr, u16 *vlan_id, u8 *mac)
|
|||||||
if (ip_dev) {
|
if (ip_dev) {
|
||||||
if (vlan_id)
|
if (vlan_id)
|
||||||
*vlan_id = rdma_vlan_dev_vlan_id(ip_dev);
|
*vlan_id = rdma_vlan_dev_vlan_id(ip_dev);
|
||||||
if (ip_dev->if_addr && ip_dev->if_addr->ifa_addr && mac)
|
ifa = if_getifaddr(ip_dev);
|
||||||
ether_addr_copy(mac, IF_LLADDR(ip_dev));
|
if (ifa && ifa->ifa_addr && mac)
|
||||||
|
ether_addr_copy(mac, if_getlladdr(ip_dev));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ip_dev;
|
return ip_dev;
|
||||||
@ -1665,7 +1667,7 @@ irdma_netdev_vlan_ipv6(u32 *addr, u16 *vlan_id, u8 *mac)
|
|||||||
u16
|
u16
|
||||||
irdma_get_vlan_ipv4(u32 *addr)
|
irdma_get_vlan_ipv4(u32 *addr)
|
||||||
{
|
{
|
||||||
struct ifnet *netdev;
|
if_t netdev;
|
||||||
u16 vlan_id = 0xFFFF;
|
u16 vlan_id = 0xFFFF;
|
||||||
|
|
||||||
netdev = ip_ifp_find(&init_net, htonl(addr[0]));
|
netdev = ip_ifp_find(&init_net, htonl(addr[0]));
|
||||||
@ -1677,61 +1679,68 @@ irdma_get_vlan_ipv4(u32 *addr)
|
|||||||
return vlan_id;
|
return vlan_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct irdma_add_mqh_cbs {
|
||||||
|
struct irdma_device *iwdev;
|
||||||
|
struct irdma_cm_info *cm_info;
|
||||||
|
struct irdma_cm_listener *cm_listen_node;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* irdma_add_mqh_6 - Adds multiple qhashes for IPv6
|
* irdma_add_mqh_ifa_cb - Adds multiple qhashes for IPV4/IPv6
|
||||||
* @iwdev: iWarp device
|
* @arg: Calback argument structure from irdma_add_mqh
|
||||||
* @cm_info: CM info for parent listen node
|
* @ifa: Current address to compute against
|
||||||
* @cm_parent_listen_node: The parent listen node
|
* @count: Current cumulative output of all callbacks in this iteration
|
||||||
*
|
*
|
||||||
* Adds a qhash and a child listen node for every IPv6 address
|
* Adds a qhash and a child listen node for a single IPv4/IPv6 address
|
||||||
* on the adapter and adds the associated qhash filter
|
* on the adapter and adds the associated qhash filter
|
||||||
*/
|
*/
|
||||||
static int
|
static u_int
|
||||||
irdma_add_mqh_6(struct irdma_device *iwdev,
|
irdma_add_mqh_ifa_cb(void *arg, struct ifaddr *ifa, u_int count)
|
||||||
struct irdma_cm_info *cm_info,
|
|
||||||
struct irdma_cm_listener *cm_parent_listen_node)
|
|
||||||
{
|
{
|
||||||
struct ifnet *ip_dev;
|
struct irdma_add_mqh_cbs *cbs = arg;
|
||||||
struct ifaddr *ifp;
|
|
||||||
struct irdma_cm_listener *child_listen_node;
|
struct irdma_cm_listener *child_listen_node;
|
||||||
|
struct irdma_cm_info *cm_info = cbs->cm_info;
|
||||||
|
struct irdma_device *iwdev = cbs->iwdev;
|
||||||
|
struct irdma_cm_listener *cm_parent_listen_node = cbs->cm_listen_node;
|
||||||
|
if_t ip_dev = ifa->ifa_ifp;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int ret = 0;
|
int ret;
|
||||||
|
|
||||||
IFNET_RLOCK();
|
if (count)
|
||||||
IRDMA_TAILQ_FOREACH((ip_dev), &V_ifnet, if_link) {
|
return 0;
|
||||||
if (!(ip_dev->if_flags & IFF_UP))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (((rdma_vlan_dev_vlan_id(ip_dev) >= VLAN_N_VID) ||
|
if (cm_info->ipv4)
|
||||||
(rdma_vlan_dev_real_dev(ip_dev) != iwdev->netdev)) &&
|
irdma_debug(&iwdev->rf->sc_dev, IRDMA_DEBUG_CM,
|
||||||
ip_dev != iwdev->netdev)
|
"Allocating child CM Listener forIP=%pI4, vlan_id=%d, MAC=%pM\n",
|
||||||
continue;
|
&ifa->ifa_addr,
|
||||||
|
rdma_vlan_dev_vlan_id(ip_dev), if_getlladdr(ip_dev));
|
||||||
if_addr_rlock(ip_dev);
|
else
|
||||||
IRDMA_TAILQ_FOREACH(ifp, &ip_dev->if_addrhead, ifa_link) {
|
|
||||||
irdma_debug(&iwdev->rf->sc_dev, IRDMA_DEBUG_CM,
|
irdma_debug(&iwdev->rf->sc_dev, IRDMA_DEBUG_CM,
|
||||||
"IP=%pI6, vlan_id=%d, MAC=%pM\n",
|
"IP=%pI6, vlan_id=%d, MAC=%pM\n",
|
||||||
&((struct sockaddr_in6 *)ifp->ifa_addr)->sin6_addr, rdma_vlan_dev_vlan_id(ip_dev),
|
&((struct sockaddr_in6 *)ifa->ifa_addr)->sin6_addr,
|
||||||
IF_LLADDR(ip_dev));
|
rdma_vlan_dev_vlan_id(ip_dev),
|
||||||
if (((struct sockaddr_in6 *)ifp->ifa_addr)->sin6_family != AF_INET6)
|
if_getlladdr(ip_dev));
|
||||||
continue;
|
|
||||||
child_listen_node = kzalloc(sizeof(*child_listen_node), GFP_KERNEL);
|
child_listen_node = kzalloc(sizeof(*child_listen_node), GFP_KERNEL);
|
||||||
irdma_debug(&iwdev->rf->sc_dev, IRDMA_DEBUG_CM,
|
irdma_debug(&iwdev->rf->sc_dev, IRDMA_DEBUG_CM,
|
||||||
"Allocating child listener %p\n",
|
"Allocating child listener %p\n",
|
||||||
child_listen_node);
|
child_listen_node);
|
||||||
if (!child_listen_node) {
|
if (!child_listen_node) {
|
||||||
irdma_debug(&iwdev->rf->sc_dev, IRDMA_DEBUG_CM, "listener memory allocation\n");
|
irdma_debug(&iwdev->rf->sc_dev,
|
||||||
ret = -ENOMEM;
|
IRDMA_DEBUG_CM,
|
||||||
if_addr_runlock(ip_dev);
|
"listener memory allocation\n");
|
||||||
goto exit;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(child_listen_node, cm_parent_listen_node,
|
memcpy(child_listen_node, cm_parent_listen_node,
|
||||||
sizeof(*child_listen_node));
|
sizeof(*child_listen_node));
|
||||||
cm_info->vlan_id = rdma_vlan_dev_vlan_id(ip_dev);
|
cm_info->vlan_id = rdma_vlan_dev_vlan_id(ip_dev);
|
||||||
child_listen_node->vlan_id = cm_info->vlan_id;
|
child_listen_node->vlan_id = cm_info->vlan_id;
|
||||||
|
if (cm_info->ipv4)
|
||||||
|
child_listen_node->loc_addr[0] =
|
||||||
|
ntohl(((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr);
|
||||||
|
else
|
||||||
irdma_copy_ip_ntohl(child_listen_node->loc_addr,
|
irdma_copy_ip_ntohl(child_listen_node->loc_addr,
|
||||||
((struct sockaddr_in6 *)ifp->ifa_addr)->sin6_addr.__u6_addr.__u6_addr32);
|
((struct sockaddr_in6 *)ifa->ifa_addr)->sin6_addr.__u6_addr.__u6_addr32);
|
||||||
memcpy(cm_info->loc_addr, child_listen_node->loc_addr,
|
memcpy(cm_info->loc_addr, child_listen_node->loc_addr,
|
||||||
sizeof(cm_info->loc_addr));
|
sizeof(cm_info->loc_addr));
|
||||||
if (!iwdev->vsi.dscp_mode)
|
if (!iwdev->vsi.dscp_mode)
|
||||||
@ -1745,7 +1754,7 @@ irdma_add_mqh_6(struct irdma_device *iwdev,
|
|||||||
NULL, true);
|
NULL, true);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
kfree(child_listen_node);
|
kfree(child_listen_node);
|
||||||
continue;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
child_listen_node->qhash_set = true;
|
child_listen_node->qhash_set = true;
|
||||||
@ -1754,102 +1763,8 @@ irdma_add_mqh_6(struct irdma_device *iwdev,
|
|||||||
&cm_parent_listen_node->child_listen_list);
|
&cm_parent_listen_node->child_listen_list);
|
||||||
spin_unlock_irqrestore(&iwdev->cm_core.listen_list_lock, flags);
|
spin_unlock_irqrestore(&iwdev->cm_core.listen_list_lock, flags);
|
||||||
cm_parent_listen_node->cm_core->stats_listen_nodes_created++;
|
cm_parent_listen_node->cm_core->stats_listen_nodes_created++;
|
||||||
}
|
|
||||||
if_addr_runlock(ip_dev);
|
|
||||||
}
|
|
||||||
exit:
|
|
||||||
IFNET_RUNLOCK();
|
|
||||||
|
|
||||||
return ret;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* irdma_add_mqh_4 - Adds multiple qhashes for IPv4
|
|
||||||
* @iwdev: iWarp device
|
|
||||||
* @cm_info: CM info for parent listen node
|
|
||||||
* @cm_parent_listen_node: The parent listen node
|
|
||||||
*
|
|
||||||
* Adds a qhash and a child listen node for every IPv4 address
|
|
||||||
* on the adapter and adds the associated qhash filter
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
irdma_add_mqh_4(struct irdma_device *iwdev,
|
|
||||||
struct irdma_cm_info *cm_info,
|
|
||||||
struct irdma_cm_listener *cm_parent_listen_node)
|
|
||||||
{
|
|
||||||
struct ifnet *ip_dev;
|
|
||||||
struct irdma_cm_listener *child_listen_node;
|
|
||||||
unsigned long flags;
|
|
||||||
struct ifaddr *ifa;
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
IFNET_RLOCK();
|
|
||||||
IRDMA_TAILQ_FOREACH((ip_dev), &V_ifnet, if_link) {
|
|
||||||
if (!(ip_dev->if_flags & IFF_UP))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (((rdma_vlan_dev_vlan_id(ip_dev) >= VLAN_N_VID) ||
|
|
||||||
(rdma_vlan_dev_real_dev(ip_dev) != iwdev->netdev)) &&
|
|
||||||
ip_dev != iwdev->netdev)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if_addr_rlock(ip_dev);
|
|
||||||
IRDMA_TAILQ_FOREACH(ifa, &ip_dev->if_addrhead, ifa_link) {
|
|
||||||
irdma_debug(&iwdev->rf->sc_dev, IRDMA_DEBUG_CM,
|
|
||||||
"Allocating child CM Listener forIP=%pI4, vlan_id=%d, MAC=%pM\n",
|
|
||||||
&ifa->ifa_addr, rdma_vlan_dev_vlan_id(ip_dev),
|
|
||||||
IF_LLADDR(ip_dev));
|
|
||||||
if (((struct sockaddr_in *)ifa->ifa_addr)->sin_family != AF_INET)
|
|
||||||
continue;
|
|
||||||
child_listen_node = kzalloc(sizeof(*child_listen_node), GFP_KERNEL);
|
|
||||||
cm_parent_listen_node->cm_core->stats_listen_nodes_created++;
|
|
||||||
irdma_debug(&iwdev->rf->sc_dev, IRDMA_DEBUG_CM,
|
|
||||||
"Allocating child listener %p\n",
|
|
||||||
child_listen_node);
|
|
||||||
if (!child_listen_node) {
|
|
||||||
irdma_debug(&iwdev->rf->sc_dev, IRDMA_DEBUG_CM, "listener memory allocation\n");
|
|
||||||
if_addr_runlock(ip_dev);
|
|
||||||
ret = -ENOMEM;
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(child_listen_node, cm_parent_listen_node,
|
|
||||||
sizeof(*child_listen_node));
|
|
||||||
child_listen_node->vlan_id = rdma_vlan_dev_vlan_id(ip_dev);
|
|
||||||
cm_info->vlan_id = child_listen_node->vlan_id;
|
|
||||||
child_listen_node->loc_addr[0] =
|
|
||||||
ntohl(((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr);
|
|
||||||
memcpy(cm_info->loc_addr, child_listen_node->loc_addr,
|
|
||||||
sizeof(cm_info->loc_addr));
|
|
||||||
if (!iwdev->vsi.dscp_mode)
|
|
||||||
cm_info->user_pri =
|
|
||||||
irdma_get_egress_vlan_prio(child_listen_node->loc_addr,
|
|
||||||
cm_info->user_pri,
|
|
||||||
true);
|
|
||||||
ret = irdma_manage_qhash(iwdev, cm_info,
|
|
||||||
IRDMA_QHASH_TYPE_TCP_SYN,
|
|
||||||
IRDMA_QHASH_MANAGE_TYPE_ADD,
|
|
||||||
NULL, true);
|
|
||||||
if (ret) {
|
|
||||||
kfree(child_listen_node);
|
|
||||||
cm_parent_listen_node->cm_core
|
|
||||||
->stats_listen_nodes_created--;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
child_listen_node->qhash_set = true;
|
|
||||||
spin_lock_irqsave(&iwdev->cm_core.listen_list_lock,
|
|
||||||
flags);
|
|
||||||
list_add(&child_listen_node->child_listen_list,
|
|
||||||
&cm_parent_listen_node->child_listen_list);
|
|
||||||
spin_unlock_irqrestore(&iwdev->cm_core.listen_list_lock, flags);
|
|
||||||
}
|
|
||||||
if_addr_runlock(ip_dev);
|
|
||||||
}
|
|
||||||
exit:
|
|
||||||
IFNET_RUNLOCK();
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1863,21 +1778,42 @@ irdma_add_mqh(struct irdma_device *iwdev,
|
|||||||
struct irdma_cm_info *cm_info,
|
struct irdma_cm_info *cm_info,
|
||||||
struct irdma_cm_listener *cm_listen_node)
|
struct irdma_cm_listener *cm_listen_node)
|
||||||
{
|
{
|
||||||
|
struct epoch_tracker et;
|
||||||
|
struct irdma_add_mqh_cbs cbs;
|
||||||
|
struct if_iter iter;
|
||||||
|
if_t ifp;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
cbs.iwdev = iwdev;
|
||||||
|
cbs.cm_info = cm_info;
|
||||||
|
cbs.cm_listen_node = cm_listen_node;
|
||||||
|
|
||||||
VNET_ITERATOR_DECL(vnet_iter);
|
VNET_ITERATOR_DECL(vnet_iter);
|
||||||
|
|
||||||
VNET_LIST_RLOCK();
|
VNET_LIST_RLOCK();
|
||||||
|
NET_EPOCH_ENTER(et);
|
||||||
VNET_FOREACH(vnet_iter) {
|
VNET_FOREACH(vnet_iter) {
|
||||||
IFNET_RLOCK();
|
|
||||||
CURVNET_SET_QUIET(vnet_iter);
|
CURVNET_SET_QUIET(vnet_iter);
|
||||||
|
for (ifp = if_iter_start(&iter); ifp != NULL; ifp = if_iter_next(&iter)) {
|
||||||
|
if (!(if_getflags(ifp) & IFF_UP))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (((rdma_vlan_dev_vlan_id(ifp) >= VLAN_N_VID) ||
|
||||||
|
(rdma_vlan_dev_real_dev(ifp) != iwdev->netdev)) &&
|
||||||
|
ifp != iwdev->netdev)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if_addr_rlock(ifp);
|
||||||
if (cm_info->ipv4)
|
if (cm_info->ipv4)
|
||||||
err = irdma_add_mqh_4(iwdev, cm_info, cm_listen_node);
|
err = if_foreach_addr_type(ifp, AF_INET, irdma_add_mqh_ifa_cb, &cbs);
|
||||||
else
|
else
|
||||||
err = irdma_add_mqh_6(iwdev, cm_info, cm_listen_node);
|
err = if_foreach_addr_type(ifp, AF_INET6, irdma_add_mqh_ifa_cb, &cbs);
|
||||||
CURVNET_RESTORE();
|
if_addr_runlock(ifp);
|
||||||
IFNET_RUNLOCK();
|
|
||||||
}
|
}
|
||||||
|
if_iter_finish(&iter);
|
||||||
|
CURVNET_RESTORE();
|
||||||
|
}
|
||||||
|
NET_EPOCH_EXIT(et);
|
||||||
VNET_LIST_RUNLOCK();
|
VNET_LIST_RUNLOCK();
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
@ -2110,7 +2046,7 @@ irdma_cm_create_ah(struct irdma_cm_node *cm_node, bool wait)
|
|||||||
struct vnet *vnet = rdma_id->route.addr.dev_addr.net;
|
struct vnet *vnet = rdma_id->route.addr.dev_addr.net;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ether_addr_copy(ah_info.mac_addr, IF_LLADDR(iwdev->netdev));
|
ether_addr_copy(ah_info.mac_addr, if_getlladdr(iwdev->netdev));
|
||||||
|
|
||||||
ah_info.hop_ttl = 0x40;
|
ah_info.hop_ttl = 0x40;
|
||||||
ah_info.tc_tos = cm_node->tos;
|
ah_info.tc_tos = cm_node->tos;
|
||||||
@ -2178,7 +2114,7 @@ irdma_make_cm_node(struct irdma_cm_core *cm_core, struct irdma_device *iwdev,
|
|||||||
{
|
{
|
||||||
struct irdma_cm_node *cm_node;
|
struct irdma_cm_node *cm_node;
|
||||||
int arpindex;
|
int arpindex;
|
||||||
struct ifnet *netdev = iwdev->netdev;
|
if_t netdev = iwdev->netdev;
|
||||||
|
|
||||||
/* create an hte and cm_node for this instance */
|
/* create an hte and cm_node for this instance */
|
||||||
cm_node = kzalloc(sizeof(*cm_node), GFP_ATOMIC);
|
cm_node = kzalloc(sizeof(*cm_node), GFP_ATOMIC);
|
||||||
@ -2227,7 +2163,7 @@ irdma_make_cm_node(struct irdma_cm_core *cm_core, struct irdma_device *iwdev,
|
|||||||
|
|
||||||
cm_node->listener = listener;
|
cm_node->listener = listener;
|
||||||
cm_node->cm_id = cm_info->cm_id;
|
cm_node->cm_id = cm_info->cm_id;
|
||||||
ether_addr_copy(cm_node->loc_mac, IF_LLADDR(netdev));
|
ether_addr_copy(cm_node->loc_mac, if_getlladdr(netdev));
|
||||||
spin_lock_init(&cm_node->retrans_list_lock);
|
spin_lock_init(&cm_node->retrans_list_lock);
|
||||||
cm_node->ack_rcvd = false;
|
cm_node->ack_rcvd = false;
|
||||||
|
|
||||||
|
@ -1122,7 +1122,7 @@ irdma_alloc_set_mac(struct irdma_device *iwdev)
|
|||||||
&iwdev->mac_ip_table_idx);
|
&iwdev->mac_ip_table_idx);
|
||||||
if (!status) {
|
if (!status) {
|
||||||
status = irdma_add_local_mac_entry(iwdev->rf,
|
status = irdma_add_local_mac_entry(iwdev->rf,
|
||||||
(const u8 *)IF_LLADDR(iwdev->netdev),
|
(const u8 *)if_getlladdr(iwdev->netdev),
|
||||||
(u8)iwdev->mac_ip_table_idx);
|
(u8)iwdev->mac_ip_table_idx);
|
||||||
if (status)
|
if (status)
|
||||||
irdma_del_local_mac_entry(iwdev->rf,
|
irdma_del_local_mac_entry(iwdev->rf,
|
||||||
@ -2605,7 +2605,7 @@ irdma_manage_qhash(struct irdma_device *iwdev, struct irdma_cm_info *cminfo,
|
|||||||
}
|
}
|
||||||
info->ipv4_valid = cminfo->ipv4;
|
info->ipv4_valid = cminfo->ipv4;
|
||||||
info->user_pri = cminfo->user_pri;
|
info->user_pri = cminfo->user_pri;
|
||||||
ether_addr_copy(info->mac_addr, IF_LLADDR(iwdev->netdev));
|
ether_addr_copy(info->mac_addr, if_getlladdr(iwdev->netdev));
|
||||||
info->qp_num = cminfo->qh_qpid;
|
info->qp_num = cminfo->qh_qpid;
|
||||||
info->dest_port = cminfo->loc_port;
|
info->dest_port = cminfo->loc_port;
|
||||||
info->dest_ip[0] = cminfo->loc_addr[0];
|
info->dest_ip[0] = cminfo->loc_addr[0];
|
||||||
|
@ -638,7 +638,8 @@ irdma_fill_ah_info(struct vnet *vnet, struct irdma_ah_info *ah_info,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline u8 irdma_get_vlan_ndev_prio(struct ifnet *ndev, u8 prio){
|
static inline u8 irdma_get_vlan_ndev_prio(if_t ndev, u8 prio)
|
||||||
|
{
|
||||||
return prio;
|
return prio;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -665,7 +666,7 @@ irdma_create_ah_vlan_tag(struct irdma_device *iwdev,
|
|||||||
ah_info->vlan_tag = 0;
|
ah_info->vlan_tag = 0;
|
||||||
|
|
||||||
if (ah_info->vlan_tag < VLAN_N_VID) {
|
if (ah_info->vlan_tag < VLAN_N_VID) {
|
||||||
struct ifnet *ndev = sgid_attr->ndev;
|
if_t ndev = sgid_attr->ndev;
|
||||||
|
|
||||||
ah_info->insert_vlan_tag = true;
|
ah_info->insert_vlan_tag = true;
|
||||||
vlan_prio = (u16)irdma_get_vlan_ndev_prio(ndev, rt_tos2priority(ah_info->tc_tos));
|
vlan_prio = (u16)irdma_get_vlan_ndev_prio(ndev, rt_tos2priority(ah_info->tc_tos));
|
||||||
@ -777,7 +778,7 @@ irdma_create_ah(struct ib_ah *ib_ah,
|
|||||||
ah_info = &sc_ah->ah_info;
|
ah_info = &sc_ah->ah_info;
|
||||||
ah_info->ah_idx = ah_id;
|
ah_info->ah_idx = ah_id;
|
||||||
ah_info->pd_idx = pd->sc_pd.pd_id;
|
ah_info->pd_idx = pd->sc_pd.pd_id;
|
||||||
ether_addr_copy(ah_info->mac_addr, IF_LLADDR(iwdev->netdev));
|
ether_addr_copy(ah_info->mac_addr, if_getlladdr(iwdev->netdev));
|
||||||
|
|
||||||
if (attr->ah_flags & IB_AH_GRH) {
|
if (attr->ah_flags & IB_AH_GRH) {
|
||||||
ah_info->flow_label = attr->grh.flow_label;
|
ah_info->flow_label = attr->grh.flow_label;
|
||||||
@ -787,7 +788,7 @@ irdma_create_ah(struct ib_ah *ib_ah,
|
|||||||
|
|
||||||
ether_addr_copy(dmac, attr->dmac);
|
ether_addr_copy(dmac, attr->dmac);
|
||||||
|
|
||||||
irdma_fill_ah_info(iwdev->netdev->if_vnet, ah_info, &sgid_attr, &sgid_addr.saddr, &dgid_addr.saddr,
|
irdma_fill_ah_info(if_getvnet(iwdev->netdev), ah_info, &sgid_attr, &sgid_addr.saddr, &dgid_addr.saddr,
|
||||||
dmac, ah->av.net_type);
|
dmac, ah->av.net_type);
|
||||||
|
|
||||||
err = irdma_create_ah_vlan_tag(iwdev, pd, ah_info, &sgid_attr, dmac);
|
err = irdma_create_ah_vlan_tag(iwdev, pd, ah_info, &sgid_attr, dmac);
|
||||||
@ -946,7 +947,7 @@ irdma_create_ah(struct ib_pd *ibpd,
|
|||||||
ah_info->ah_idx = ah_id;
|
ah_info->ah_idx = ah_id;
|
||||||
ah_info->pd_idx = pd->sc_pd.pd_id;
|
ah_info->pd_idx = pd->sc_pd.pd_id;
|
||||||
|
|
||||||
ether_addr_copy(ah_info->mac_addr, IF_LLADDR(iwdev->netdev));
|
ether_addr_copy(ah_info->mac_addr, if_getlladdr(iwdev->netdev));
|
||||||
if (attr->ah_flags & IB_AH_GRH) {
|
if (attr->ah_flags & IB_AH_GRH) {
|
||||||
ah_info->flow_label = attr->grh.flow_label;
|
ah_info->flow_label = attr->grh.flow_label;
|
||||||
ah_info->hop_ttl = attr->grh.hop_limit;
|
ah_info->hop_ttl = attr->grh.hop_limit;
|
||||||
@ -957,7 +958,7 @@ irdma_create_ah(struct ib_pd *ibpd,
|
|||||||
ib_resolve_eth_dmac(ibpd->device, attr);
|
ib_resolve_eth_dmac(ibpd->device, attr);
|
||||||
irdma_ether_copy(dmac, attr);
|
irdma_ether_copy(dmac, attr);
|
||||||
|
|
||||||
irdma_fill_ah_info(iwdev->netdev->if_vnet, ah_info, &sgid_attr, &sgid_addr.saddr, &dgid_addr.saddr,
|
irdma_fill_ah_info(if_getvnet(iwdev->netdev), ah_info, &sgid_attr, &sgid_addr.saddr, &dgid_addr.saddr,
|
||||||
dmac, ah->av.net_type);
|
dmac, ah->av.net_type);
|
||||||
|
|
||||||
err = irdma_create_ah_vlan_tag(iwdev, pd, ah_info, &sgid_attr, dmac);
|
err = irdma_create_ah_vlan_tag(iwdev, pd, ah_info, &sgid_attr, dmac);
|
||||||
@ -1733,7 +1734,7 @@ kc_irdma_set_roce_cm_info(struct irdma_qp *iwqp, struct ib_qp_attr *attr,
|
|||||||
|
|
||||||
if (sgid_attr.ndev) {
|
if (sgid_attr.ndev) {
|
||||||
*vlan_id = rdma_vlan_dev_vlan_id(sgid_attr.ndev);
|
*vlan_id = rdma_vlan_dev_vlan_id(sgid_attr.ndev);
|
||||||
ether_addr_copy(iwqp->ctx_info.roce_info->mac_addr, IF_LLADDR(sgid_attr.ndev));
|
ether_addr_copy(iwqp->ctx_info.roce_info->mac_addr, if_getlladdr(sgid_attr.ndev));
|
||||||
}
|
}
|
||||||
|
|
||||||
av->net_type = kc_rdma_gid_attr_network_type(sgid_attr,
|
av->net_type = kc_rdma_gid_attr_network_type(sgid_attr,
|
||||||
@ -2002,7 +2003,7 @@ irdma_disassociate_ucontext(struct ib_ucontext *context)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct ib_device *
|
struct ib_device *
|
||||||
ib_device_get_by_netdev(struct ifnet *netdev, int driver_id)
|
ib_device_get_by_netdev(if_t netdev, int driver_id)
|
||||||
{
|
{
|
||||||
struct irdma_device *iwdev;
|
struct irdma_device *iwdev;
|
||||||
struct irdma_handler *hdl;
|
struct irdma_handler *hdl;
|
||||||
@ -2131,17 +2132,18 @@ irdma_query_port(struct ib_device *ibdev, u8 port,
|
|||||||
struct ib_port_attr *props)
|
struct ib_port_attr *props)
|
||||||
{
|
{
|
||||||
struct irdma_device *iwdev = to_iwdev(ibdev);
|
struct irdma_device *iwdev = to_iwdev(ibdev);
|
||||||
struct ifnet *netdev = iwdev->netdev;
|
if_t netdev = iwdev->netdev;
|
||||||
|
|
||||||
/* no need to zero out pros here. done by caller */
|
/* no need to zero out pros here. done by caller */
|
||||||
|
|
||||||
props->max_mtu = IB_MTU_4096;
|
props->max_mtu = IB_MTU_4096;
|
||||||
props->active_mtu = ib_mtu_int_to_enum(netdev->if_mtu);
|
props->active_mtu = ib_mtu_int_to_enum(if_getmtu(netdev));
|
||||||
props->lid = 1;
|
props->lid = 1;
|
||||||
props->lmc = 0;
|
props->lmc = 0;
|
||||||
props->sm_lid = 0;
|
props->sm_lid = 0;
|
||||||
props->sm_sl = 0;
|
props->sm_sl = 0;
|
||||||
if ((netdev->if_link_state == LINK_STATE_UP) && (netdev->if_drv_flags & IFF_DRV_RUNNING)) {
|
if ((if_getlinkstate(netdev) == LINK_STATE_UP) &&
|
||||||
|
(if_getdrvflags(netdev) & IFF_DRV_RUNNING)) {
|
||||||
props->state = IB_PORT_ACTIVE;
|
props->state = IB_PORT_ACTIVE;
|
||||||
props->phys_state = IB_PORT_PHYS_STATE_LINK_UP;
|
props->phys_state = IB_PORT_PHYS_STATE_LINK_UP;
|
||||||
} else {
|
} else {
|
||||||
@ -2274,7 +2276,7 @@ irdma_query_gid(struct ib_device *ibdev, u8 port, int index,
|
|||||||
struct irdma_device *iwdev = to_iwdev(ibdev);
|
struct irdma_device *iwdev = to_iwdev(ibdev);
|
||||||
|
|
||||||
memset(gid->raw, 0, sizeof(gid->raw));
|
memset(gid->raw, 0, sizeof(gid->raw));
|
||||||
ether_addr_copy(gid->raw, IF_LLADDR(iwdev->netdev));
|
ether_addr_copy(gid->raw, if_getlladdr(iwdev->netdev));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2349,13 +2351,13 @@ kc_set_rdma_uverbs_cmd_mask(struct irdma_device *iwdev)
|
|||||||
int
|
int
|
||||||
ib_get_eth_speed(struct ib_device *ibdev, u32 port_num, u8 *speed, u8 *width)
|
ib_get_eth_speed(struct ib_device *ibdev, u32 port_num, u8 *speed, u8 *width)
|
||||||
{
|
{
|
||||||
struct ifnet *netdev = ibdev->get_netdev(ibdev, port_num);
|
if_t netdev = ibdev->get_netdev(ibdev, port_num);
|
||||||
u32 netdev_speed;
|
u32 netdev_speed;
|
||||||
|
|
||||||
if (!netdev)
|
if (!netdev)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
netdev_speed = netdev->if_baudrate;
|
netdev_speed = if_getbaudrate(netdev);
|
||||||
dev_put(netdev);
|
dev_put(netdev);
|
||||||
if (netdev_speed <= SPEED_1000) {
|
if (netdev_speed <= SPEED_1000) {
|
||||||
*width = IB_WIDTH_1X;
|
*width = IB_WIDTH_1X;
|
||||||
|
@ -363,7 +363,7 @@ struct irdma_pci_f {
|
|||||||
struct irdma_device {
|
struct irdma_device {
|
||||||
struct ib_device ibdev;
|
struct ib_device ibdev;
|
||||||
struct irdma_pci_f *rf;
|
struct irdma_pci_f *rf;
|
||||||
struct ifnet *netdev;
|
if_t netdev;
|
||||||
struct notifier_block nb_netdevice_event;
|
struct notifier_block nb_netdevice_event;
|
||||||
struct irdma_handler *hdl;
|
struct irdma_handler *hdl;
|
||||||
struct workqueue_struct *cleanup_wq;
|
struct workqueue_struct *cleanup_wq;
|
||||||
@ -580,7 +580,7 @@ void irdma_gen_ae(struct irdma_pci_f *rf, struct irdma_sc_qp *qp,
|
|||||||
void irdma_copy_ip_ntohl(u32 *dst, __be32 *src);
|
void irdma_copy_ip_ntohl(u32 *dst, __be32 *src);
|
||||||
void irdma_copy_ip_htonl(__be32 *dst, u32 *src);
|
void irdma_copy_ip_htonl(__be32 *dst, u32 *src);
|
||||||
u16 irdma_get_vlan_ipv4(u32 *addr);
|
u16 irdma_get_vlan_ipv4(u32 *addr);
|
||||||
struct ifnet *irdma_netdev_vlan_ipv6(u32 *addr, u16 *vlan_id, u8 *mac);
|
if_t irdma_netdev_vlan_ipv6(u32 *addr, u16 *vlan_id, u8 *mac);
|
||||||
struct ib_mr *irdma_reg_phys_mr(struct ib_pd *ib_pd, u64 addr, u64 size,
|
struct ib_mr *irdma_reg_phys_mr(struct ib_pd *ib_pd, u64 addr, u64 size,
|
||||||
int acc, u64 *iova_start);
|
int acc, u64 *iova_start);
|
||||||
int irdma_upload_qp_context(struct irdma_qp *iwqp, bool freeze, bool raw);
|
int irdma_upload_qp_context(struct irdma_qp *iwqp, bool freeze, bool raw);
|
||||||
|
@ -56,7 +56,7 @@ irdma_query_device(struct ib_device *ibdev,
|
|||||||
|
|
||||||
memset(props, 0, sizeof(*props));
|
memset(props, 0, sizeof(*props));
|
||||||
addrconf_addr_eui48((u8 *)&props->sys_image_guid,
|
addrconf_addr_eui48((u8 *)&props->sys_image_guid,
|
||||||
IF_LLADDR(iwdev->netdev));
|
if_getlladdr(iwdev->netdev));
|
||||||
props->fw_ver = (u64)irdma_fw_major_ver(&rf->sc_dev) << 32 |
|
props->fw_ver = (u64)irdma_fw_major_ver(&rf->sc_dev) << 32 |
|
||||||
irdma_fw_minor_ver(&rf->sc_dev);
|
irdma_fw_minor_ver(&rf->sc_dev);
|
||||||
props->device_cap_flags = IB_DEVICE_MEM_WINDOW |
|
props->device_cap_flags = IB_DEVICE_MEM_WINDOW |
|
||||||
@ -737,7 +737,7 @@ irdma_roce_fill_and_set_qpctx_info(struct irdma_qp *iwqp,
|
|||||||
udp_info->src_port = 0xc000;
|
udp_info->src_port = 0xc000;
|
||||||
udp_info->dst_port = ROCE_V2_UDP_DPORT;
|
udp_info->dst_port = ROCE_V2_UDP_DPORT;
|
||||||
roce_info = &iwqp->roce_info;
|
roce_info = &iwqp->roce_info;
|
||||||
ether_addr_copy(roce_info->mac_addr, IF_LLADDR(iwdev->netdev));
|
ether_addr_copy(roce_info->mac_addr, if_getlladdr(iwdev->netdev));
|
||||||
|
|
||||||
roce_info->rd_en = true;
|
roce_info->rd_en = true;
|
||||||
roce_info->wr_rdresp_en = true;
|
roce_info->wr_rdresp_en = true;
|
||||||
@ -770,7 +770,7 @@ irdma_iw_fill_and_set_qpctx_info(struct irdma_qp *iwqp,
|
|||||||
struct irdma_iwarp_offload_info *iwarp_info;
|
struct irdma_iwarp_offload_info *iwarp_info;
|
||||||
|
|
||||||
iwarp_info = &iwqp->iwarp_info;
|
iwarp_info = &iwqp->iwarp_info;
|
||||||
ether_addr_copy(iwarp_info->mac_addr, IF_LLADDR(iwdev->netdev));
|
ether_addr_copy(iwarp_info->mac_addr, if_getlladdr(iwdev->netdev));
|
||||||
iwarp_info->rd_en = true;
|
iwarp_info->rd_en = true;
|
||||||
iwarp_info->wr_rdresp_en = true;
|
iwarp_info->wr_rdresp_en = true;
|
||||||
iwarp_info->bind_en = true;
|
iwarp_info->bind_en = true;
|
||||||
@ -3507,7 +3507,7 @@ irdma_query_ah(struct ib_ah *ibah, struct ib_ah_attr *ah_attr)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ifnet *
|
static if_t
|
||||||
irdma_get_netdev(struct ib_device *ibdev, u8 port_num)
|
irdma_get_netdev(struct ib_device *ibdev, u8 port_num)
|
||||||
{
|
{
|
||||||
struct irdma_device *iwdev = to_iwdev(ibdev);
|
struct irdma_device *iwdev = to_iwdev(ibdev);
|
||||||
@ -3627,7 +3627,7 @@ irdma_init_roce_device(struct irdma_device *iwdev)
|
|||||||
kc_set_roce_uverbs_cmd_mask(iwdev);
|
kc_set_roce_uverbs_cmd_mask(iwdev);
|
||||||
iwdev->ibdev.node_type = RDMA_NODE_IB_CA;
|
iwdev->ibdev.node_type = RDMA_NODE_IB_CA;
|
||||||
addrconf_addr_eui48((u8 *)&iwdev->ibdev.node_guid,
|
addrconf_addr_eui48((u8 *)&iwdev->ibdev.node_guid,
|
||||||
IF_LLADDR(iwdev->netdev));
|
if_getlladdr(iwdev->netdev));
|
||||||
irdma_set_device_roce_ops(&iwdev->ibdev);
|
irdma_set_device_roce_ops(&iwdev->ibdev);
|
||||||
if (iwdev->rf->rdma_ver == IRDMA_GEN_2)
|
if (iwdev->rf->rdma_ver == IRDMA_GEN_2)
|
||||||
irdma_set_device_mcast_ops(&iwdev->ibdev);
|
irdma_set_device_mcast_ops(&iwdev->ibdev);
|
||||||
@ -3640,11 +3640,11 @@ irdma_init_roce_device(struct irdma_device *iwdev)
|
|||||||
static int
|
static int
|
||||||
irdma_init_iw_device(struct irdma_device *iwdev)
|
irdma_init_iw_device(struct irdma_device *iwdev)
|
||||||
{
|
{
|
||||||
struct ifnet *netdev = iwdev->netdev;
|
if_t netdev = iwdev->netdev;
|
||||||
|
|
||||||
iwdev->ibdev.node_type = RDMA_NODE_RNIC;
|
iwdev->ibdev.node_type = RDMA_NODE_RNIC;
|
||||||
addrconf_addr_eui48((u8 *)&iwdev->ibdev.node_guid,
|
addrconf_addr_eui48((u8 *)&iwdev->ibdev.node_guid,
|
||||||
IF_LLADDR(netdev));
|
if_getlladdr(netdev));
|
||||||
iwdev->ibdev.iwcm = kzalloc(sizeof(*iwdev->ibdev.iwcm), GFP_KERNEL);
|
iwdev->ibdev.iwcm = kzalloc(sizeof(*iwdev->ibdev.iwcm), GFP_KERNEL);
|
||||||
if (!iwdev->ibdev.iwcm)
|
if (!iwdev->ibdev.iwcm)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
Loading…
Reference in New Issue
Block a user