Skip to content

Commit

Permalink
RDMA/rxe: Move the definitions for rxe_av.network_type to uAPI
Browse files Browse the repository at this point in the history
RXE was wrongly using an internal kernel enum as part of its uAPI, split
this out into a dedicated uAPI enum just for RXE. It only uses the IPv4
and IPv6 values.

This was exposed by changing the internal kernel enum definition which
broke RXE.

Fixes: 1c15b4f ("RDMA/core: Modify enum ib_gid_type and enum rdma_network_type")
Signed-off-by: Jason Gunthorpe <[email protected]>
  • Loading branch information
jgunthorpe committed Oct 16, 2020
1 parent e0477b3 commit e0d696d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/infiniband/sw/rxe/rxe_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,14 @@ static struct dst_entry *rxe_find_route(struct net_device *ndev,
if (dst)
dst_release(dst);

if (av->network_type == RDMA_NETWORK_IPV4) {
if (av->network_type == RXE_NETWORK_TYPE_IPV4) {
struct in_addr *saddr;
struct in_addr *daddr;

saddr = &av->sgid_addr._sockaddr_in.sin_addr;
daddr = &av->dgid_addr._sockaddr_in.sin_addr;
dst = rxe_find_route4(ndev, saddr, daddr);
} else if (av->network_type == RDMA_NETWORK_IPV6) {
} else if (av->network_type == RXE_NETWORK_TYPE_IPV6) {
struct in6_addr *saddr6;
struct in6_addr *daddr6;

Expand Down Expand Up @@ -442,7 +442,7 @@ struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,
if (IS_ERR(attr))
return NULL;

if (av->network_type == RDMA_NETWORK_IPV4)
if (av->network_type == RXE_NETWORK_TYPE_IPV6)
hdr_len = ETH_HLEN + sizeof(struct udphdr) +
sizeof(struct iphdr);
else
Expand All @@ -469,7 +469,7 @@ struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,
skb->dev = ndev;
rcu_read_unlock();

if (av->network_type == RDMA_NETWORK_IPV4)
if (av->network_type == RXE_NETWORK_TYPE_IPV4)
skb->protocol = htons(ETH_P_IP);
else
skb->protocol = htons(ETH_P_IPV6);
Expand Down
6 changes: 6 additions & 0 deletions include/uapi/rdma/rdma_user_rxe.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
#include <linux/in.h>
#include <linux/in6.h>

enum {
RXE_NETWORK_TYPE_IPV4 = 1,
RXE_NETWORK_TYPE_IPV6 = 2,
};

union rxe_gid {
__u8 raw[16];
struct {
Expand All @@ -57,6 +62,7 @@ struct rxe_global_route {

struct rxe_av {
__u8 port_num;
/* From RXE_NETWORK_TYPE_* */
__u8 network_type;
__u8 dmac[6];
struct rxe_global_route grh;
Expand Down

0 comments on commit e0d696d

Please sign in to comment.