diff options
| author | Roland Dreier <roland@purestorage.com> | 2014-01-23 02:24:21 -0500 |
|---|---|---|
| committer | Roland Dreier <roland@purestorage.com> | 2014-01-23 02:24:21 -0500 |
| commit | fb1b5034e4987b158179a62732fb6dfb8f7ec88e (patch) | |
| tree | 93d02ff7f0f530286fd54d03b632c6eaabc9dcc9 /include | |
| parent | 8f399921ea9a562bc8221258c4b8a7bd69577939 (diff) | |
| parent | 27cdef637c25705b433d5c4deeef4cf8dcb75d6a (diff) | |
Merge branch 'ip-roce' into for-next
Conflicts:
drivers/infiniband/hw/mlx4/main.c
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/mlx4/cq.h | 15 | ||||
| -rw-r--r-- | include/linux/mlx4/device.h | 1 | ||||
| -rw-r--r-- | include/rdma/ib_addr.h | 69 | ||||
| -rw-r--r-- | include/rdma/ib_cm.h | 1 | ||||
| -rw-r--r-- | include/rdma/ib_pack.h | 1 | ||||
| -rw-r--r-- | include/rdma/ib_sa.h | 3 | ||||
| -rw-r--r-- | include/rdma/ib_verbs.h | 21 |
7 files changed, 85 insertions, 26 deletions
diff --git a/include/linux/mlx4/cq.h b/include/linux/mlx4/cq.h index 98fa492cf406..e1862997f933 100644 --- a/include/linux/mlx4/cq.h +++ b/include/linux/mlx4/cq.h | |||
| @@ -34,6 +34,7 @@ | |||
| 34 | #define MLX4_CQ_H | 34 | #define MLX4_CQ_H |
| 35 | 35 | ||
| 36 | #include <linux/types.h> | 36 | #include <linux/types.h> |
| 37 | #include <uapi/linux/if_ether.h> | ||
| 37 | 38 | ||
| 38 | #include <linux/mlx4/device.h> | 39 | #include <linux/mlx4/device.h> |
| 39 | #include <linux/mlx4/doorbell.h> | 40 | #include <linux/mlx4/doorbell.h> |
| @@ -43,10 +44,15 @@ struct mlx4_cqe { | |||
| 43 | __be32 immed_rss_invalid; | 44 | __be32 immed_rss_invalid; |
| 44 | __be32 g_mlpath_rqpn; | 45 | __be32 g_mlpath_rqpn; |
| 45 | __be16 sl_vid; | 46 | __be16 sl_vid; |
| 46 | __be16 rlid; | 47 | union { |
| 47 | __be16 status; | 48 | struct { |
| 48 | u8 ipv6_ext_mask; | 49 | __be16 rlid; |
| 49 | u8 badfcs_enc; | 50 | __be16 status; |
| 51 | u8 ipv6_ext_mask; | ||
| 52 | u8 badfcs_enc; | ||
| 53 | }; | ||
| 54 | u8 smac[ETH_ALEN]; | ||
| 55 | }; | ||
| 50 | __be32 byte_cnt; | 56 | __be32 byte_cnt; |
| 51 | __be16 wqe_index; | 57 | __be16 wqe_index; |
| 52 | __be16 checksum; | 58 | __be16 checksum; |
| @@ -83,6 +89,7 @@ struct mlx4_ts_cqe { | |||
| 83 | enum { | 89 | enum { |
| 84 | MLX4_CQE_VLAN_PRESENT_MASK = 1 << 29, | 90 | MLX4_CQE_VLAN_PRESENT_MASK = 1 << 29, |
| 85 | MLX4_CQE_QPN_MASK = 0xffffff, | 91 | MLX4_CQE_QPN_MASK = 0xffffff, |
| 92 | MLX4_CQE_VID_MASK = 0xfff, | ||
| 86 | }; | 93 | }; |
| 87 | 94 | ||
| 88 | enum { | 95 | enum { |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index 7de9fde3a9dd..ac5cb1d92487 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
| @@ -1096,6 +1096,7 @@ int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn, | |||
| 1096 | int mlx4_SET_PORT_PRIO2TC(struct mlx4_dev *dev, u8 port, u8 *prio2tc); | 1096 | int mlx4_SET_PORT_PRIO2TC(struct mlx4_dev *dev, u8 port, u8 *prio2tc); |
| 1097 | int mlx4_SET_PORT_SCHEDULER(struct mlx4_dev *dev, u8 port, u8 *tc_tx_bw, | 1097 | int mlx4_SET_PORT_SCHEDULER(struct mlx4_dev *dev, u8 port, u8 *tc_tx_bw, |
| 1098 | u8 *pg, u16 *ratelimit); | 1098 | u8 *pg, u16 *ratelimit); |
| 1099 | int mlx4_find_cached_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *idx); | ||
| 1099 | int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); | 1100 | int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); |
| 1100 | int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); | 1101 | int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); |
| 1101 | void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, u16 vlan); | 1102 | void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, u16 vlan); |
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h index f3ac0f2c4c66..ce55906b54a0 100644 --- a/include/rdma/ib_addr.h +++ b/include/rdma/ib_addr.h | |||
| @@ -38,10 +38,15 @@ | |||
| 38 | #include <linux/in6.h> | 38 | #include <linux/in6.h> |
| 39 | #include <linux/if_arp.h> | 39 | #include <linux/if_arp.h> |
| 40 | #include <linux/netdevice.h> | 40 | #include <linux/netdevice.h> |
| 41 | #include <linux/inetdevice.h> | ||
| 41 | #include <linux/socket.h> | 42 | #include <linux/socket.h> |
| 42 | #include <linux/if_vlan.h> | 43 | #include <linux/if_vlan.h> |
| 44 | #include <net/ipv6.h> | ||
| 45 | #include <net/if_inet6.h> | ||
| 46 | #include <net/ip.h> | ||
| 43 | #include <rdma/ib_verbs.h> | 47 | #include <rdma/ib_verbs.h> |
| 44 | #include <rdma/ib_pack.h> | 48 | #include <rdma/ib_pack.h> |
| 49 | #include <net/ipv6.h> | ||
| 45 | 50 | ||
| 46 | struct rdma_addr_client { | 51 | struct rdma_addr_client { |
| 47 | atomic_t refcount; | 52 | atomic_t refcount; |
| @@ -72,7 +77,8 @@ struct rdma_dev_addr { | |||
| 72 | * rdma_translate_ip - Translate a local IP address to an RDMA hardware | 77 | * rdma_translate_ip - Translate a local IP address to an RDMA hardware |
| 73 | * address. | 78 | * address. |
| 74 | */ | 79 | */ |
| 75 | int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr); | 80 | int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr, |
| 81 | u16 *vlan_id); | ||
| 76 | 82 | ||
| 77 | /** | 83 | /** |
| 78 | * rdma_resolve_ip - Resolve source and destination IP addresses to | 84 | * rdma_resolve_ip - Resolve source and destination IP addresses to |
| @@ -104,6 +110,10 @@ int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev, | |||
| 104 | 110 | ||
| 105 | int rdma_addr_size(struct sockaddr *addr); | 111 | int rdma_addr_size(struct sockaddr *addr); |
| 106 | 112 | ||
| 113 | int rdma_addr_find_smac_by_sgid(union ib_gid *sgid, u8 *smac, u16 *vlan_id); | ||
| 114 | int rdma_addr_find_dmac_by_grh(union ib_gid *sgid, union ib_gid *dgid, u8 *smac, | ||
| 115 | u16 *vlan_id); | ||
| 116 | |||
| 107 | static inline u16 ib_addr_get_pkey(struct rdma_dev_addr *dev_addr) | 117 | static inline u16 ib_addr_get_pkey(struct rdma_dev_addr *dev_addr) |
| 108 | { | 118 | { |
| 109 | return ((u16)dev_addr->broadcast[8] << 8) | (u16)dev_addr->broadcast[9]; | 119 | return ((u16)dev_addr->broadcast[8] << 8) | (u16)dev_addr->broadcast[9]; |
| @@ -126,41 +136,60 @@ static inline int rdma_addr_gid_offset(struct rdma_dev_addr *dev_addr) | |||
| 126 | return dev_addr->dev_type == ARPHRD_INFINIBAND ? 4 : 0; | 136 | return dev_addr->dev_type == ARPHRD_INFINIBAND ? 4 : 0; |
| 127 | } | 137 | } |
| 128 | 138 | ||
| 129 | static inline void iboe_mac_vlan_to_ll(union ib_gid *gid, u8 *mac, u16 vid) | 139 | static inline u16 rdma_vlan_dev_vlan_id(const struct net_device *dev) |
| 130 | { | 140 | { |
| 131 | memset(gid->raw, 0, 16); | 141 | return dev->priv_flags & IFF_802_1Q_VLAN ? |
| 132 | *((__be32 *) gid->raw) = cpu_to_be32(0xfe800000); | 142 | vlan_dev_vlan_id(dev) : 0xffff; |
| 133 | if (vid < 0x1000) { | 143 | } |
| 134 | gid->raw[12] = vid & 0xff; | 144 | |
| 135 | gid->raw[11] = vid >> 8; | 145 | static inline int rdma_ip2gid(struct sockaddr *addr, union ib_gid *gid) |
| 136 | } else { | 146 | { |
| 137 | gid->raw[12] = 0xfe; | 147 | switch (addr->sa_family) { |
| 138 | gid->raw[11] = 0xff; | 148 | case AF_INET: |
| 149 | ipv6_addr_set_v4mapped(((struct sockaddr_in *) | ||
| 150 | addr)->sin_addr.s_addr, | ||
| 151 | (struct in6_addr *)gid); | ||
| 152 | break; | ||
| 153 | case AF_INET6: | ||
| 154 | memcpy(gid->raw, &((struct sockaddr_in6 *)addr)->sin6_addr, 16); | ||
| 155 | break; | ||
| 156 | default: | ||
| 157 | return -EINVAL; | ||
| 139 | } | 158 | } |
| 140 | memcpy(gid->raw + 13, mac + 3, 3); | 159 | return 0; |
| 141 | memcpy(gid->raw + 8, mac, 3); | ||
| 142 | gid->raw[8] ^= 2; | ||
| 143 | } | 160 | } |
| 144 | 161 | ||
| 145 | static inline u16 rdma_vlan_dev_vlan_id(const struct net_device *dev) | 162 | /* Important - sockaddr should be a union of sockaddr_in and sockaddr_in6 */ |
| 163 | static inline int rdma_gid2ip(struct sockaddr *out, union ib_gid *gid) | ||
| 146 | { | 164 | { |
| 147 | return dev->priv_flags & IFF_802_1Q_VLAN ? | 165 | if (ipv6_addr_v4mapped((struct in6_addr *)gid)) { |
| 148 | vlan_dev_vlan_id(dev) : 0xffff; | 166 | struct sockaddr_in *out_in = (struct sockaddr_in *)out; |
| 167 | memset(out_in, 0, sizeof(*out_in)); | ||
| 168 | out_in->sin_family = AF_INET; | ||
| 169 | memcpy(&out_in->sin_addr.s_addr, gid->raw + 12, 4); | ||
| 170 | } else { | ||
| 171 | struct sockaddr_in6 *out_in = (struct sockaddr_in6 *)out; | ||
| 172 | memset(out_in, 0, sizeof(*out_in)); | ||
| 173 | out_in->sin6_family = AF_INET6; | ||
| 174 | memcpy(&out_in->sin6_addr.s6_addr, gid->raw, 16); | ||
| 175 | } | ||
| 176 | return 0; | ||
| 149 | } | 177 | } |
| 150 | 178 | ||
| 151 | static inline void iboe_addr_get_sgid(struct rdma_dev_addr *dev_addr, | 179 | static inline void iboe_addr_get_sgid(struct rdma_dev_addr *dev_addr, |
| 152 | union ib_gid *gid) | 180 | union ib_gid *gid) |
| 153 | { | 181 | { |
| 154 | struct net_device *dev; | 182 | struct net_device *dev; |
| 155 | u16 vid = 0xffff; | 183 | struct in_device *ip4; |
| 156 | 184 | ||
| 157 | dev = dev_get_by_index(&init_net, dev_addr->bound_dev_if); | 185 | dev = dev_get_by_index(&init_net, dev_addr->bound_dev_if); |
| 158 | if (dev) { | 186 | if (dev) { |
| 159 | vid = rdma_vlan_dev_vlan_id(dev); | 187 | ip4 = (struct in_device *)dev->ip_ptr; |
| 188 | if (ip4 && ip4->ifa_list && ip4->ifa_list->ifa_address) | ||
| 189 | ipv6_addr_set_v4mapped(ip4->ifa_list->ifa_address, | ||
| 190 | (struct in6_addr *)gid); | ||
| 160 | dev_put(dev); | 191 | dev_put(dev); |
| 161 | } | 192 | } |
| 162 | |||
| 163 | iboe_mac_vlan_to_ll(gid, dev_addr->src_dev_addr, vid); | ||
| 164 | } | 193 | } |
| 165 | 194 | ||
| 166 | static inline void rdma_addr_get_sgid(struct rdma_dev_addr *dev_addr, union ib_gid *gid) | 195 | static inline void rdma_addr_get_sgid(struct rdma_dev_addr *dev_addr, union ib_gid *gid) |
diff --git a/include/rdma/ib_cm.h b/include/rdma/ib_cm.h index 0e3ff30647d5..f29e3a27c2cc 100644 --- a/include/rdma/ib_cm.h +++ b/include/rdma/ib_cm.h | |||
| @@ -601,4 +601,5 @@ struct ib_cm_sidr_rep_param { | |||
| 601 | int ib_send_cm_sidr_rep(struct ib_cm_id *cm_id, | 601 | int ib_send_cm_sidr_rep(struct ib_cm_id *cm_id, |
| 602 | struct ib_cm_sidr_rep_param *param); | 602 | struct ib_cm_sidr_rep_param *param); |
| 603 | 603 | ||
| 604 | int ib_update_cm_av(struct ib_cm_id *id, const u8 *smac, const u8 *alt_smac); | ||
| 604 | #endif /* IB_CM_H */ | 605 | #endif /* IB_CM_H */ |
diff --git a/include/rdma/ib_pack.h b/include/rdma/ib_pack.h index b37fe3b10a9d..b1f7592e02e4 100644 --- a/include/rdma/ib_pack.h +++ b/include/rdma/ib_pack.h | |||
| @@ -34,6 +34,7 @@ | |||
| 34 | #define IB_PACK_H | 34 | #define IB_PACK_H |
| 35 | 35 | ||
| 36 | #include <rdma/ib_verbs.h> | 36 | #include <rdma/ib_verbs.h> |
| 37 | #include <uapi/linux/if_ether.h> | ||
| 37 | 38 | ||
| 38 | enum { | 39 | enum { |
| 39 | IB_LRH_BYTES = 8, | 40 | IB_LRH_BYTES = 8, |
diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h index 125f8714301d..7e071a6abb34 100644 --- a/include/rdma/ib_sa.h +++ b/include/rdma/ib_sa.h | |||
| @@ -154,6 +154,9 @@ struct ib_sa_path_rec { | |||
| 154 | u8 packet_life_time_selector; | 154 | u8 packet_life_time_selector; |
| 155 | u8 packet_life_time; | 155 | u8 packet_life_time; |
| 156 | u8 preference; | 156 | u8 preference; |
| 157 | u8 smac[ETH_ALEN]; | ||
| 158 | u8 dmac[ETH_ALEN]; | ||
| 159 | u16 vlan_id; | ||
| 157 | }; | 160 | }; |
| 158 | 161 | ||
| 159 | #define IB_SA_MCMEMBER_REC_MGID IB_SA_COMP_MASK( 0) | 162 | #define IB_SA_MCMEMBER_REC_MGID IB_SA_COMP_MASK( 0) |
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index c6d343078617..8d4a1c06f7e4 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h | |||
| @@ -48,6 +48,7 @@ | |||
| 48 | #include <linux/rwsem.h> | 48 | #include <linux/rwsem.h> |
| 49 | #include <linux/scatterlist.h> | 49 | #include <linux/scatterlist.h> |
| 50 | #include <linux/workqueue.h> | 50 | #include <linux/workqueue.h> |
| 51 | #include <uapi/linux/if_ether.h> | ||
| 51 | 52 | ||
| 52 | #include <linux/atomic.h> | 53 | #include <linux/atomic.h> |
| 53 | #include <asm/uaccess.h> | 54 | #include <asm/uaccess.h> |
| @@ -474,6 +475,8 @@ struct ib_ah_attr { | |||
| 474 | u8 static_rate; | 475 | u8 static_rate; |
| 475 | u8 ah_flags; | 476 | u8 ah_flags; |
| 476 | u8 port_num; | 477 | u8 port_num; |
| 478 | u8 dmac[ETH_ALEN]; | ||
| 479 | u16 vlan_id; | ||
| 477 | }; | 480 | }; |
| 478 | 481 | ||
| 479 | enum ib_wc_status { | 482 | enum ib_wc_status { |
| @@ -526,6 +529,8 @@ enum ib_wc_flags { | |||
| 526 | IB_WC_WITH_IMM = (1<<1), | 529 | IB_WC_WITH_IMM = (1<<1), |
| 527 | IB_WC_WITH_INVALIDATE = (1<<2), | 530 | IB_WC_WITH_INVALIDATE = (1<<2), |
| 528 | IB_WC_IP_CSUM_OK = (1<<3), | 531 | IB_WC_IP_CSUM_OK = (1<<3), |
| 532 | IB_WC_WITH_SMAC = (1<<4), | ||
| 533 | IB_WC_WITH_VLAN = (1<<5), | ||
| 529 | }; | 534 | }; |
| 530 | 535 | ||
| 531 | struct ib_wc { | 536 | struct ib_wc { |
| @@ -546,6 +551,8 @@ struct ib_wc { | |||
| 546 | u8 sl; | 551 | u8 sl; |
| 547 | u8 dlid_path_bits; | 552 | u8 dlid_path_bits; |
| 548 | u8 port_num; /* valid only for DR SMPs on switches */ | 553 | u8 port_num; /* valid only for DR SMPs on switches */ |
| 554 | u8 smac[ETH_ALEN]; | ||
| 555 | u16 vlan_id; | ||
| 549 | }; | 556 | }; |
| 550 | 557 | ||
| 551 | enum ib_cq_notify_flags { | 558 | enum ib_cq_notify_flags { |
| @@ -724,7 +731,11 @@ enum ib_qp_attr_mask { | |||
| 724 | IB_QP_MAX_DEST_RD_ATOMIC = (1<<17), | 731 | IB_QP_MAX_DEST_RD_ATOMIC = (1<<17), |
| 725 | IB_QP_PATH_MIG_STATE = (1<<18), | 732 | IB_QP_PATH_MIG_STATE = (1<<18), |
| 726 | IB_QP_CAP = (1<<19), | 733 | IB_QP_CAP = (1<<19), |
| 727 | IB_QP_DEST_QPN = (1<<20) | 734 | IB_QP_DEST_QPN = (1<<20), |
| 735 | IB_QP_SMAC = (1<<21), | ||
| 736 | IB_QP_ALT_SMAC = (1<<22), | ||
| 737 | IB_QP_VID = (1<<23), | ||
| 738 | IB_QP_ALT_VID = (1<<24), | ||
| 728 | }; | 739 | }; |
| 729 | 740 | ||
| 730 | enum ib_qp_state { | 741 | enum ib_qp_state { |
| @@ -774,6 +785,10 @@ struct ib_qp_attr { | |||
| 774 | u8 rnr_retry; | 785 | u8 rnr_retry; |
| 775 | u8 alt_port_num; | 786 | u8 alt_port_num; |
| 776 | u8 alt_timeout; | 787 | u8 alt_timeout; |
| 788 | u8 smac[ETH_ALEN]; | ||
| 789 | u8 alt_smac[ETH_ALEN]; | ||
| 790 | u16 vlan_id; | ||
| 791 | u16 alt_vlan_id; | ||
| 777 | }; | 792 | }; |
| 778 | 793 | ||
| 779 | enum ib_wr_opcode { | 794 | enum ib_wr_opcode { |
| @@ -1505,6 +1520,7 @@ static inline int ib_copy_to_udata(struct ib_udata *udata, void *src, size_t len | |||
| 1505 | * @next_state: Next QP state | 1520 | * @next_state: Next QP state |
| 1506 | * @type: QP type | 1521 | * @type: QP type |
| 1507 | * @mask: Mask of supplied QP attributes | 1522 | * @mask: Mask of supplied QP attributes |
| 1523 | * @ll : link layer of port | ||
| 1508 | * | 1524 | * |
| 1509 | * This function is a helper function that a low-level driver's | 1525 | * This function is a helper function that a low-level driver's |
| 1510 | * modify_qp method can use to validate the consumer's input. It | 1526 | * modify_qp method can use to validate the consumer's input. It |
| @@ -1513,7 +1529,8 @@ static inline int ib_copy_to_udata(struct ib_udata *udata, void *src, size_t len | |||
| 1513 | * and that the attribute mask supplied is allowed for the transition. | 1529 | * and that the attribute mask supplied is allowed for the transition. |
| 1514 | */ | 1530 | */ |
| 1515 | int ib_modify_qp_is_ok(enum ib_qp_state cur_state, enum ib_qp_state next_state, | 1531 | int ib_modify_qp_is_ok(enum ib_qp_state cur_state, enum ib_qp_state next_state, |
| 1516 | enum ib_qp_type type, enum ib_qp_attr_mask mask); | 1532 | enum ib_qp_type type, enum ib_qp_attr_mask mask, |
| 1533 | enum rdma_link_layer ll); | ||
| 1517 | 1534 | ||
| 1518 | int ib_register_event_handler (struct ib_event_handler *event_handler); | 1535 | int ib_register_event_handler (struct ib_event_handler *event_handler); |
| 1519 | int ib_unregister_event_handler(struct ib_event_handler *event_handler); | 1536 | int ib_unregister_event_handler(struct ib_event_handler *event_handler); |
