RDMA/ocrdma: Incorporate the moving of GID Table mgmt to IB/Core
1.Change query_gid hook to return value from IB/Core GID management APIs. 2.Get rid of all the netdev notifier chain subscription code as well as maintenance of SGID Table in memory. 3.Implement get_netdev hook in driver. Signed-off-by: Somnath Kotur <somnath.kotur@avagotech.com> Signed-off-by: Devesh Sharma <devesh.sharma@avagotech.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:

committed by
Doug Ledford

parent
5070cd2239
commit
cc36929e73
@@ -46,6 +46,7 @@
|
||||
#include <rdma/iw_cm.h>
|
||||
#include <rdma/ib_umem.h>
|
||||
#include <rdma/ib_addr.h>
|
||||
#include <rdma/ib_cache.h>
|
||||
|
||||
#include "ocrdma.h"
|
||||
#include "ocrdma_hw.h"
|
||||
@@ -64,6 +65,7 @@ int ocrdma_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey)
|
||||
int ocrdma_query_gid(struct ib_device *ibdev, u8 port,
|
||||
int index, union ib_gid *sgid)
|
||||
{
|
||||
int ret;
|
||||
struct ocrdma_dev *dev;
|
||||
|
||||
dev = get_ocrdma_dev(ibdev);
|
||||
@@ -71,8 +73,28 @@ int ocrdma_query_gid(struct ib_device *ibdev, u8 port,
|
||||
if (index >= OCRDMA_MAX_SGID)
|
||||
return -EINVAL;
|
||||
|
||||
memcpy(sgid, &dev->sgid_tbl[index], sizeof(*sgid));
|
||||
ret = ib_get_cached_gid(ibdev, port, index, sgid);
|
||||
if (ret == -EAGAIN) {
|
||||
memcpy(sgid, &zgid, sizeof(*sgid));
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ocrdma_add_gid(struct ib_device *device,
|
||||
u8 port_num,
|
||||
unsigned int index,
|
||||
const union ib_gid *gid,
|
||||
const struct ib_gid_attr *attr,
|
||||
void **context) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ocrdma_del_gid(struct ib_device *device,
|
||||
u8 port_num,
|
||||
unsigned int index,
|
||||
void **context) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -125,6 +147,24 @@ int ocrdma_query_device(struct ib_device *ibdev, struct ib_device_attr *attr,
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct net_device *ocrdma_get_netdev(struct ib_device *ibdev, u8 port_num)
|
||||
{
|
||||
struct ocrdma_dev *dev;
|
||||
struct net_device *ndev = NULL;
|
||||
|
||||
rcu_read_lock();
|
||||
|
||||
dev = get_ocrdma_dev(ibdev);
|
||||
if (dev)
|
||||
ndev = dev->nic_info.netdev;
|
||||
if (ndev)
|
||||
dev_hold(ndev);
|
||||
|
||||
rcu_read_unlock();
|
||||
|
||||
return ndev;
|
||||
}
|
||||
|
||||
static inline void get_link_speed_and_width(struct ocrdma_dev *dev,
|
||||
u8 *ib_speed, u8 *ib_width)
|
||||
{
|
||||
@@ -194,7 +234,8 @@ int ocrdma_query_port(struct ib_device *ibdev,
|
||||
props->port_cap_flags =
|
||||
IB_PORT_CM_SUP |
|
||||
IB_PORT_REINIT_SUP |
|
||||
IB_PORT_DEVICE_MGMT_SUP | IB_PORT_VENDOR_CLASS_SUP | IB_PORT_IP_BASED_GIDS;
|
||||
IB_PORT_DEVICE_MGMT_SUP | IB_PORT_VENDOR_CLASS_SUP |
|
||||
IB_PORT_IP_BASED_GIDS;
|
||||
props->gid_tbl_len = OCRDMA_MAX_SGID;
|
||||
props->pkey_tbl_len = 1;
|
||||
props->bad_pkey_cntr = 0;
|
||||
|
Reference in New Issue
Block a user