aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorParav Pandit <parav@mellanox.com>2018-04-01 08:08:24 -0400
committerJason Gunthorpe <jgg@mellanox.com>2018-04-03 23:34:16 -0400
commit414448d249d82c9be93b35e61e0303e84ef2f959 (patch)
treee9d417bc1511726395c4171380e16be804999d96
parent3e44e0ee0893cbea257e585dbd4c7d2ff00f1a6b (diff)
RDMA: Use ib_gid_attr during GID modification
Now that ib_gid_attr contains device, port and index, simplify the provider APIs add_gid() and del_gid() to use device, port and index fields from the ib_gid_attr attributes structure. Signed-off-by: Parav Pandit <parav@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
-rw-r--r--drivers/infiniband/core/cache.c5
-rw-r--r--drivers/infiniband/hw/bnxt_re/ib_verbs.c10
-rw-r--r--drivers/infiniband/hw/bnxt_re/ib_verbs.h6
-rw-r--r--drivers/infiniband/hw/hns/hns_roce_main.c20
-rw-r--r--drivers/infiniband/hw/mlx4/main.c30
-rw-r--r--drivers/infiniband/hw/mlx5/main.c13
-rw-r--r--drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c31
-rw-r--r--drivers/infiniband/sw/rxe/rxe_verbs.c10
-rw-r--r--include/rdma/ib_verbs.h33
9 files changed, 63 insertions, 95 deletions
diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c
index 045ca11fa135..e337b08de2ff 100644
--- a/drivers/infiniband/core/cache.c
+++ b/drivers/infiniband/core/cache.c
@@ -157,7 +157,7 @@ static void del_roce_gid(struct ib_device *device, u8 port_num,
157 table->data_vec[ix].gid.raw); 157 table->data_vec[ix].gid.raw);
158 158
159 if (rdma_cap_roce_gid_table(device, port_num)) 159 if (rdma_cap_roce_gid_table(device, port_num))
160 device->del_gid(device, port_num, ix, 160 device->del_gid(&table->data_vec[ix].attr,
161 &table->data_vec[ix].context); 161 &table->data_vec[ix].context);
162 dev_put(table->data_vec[ix].attr.ndev); 162 dev_put(table->data_vec[ix].attr.ndev);
163} 163}
@@ -186,8 +186,7 @@ static int add_roce_gid(struct ib_gid_table *table,
186 } 186 }
187 187
188 if (rdma_cap_roce_gid_table(attr->device, attr->port_num)) { 188 if (rdma_cap_roce_gid_table(attr->device, attr->port_num)) {
189 ret = attr->device->add_gid(attr->device, attr->port_num, 189 ret = attr->device->add_gid(gid, attr, &entry->context);
190 ix, gid, attr, &entry->context);
191 if (ret) { 190 if (ret) {
192 pr_err("%s GID add failed device=%s port=%d index=%d\n", 191 pr_err("%s GID add failed device=%s port=%d index=%d\n",
193 __func__, attr->device->name, attr->port_num, 192 __func__, attr->device->name, attr->port_num,
diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
index 63a0e08dd6fe..a76e206704d4 100644
--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
+++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
@@ -314,12 +314,11 @@ int bnxt_re_query_gid(struct ib_device *ibdev, u8 port_num,
314 return rc; 314 return rc;
315} 315}
316 316
317int bnxt_re_del_gid(struct ib_device *ibdev, u8 port_num, 317int bnxt_re_del_gid(const struct ib_gid_attr *attr, void **context)
318 unsigned int index, void **context)
319{ 318{
320 int rc = 0; 319 int rc = 0;
321 struct bnxt_re_gid_ctx *ctx, **ctx_tbl; 320 struct bnxt_re_gid_ctx *ctx, **ctx_tbl;
322 struct bnxt_re_dev *rdev = to_bnxt_re_dev(ibdev, ibdev); 321 struct bnxt_re_dev *rdev = to_bnxt_re_dev(attr->device, ibdev);
323 struct bnxt_qplib_sgid_tbl *sgid_tbl = &rdev->qplib_res.sgid_tbl; 322 struct bnxt_qplib_sgid_tbl *sgid_tbl = &rdev->qplib_res.sgid_tbl;
324 struct bnxt_qplib_gid *gid_to_del; 323 struct bnxt_qplib_gid *gid_to_del;
325 324
@@ -365,15 +364,14 @@ int bnxt_re_del_gid(struct ib_device *ibdev, u8 port_num,
365 return rc; 364 return rc;
366} 365}
367 366
368int bnxt_re_add_gid(struct ib_device *ibdev, u8 port_num, 367int bnxt_re_add_gid(const union ib_gid *gid,
369 unsigned int index, const union ib_gid *gid,
370 const struct ib_gid_attr *attr, void **context) 368 const struct ib_gid_attr *attr, void **context)
371{ 369{
372 int rc; 370 int rc;
373 u32 tbl_idx = 0; 371 u32 tbl_idx = 0;
374 u16 vlan_id = 0xFFFF; 372 u16 vlan_id = 0xFFFF;
375 struct bnxt_re_gid_ctx *ctx, **ctx_tbl; 373 struct bnxt_re_gid_ctx *ctx, **ctx_tbl;
376 struct bnxt_re_dev *rdev = to_bnxt_re_dev(ibdev, ibdev); 374 struct bnxt_re_dev *rdev = to_bnxt_re_dev(attr->device, ibdev);
377 struct bnxt_qplib_sgid_tbl *sgid_tbl = &rdev->qplib_res.sgid_tbl; 375 struct bnxt_qplib_sgid_tbl *sgid_tbl = &rdev->qplib_res.sgid_tbl;
378 376
379 if ((attr->ndev) && is_vlan_dev(attr->ndev)) 377 if ((attr->ndev) && is_vlan_dev(attr->ndev))
diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.h b/drivers/infiniband/hw/bnxt_re/ib_verbs.h
index e62b7c2c7da6..5c6414cad4af 100644
--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.h
+++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.h
@@ -157,10 +157,8 @@ int bnxt_re_get_port_immutable(struct ib_device *ibdev, u8 port_num,
157void bnxt_re_query_fw_str(struct ib_device *ibdev, char *str); 157void bnxt_re_query_fw_str(struct ib_device *ibdev, char *str);
158int bnxt_re_query_pkey(struct ib_device *ibdev, u8 port_num, 158int bnxt_re_query_pkey(struct ib_device *ibdev, u8 port_num,
159 u16 index, u16 *pkey); 159 u16 index, u16 *pkey);
160int bnxt_re_del_gid(struct ib_device *ibdev, u8 port_num, 160int bnxt_re_del_gid(const struct ib_gid_attr *attr, void **context);
161 unsigned int index, void **context); 161int bnxt_re_add_gid(const union ib_gid *gid,
162int bnxt_re_add_gid(struct ib_device *ibdev, u8 port_num,
163 unsigned int index, const union ib_gid *gid,
164 const struct ib_gid_attr *attr, void **context); 162 const struct ib_gid_attr *attr, void **context);
165int bnxt_re_query_gid(struct ib_device *ibdev, u8 port_num, 163int bnxt_re_query_gid(struct ib_device *ibdev, u8 port_num,
166 int index, union ib_gid *gid); 164 int index, union ib_gid *gid);
diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
index 76e2e5b41895..9d48bc07a9e6 100644
--- a/drivers/infiniband/hw/hns/hns_roce_main.c
+++ b/drivers/infiniband/hw/hns/hns_roce_main.c
@@ -74,12 +74,11 @@ static int hns_roce_set_mac(struct hns_roce_dev *hr_dev, u8 port, u8 *addr)
74 return hr_dev->hw->set_mac(hr_dev, phy_port, addr); 74 return hr_dev->hw->set_mac(hr_dev, phy_port, addr);
75} 75}
76 76
77static int hns_roce_add_gid(struct ib_device *device, u8 port_num, 77static int hns_roce_add_gid(const union ib_gid *gid,
78 unsigned int index, const union ib_gid *gid,
79 const struct ib_gid_attr *attr, void **context) 78 const struct ib_gid_attr *attr, void **context)
80{ 79{
81 struct hns_roce_dev *hr_dev = to_hr_dev(device); 80 struct hns_roce_dev *hr_dev = to_hr_dev(attr->device);
82 u8 port = port_num - 1; 81 u8 port = attr->port_num - 1;
83 unsigned long flags; 82 unsigned long flags;
84 int ret; 83 int ret;
85 84
@@ -88,21 +87,20 @@ static int hns_roce_add_gid(struct ib_device *device, u8 port_num,
88 87
89 spin_lock_irqsave(&hr_dev->iboe.lock, flags); 88 spin_lock_irqsave(&hr_dev->iboe.lock, flags);
90 89
91 ret = hr_dev->hw->set_gid(hr_dev, port, index, (union ib_gid *)gid, 90 ret = hr_dev->hw->set_gid(hr_dev, port, attr->index,
92 attr); 91 (union ib_gid *)gid, attr);
93 92
94 spin_unlock_irqrestore(&hr_dev->iboe.lock, flags); 93 spin_unlock_irqrestore(&hr_dev->iboe.lock, flags);
95 94
96 return ret; 95 return ret;
97} 96}
98 97
99static int hns_roce_del_gid(struct ib_device *device, u8 port_num, 98static int hns_roce_del_gid(const struct ib_gid_attr *attr, void **context)
100 unsigned int index, void **context)
101{ 99{
102 struct hns_roce_dev *hr_dev = to_hr_dev(device); 100 struct hns_roce_dev *hr_dev = to_hr_dev(attr->device);
103 struct ib_gid_attr zattr = { }; 101 struct ib_gid_attr zattr = { };
104 union ib_gid zgid = { {0} }; 102 union ib_gid zgid = { {0} };
105 u8 port = port_num - 1; 103 u8 port = attr->port_num - 1;
106 unsigned long flags; 104 unsigned long flags;
107 int ret; 105 int ret;
108 106
@@ -111,7 +109,7 @@ static int hns_roce_del_gid(struct ib_device *device, u8 port_num,
111 109
112 spin_lock_irqsave(&hr_dev->iboe.lock, flags); 110 spin_lock_irqsave(&hr_dev->iboe.lock, flags);
113 111
114 ret = hr_dev->hw->set_gid(hr_dev, port, index, &zgid, &zattr); 112 ret = hr_dev->hw->set_gid(hr_dev, port, attr->index, &zgid, &zattr);
115 113
116 spin_unlock_irqrestore(&hr_dev->iboe.lock, flags); 114 spin_unlock_irqrestore(&hr_dev->iboe.lock, flags);
117 115
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index a31a3edfbf28..8eca09b53fe8 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -246,14 +246,11 @@ static int mlx4_ib_update_gids(struct gid_entry *gids,
246 return mlx4_ib_update_gids_v1(gids, ibdev, port_num); 246 return mlx4_ib_update_gids_v1(gids, ibdev, port_num);
247} 247}
248 248
249static int mlx4_ib_add_gid(struct ib_device *device, 249static int mlx4_ib_add_gid(const union ib_gid *gid,
250 u8 port_num,
251 unsigned int index,
252 const union ib_gid *gid,
253 const struct ib_gid_attr *attr, 250 const struct ib_gid_attr *attr,
254 void **context) 251 void **context)
255{ 252{
256 struct mlx4_ib_dev *ibdev = to_mdev(device); 253 struct mlx4_ib_dev *ibdev = to_mdev(attr->device);
257 struct mlx4_ib_iboe *iboe = &ibdev->iboe; 254 struct mlx4_ib_iboe *iboe = &ibdev->iboe;
258 struct mlx4_port_gid_table *port_gid_table; 255 struct mlx4_port_gid_table *port_gid_table;
259 int free = -1, found = -1; 256 int free = -1, found = -1;
@@ -262,16 +259,16 @@ static int mlx4_ib_add_gid(struct ib_device *device,
262 int i; 259 int i;
263 struct gid_entry *gids = NULL; 260 struct gid_entry *gids = NULL;
264 261
265 if (!rdma_cap_roce_gid_table(device, port_num)) 262 if (!rdma_cap_roce_gid_table(attr->device, attr->port_num))
266 return -EINVAL; 263 return -EINVAL;
267 264
268 if (port_num > MLX4_MAX_PORTS) 265 if (attr->port_num > MLX4_MAX_PORTS)
269 return -EINVAL; 266 return -EINVAL;
270 267
271 if (!context) 268 if (!context)
272 return -EINVAL; 269 return -EINVAL;
273 270
274 port_gid_table = &iboe->gids[port_num - 1]; 271 port_gid_table = &iboe->gids[attr->port_num - 1];
275 spin_lock_bh(&iboe->lock); 272 spin_lock_bh(&iboe->lock);
276 for (i = 0; i < MLX4_MAX_PORT_GIDS; ++i) { 273 for (i = 0; i < MLX4_MAX_PORT_GIDS; ++i) {
277 if (!memcmp(&port_gid_table->gids[i].gid, gid, sizeof(*gid)) && 274 if (!memcmp(&port_gid_table->gids[i].gid, gid, sizeof(*gid)) &&
@@ -318,33 +315,30 @@ static int mlx4_ib_add_gid(struct ib_device *device,
318 spin_unlock_bh(&iboe->lock); 315 spin_unlock_bh(&iboe->lock);
319 316
320 if (!ret && hw_update) { 317 if (!ret && hw_update) {
321 ret = mlx4_ib_update_gids(gids, ibdev, port_num); 318 ret = mlx4_ib_update_gids(gids, ibdev, attr->port_num);
322 kfree(gids); 319 kfree(gids);
323 } 320 }
324 321
325 return ret; 322 return ret;
326} 323}
327 324
328static int mlx4_ib_del_gid(struct ib_device *device, 325static int mlx4_ib_del_gid(const struct ib_gid_attr *attr, void **context)
329 u8 port_num,
330 unsigned int index,
331 void **context)
332{ 326{
333 struct gid_cache_context *ctx = *context; 327 struct gid_cache_context *ctx = *context;
334 struct mlx4_ib_dev *ibdev = to_mdev(device); 328 struct mlx4_ib_dev *ibdev = to_mdev(attr->device);
335 struct mlx4_ib_iboe *iboe = &ibdev->iboe; 329 struct mlx4_ib_iboe *iboe = &ibdev->iboe;
336 struct mlx4_port_gid_table *port_gid_table; 330 struct mlx4_port_gid_table *port_gid_table;
337 int ret = 0; 331 int ret = 0;
338 int hw_update = 0; 332 int hw_update = 0;
339 struct gid_entry *gids = NULL; 333 struct gid_entry *gids = NULL;
340 334
341 if (!rdma_cap_roce_gid_table(device, port_num)) 335 if (!rdma_cap_roce_gid_table(attr->device, attr->port_num))
342 return -EINVAL; 336 return -EINVAL;
343 337
344 if (port_num > MLX4_MAX_PORTS) 338 if (attr->port_num > MLX4_MAX_PORTS)
345 return -EINVAL; 339 return -EINVAL;
346 340
347 port_gid_table = &iboe->gids[port_num - 1]; 341 port_gid_table = &iboe->gids[attr->port_num - 1];
348 spin_lock_bh(&iboe->lock); 342 spin_lock_bh(&iboe->lock);
349 if (ctx) { 343 if (ctx) {
350 ctx->refcount--; 344 ctx->refcount--;
@@ -376,7 +370,7 @@ static int mlx4_ib_del_gid(struct ib_device *device,
376 spin_unlock_bh(&iboe->lock); 370 spin_unlock_bh(&iboe->lock);
377 371
378 if (!ret && hw_update) { 372 if (!ret && hw_update) {
379 ret = mlx4_ib_update_gids(gids, ibdev, port_num); 373 ret = mlx4_ib_update_gids(gids, ibdev, attr->port_num);
380 kfree(gids); 374 kfree(gids);
381 } 375 }
382 return ret; 376 return ret;
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 9e6780eadd1e..bc9eabd95948 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -502,18 +502,19 @@ static int set_roce_addr(struct mlx5_ib_dev *dev, u8 port_num,
502 vlan_id, port_num); 502 vlan_id, port_num);
503} 503}
504 504
505static int mlx5_ib_add_gid(struct ib_device *device, u8 port_num, 505static int mlx5_ib_add_gid(const union ib_gid *gid,
506 unsigned int index, const union ib_gid *gid,
507 const struct ib_gid_attr *attr, 506 const struct ib_gid_attr *attr,
508 __always_unused void **context) 507 __always_unused void **context)
509{ 508{
510 return set_roce_addr(to_mdev(device), port_num, index, gid, attr); 509 return set_roce_addr(to_mdev(attr->device), attr->port_num,
510 attr->index, gid, attr);
511} 511}
512 512
513static int mlx5_ib_del_gid(struct ib_device *device, u8 port_num, 513static int mlx5_ib_del_gid(const struct ib_gid_attr *attr,
514 unsigned int index, __always_unused void **context) 514 __always_unused void **context)
515{ 515{
516 return set_roce_addr(to_mdev(device), port_num, index, NULL, NULL); 516 return set_roce_addr(to_mdev(attr->device), attr->port_num,
517 attr->index, NULL, NULL);
517} 518}
518 519
519__be16 mlx5_get_roce_udp_sport(struct mlx5_ib_dev *dev, u8 port_num, 520__be16 mlx5_get_roce_udp_sport(struct mlx5_ib_dev *dev, u8 port_num,
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
index 4834460e2a0b..0be33a81bbe6 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
@@ -62,17 +62,10 @@ static DEFINE_MUTEX(pvrdma_device_list_lock);
62static LIST_HEAD(pvrdma_device_list); 62static LIST_HEAD(pvrdma_device_list);
63static struct workqueue_struct *event_wq; 63static struct workqueue_struct *event_wq;
64 64
65static int pvrdma_add_gid(struct ib_device *ibdev, 65static int pvrdma_add_gid(const union ib_gid *gid,
66 u8 port_num,
67 unsigned int index,
68 const union ib_gid *gid,
69 const struct ib_gid_attr *attr, 66 const struct ib_gid_attr *attr,
70 void **context); 67 void **context);
71static int pvrdma_del_gid(struct ib_device *ibdev, 68static int pvrdma_del_gid(const struct ib_gid_attr *attr, void **context);
72 u8 port_num,
73 unsigned int index,
74 void **context);
75
76 69
77static ssize_t show_hca(struct device *device, struct device_attribute *attr, 70static ssize_t show_hca(struct device *device, struct device_attribute *attr,
78 char *buf) 71 char *buf)
@@ -657,18 +650,15 @@ static int pvrdma_add_gid_at_index(struct pvrdma_dev *dev,
657 return 0; 650 return 0;
658} 651}
659 652
660static int pvrdma_add_gid(struct ib_device *ibdev, 653static int pvrdma_add_gid(const union ib_gid *gid,
661 u8 port_num,
662 unsigned int index,
663 const union ib_gid *gid,
664 const struct ib_gid_attr *attr, 654 const struct ib_gid_attr *attr,
665 void **context) 655 void **context)
666{ 656{
667 struct pvrdma_dev *dev = to_vdev(ibdev); 657 struct pvrdma_dev *dev = to_vdev(attr->device);
668 658
669 return pvrdma_add_gid_at_index(dev, gid, 659 return pvrdma_add_gid_at_index(dev, gid,
670 ib_gid_type_to_pvrdma(attr->gid_type), 660 ib_gid_type_to_pvrdma(attr->gid_type),
671 index); 661 attr->index);
672} 662}
673 663
674static int pvrdma_del_gid_at_index(struct pvrdma_dev *dev, int index) 664static int pvrdma_del_gid_at_index(struct pvrdma_dev *dev, int index)
@@ -698,17 +688,14 @@ static int pvrdma_del_gid_at_index(struct pvrdma_dev *dev, int index)
698 return 0; 688 return 0;
699} 689}
700 690
701static int pvrdma_del_gid(struct ib_device *ibdev, 691static int pvrdma_del_gid(const struct ib_gid_attr *attr, void **context)
702 u8 port_num,
703 unsigned int index,
704 void **context)
705{ 692{
706 struct pvrdma_dev *dev = to_vdev(ibdev); 693 struct pvrdma_dev *dev = to_vdev(attr->device);
707 694
708 dev_dbg(&dev->pdev->dev, "removing gid at index %u from %s", 695 dev_dbg(&dev->pdev->dev, "removing gid at index %u from %s",
709 index, dev->netdev->name); 696 attr->index, dev->netdev->name);
710 697
711 return pvrdma_del_gid_at_index(dev, index); 698 return pvrdma_del_gid_at_index(dev, attr->index);
712} 699}
713 700
714static void pvrdma_netdevice_event_handle(struct pvrdma_dev *dev, 701static void pvrdma_netdevice_event_handle(struct pvrdma_dev *dev,
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
index 0661c2783b14..08f3e0618b81 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
@@ -77,19 +77,17 @@ out:
77 return rc; 77 return rc;
78} 78}
79 79
80static int rxe_add_gid(struct ib_device *device, u8 port_num, unsigned int 80static int rxe_add_gid(const union ib_gid *gid,
81 index, const union ib_gid *gid,
82 const struct ib_gid_attr *attr, void **context) 81 const struct ib_gid_attr *attr, void **context)
83{ 82{
84 if (index >= RXE_PORT_GID_TBL_LEN) 83 if (attr->index >= RXE_PORT_GID_TBL_LEN)
85 return -EINVAL; 84 return -EINVAL;
86 return 0; 85 return 0;
87} 86}
88 87
89static int rxe_del_gid(struct ib_device *device, u8 port_num, unsigned int 88static int rxe_del_gid(const struct ib_gid_attr *attr, void **context)
90 index, void **context)
91{ 89{
92 if (index >= RXE_PORT_GID_TBL_LEN) 90 if (attr->index >= RXE_PORT_GID_TBL_LEN)
93 return -EINVAL; 91 return -EINVAL;
94 return 0; 92 return 0;
95} 93}
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index dc2541f13d7f..1e3059ce73b6 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -2151,34 +2151,29 @@ struct ib_device {
2151 int (*query_gid)(struct ib_device *device, 2151 int (*query_gid)(struct ib_device *device,
2152 u8 port_num, int index, 2152 u8 port_num, int index,
2153 union ib_gid *gid); 2153 union ib_gid *gid);
2154 /* When calling add_gid, the HW vendor's driver should 2154 /* When calling add_gid, the HW vendor's driver should add the gid
2155 * add the gid of device @device at gid index @index of 2155 * of device of port at gid index available at @attr. Meta-info of
2156 * port @port_num to be @gid. Meta-info of that gid (for example, 2156 * that gid (for example, the network device related to this gid) is
2157 * the network device related to this gid is available 2157 * available at @attr. @context allows the HW vendor driver to store
2158 * at @attr. @context allows the HW vendor driver to store extra 2158 * extra information together with a GID entry. The HW vendor driver may
2159 * information together with a GID entry. The HW vendor may allocate 2159 * allocate memory to contain this information and store it in @context
2160 * memory to contain this information and store it in @context when a 2160 * when a new GID entry is written to. Params are consistent until the
2161 * new GID entry is written to. Params are consistent until the next 2161 * next call of add_gid or delete_gid. The function should return 0 on
2162 * call of add_gid or delete_gid. The function should return 0 on
2163 * success or error otherwise. The function could be called 2162 * success or error otherwise. The function could be called
2164 * concurrently for different ports. This function is only called 2163 * concurrently for different ports. This function is only called when
2165 * when roce_gid_table is used. 2164 * roce_gid_table is used.
2166 */ 2165 */
2167 int (*add_gid)(struct ib_device *device, 2166 int (*add_gid)(const union ib_gid *gid,
2168 u8 port_num,
2169 unsigned int index,
2170 const union ib_gid *gid,
2171 const struct ib_gid_attr *attr, 2167 const struct ib_gid_attr *attr,
2172 void **context); 2168 void **context);
2173 /* When calling del_gid, the HW vendor's driver should delete the 2169 /* When calling del_gid, the HW vendor's driver should delete the
2174 * gid of device @device at gid index @index of port @port_num. 2170 * gid of device @device at gid index gid_index of port port_num
2171 * available in @attr.
2175 * Upon the deletion of a GID entry, the HW vendor must free any 2172 * Upon the deletion of a GID entry, the HW vendor must free any
2176 * allocated memory. The caller will clear @context afterwards. 2173 * allocated memory. The caller will clear @context afterwards.
2177 * This function is only called when roce_gid_table is used. 2174 * This function is only called when roce_gid_table is used.
2178 */ 2175 */
2179 int (*del_gid)(struct ib_device *device, 2176 int (*del_gid)(const struct ib_gid_attr *attr,
2180 u8 port_num,
2181 unsigned int index,
2182 void **context); 2177 void **context);
2183 int (*query_pkey)(struct ib_device *device, 2178 int (*query_pkey)(struct ib_device *device,
2184 u8 port_num, u16 index, u16 *pkey); 2179 u8 port_num, u16 index, u16 *pkey);