Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

RDMA/core: Implement RoCE GID port rescan and export delete function

rdma_roce_rescan_port() scans all network devices in
the system and adds the gids if relevant to the RoCE device
port. When not in bonding mode it adds the GIDs of the
netdevice in this port. When in bonding mode it adds the
GIDs of both the port's netdevice and the bond master
netdevice.

Export roce_del_all_netdev_gids(), which removes all GIDs
associated with a specific netdevice for a given port.

Signed-off-by: Chiara Meiohas <cmeiohas@nvidia.com>
Link: https://patch.msgid.link/674d498da4637a1503ff1367e28bd09ff942fd5e.1730381292.git.leon@kernel.org
Signed-off-by: Leon Romanovsky <leon@kernel.org>

authored by

Chiara Meiohas and committed by
Leon Romanovsky
af7a35bf 6d9c7b27

+29 -4
+26 -4
drivers/infiniband/core/roce_gid_mgmt.c
··· 515 515 } 516 516 EXPORT_SYMBOL(rdma_roce_rescan_device); 517 517 518 + /** 519 + * rdma_roce_rescan_port - Rescan all of the network devices in the system 520 + * and add their gids if relevant to the port of the RoCE device. 521 + * 522 + * @ib_dev: IB device 523 + * @port: Port number 524 + */ 525 + void rdma_roce_rescan_port(struct ib_device *ib_dev, u32 port) 526 + { 527 + struct net_device *ndev = NULL; 528 + 529 + if (rdma_protocol_roce(ib_dev, port)) { 530 + ndev = ib_device_get_netdev(ib_dev, port); 531 + if (!ndev) 532 + return; 533 + enum_all_gids_of_dev_cb(ib_dev, port, ndev, ndev); 534 + dev_put(ndev); 535 + } 536 + } 537 + EXPORT_SYMBOL(rdma_roce_rescan_port); 538 + 518 539 static void callback_for_addr_gid_device_scan(struct ib_device *device, 519 540 u32 port, 520 541 struct net_device *rdma_ndev, ··· 596 575 } 597 576 } 598 577 599 - static void _roce_del_all_netdev_gids(struct ib_device *ib_dev, u32 port, 600 - struct net_device *event_ndev) 578 + void roce_del_all_netdev_gids(struct ib_device *ib_dev, 579 + u32 port, struct net_device *ndev) 601 580 { 602 - ib_cache_gid_del_all_netdev_gids(ib_dev, port, event_ndev); 581 + ib_cache_gid_del_all_netdev_gids(ib_dev, port, ndev); 603 582 } 583 + EXPORT_SYMBOL(roce_del_all_netdev_gids); 604 584 605 585 static void del_netdev_upper_ips(struct ib_device *ib_dev, u32 port, 606 586 struct net_device *rdma_ndev, void *cookie) 607 587 { 608 - handle_netdev_upper(ib_dev, port, cookie, _roce_del_all_netdev_gids); 588 + handle_netdev_upper(ib_dev, port, cookie, roce_del_all_netdev_gids); 609 589 } 610 590 611 591 static void add_netdev_upper_ips(struct ib_device *ib_dev, u32 port,
+3
include/rdma/ib_verbs.h
··· 4734 4734 * @device: the rdma device 4735 4735 */ 4736 4736 void rdma_roce_rescan_device(struct ib_device *ibdev); 4737 + void rdma_roce_rescan_port(struct ib_device *ib_dev, u32 port); 4738 + void roce_del_all_netdev_gids(struct ib_device *ib_dev, 4739 + u32 port, struct net_device *ndev); 4737 4740 4738 4741 struct ib_ucontext *ib_uverbs_get_ucontext_file(struct ib_uverbs_file *ufile); 4739 4742