RDMA: Allow for NULL .modify_device() and .modify_port() methods
These methods don't make sense for iWARP devices, so rather than forcing them to implement stubs, just return -ENOSYS in the core if the hardware driver doesn't set .modify_device and/or .modify_port. Signed-off-by: Roland Dreier <roland@purestorage.com>
This commit is contained in:
parent
620917de59
commit
10e1b54bbb
|
@ -627,6 +627,9 @@ int ib_modify_device(struct ib_device *device,
|
|||
int device_modify_mask,
|
||||
struct ib_device_modify *device_modify)
|
||||
{
|
||||
if (!device->modify_device)
|
||||
return -ENOSYS;
|
||||
|
||||
return device->modify_device(device, device_modify_mask,
|
||||
device_modify);
|
||||
}
|
||||
|
@ -647,6 +650,9 @@ int ib_modify_port(struct ib_device *device,
|
|||
u8 port_num, int port_modify_mask,
|
||||
struct ib_port_modify *port_modify)
|
||||
{
|
||||
if (!device->modify_port)
|
||||
return -ENOSYS;
|
||||
|
||||
if (port_num < start_port(device) || port_num > end_port(device))
|
||||
return -EINVAL;
|
||||
|
||||
|
|
|
@ -99,14 +99,6 @@ static int c2_query_port(struct ib_device *ibdev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int c2_modify_port(struct ib_device *ibdev,
|
||||
u8 port, int port_modify_mask,
|
||||
struct ib_port_modify *props)
|
||||
{
|
||||
pr_debug("%s:%u\n", __func__, __LINE__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int c2_query_pkey(struct ib_device *ibdev,
|
||||
u8 port, u16 index, u16 * pkey)
|
||||
{
|
||||
|
@ -817,7 +809,6 @@ int c2_register_device(struct c2_dev *dev)
|
|||
dev->ibdev.dma_device = &dev->pcidev->dev;
|
||||
dev->ibdev.query_device = c2_query_device;
|
||||
dev->ibdev.query_port = c2_query_port;
|
||||
dev->ibdev.modify_port = c2_modify_port;
|
||||
dev->ibdev.query_pkey = c2_query_pkey;
|
||||
dev->ibdev.query_gid = c2_query_gid;
|
||||
dev->ibdev.alloc_ucontext = c2_alloc_ucontext;
|
||||
|
|
|
@ -61,13 +61,6 @@
|
|||
#include "iwch_user.h"
|
||||
#include "common.h"
|
||||
|
||||
static int iwch_modify_port(struct ib_device *ibdev,
|
||||
u8 port, int port_modify_mask,
|
||||
struct ib_port_modify *props)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static struct ib_ah *iwch_ah_create(struct ib_pd *pd,
|
||||
struct ib_ah_attr *ah_attr)
|
||||
{
|
||||
|
@ -1392,7 +1385,6 @@ int iwch_register_device(struct iwch_dev *dev)
|
|||
dev->ibdev.dma_device = &(dev->rdev.rnic_info.pdev->dev);
|
||||
dev->ibdev.query_device = iwch_query_device;
|
||||
dev->ibdev.query_port = iwch_query_port;
|
||||
dev->ibdev.modify_port = iwch_modify_port;
|
||||
dev->ibdev.query_pkey = iwch_query_pkey;
|
||||
dev->ibdev.query_gid = iwch_query_gid;
|
||||
dev->ibdev.alloc_ucontext = iwch_alloc_ucontext;
|
||||
|
|
|
@ -58,13 +58,6 @@ static int fastreg_support = 1;
|
|||
module_param(fastreg_support, int, 0644);
|
||||
MODULE_PARM_DESC(fastreg_support, "Advertise fastreg support (default=1)");
|
||||
|
||||
static int c4iw_modify_port(struct ib_device *ibdev,
|
||||
u8 port, int port_modify_mask,
|
||||
struct ib_port_modify *props)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static struct ib_ah *c4iw_ah_create(struct ib_pd *pd,
|
||||
struct ib_ah_attr *ah_attr)
|
||||
{
|
||||
|
@ -456,7 +449,6 @@ int c4iw_register_device(struct c4iw_dev *dev)
|
|||
dev->ibdev.dma_device = &(dev->rdev.lldi.pdev->dev);
|
||||
dev->ibdev.query_device = c4iw_query_device;
|
||||
dev->ibdev.query_port = c4iw_query_port;
|
||||
dev->ibdev.modify_port = c4iw_modify_port;
|
||||
dev->ibdev.query_pkey = c4iw_query_pkey;
|
||||
dev->ibdev.query_gid = c4iw_query_gid;
|
||||
dev->ibdev.alloc_ucontext = c4iw_alloc_ucontext;
|
||||
|
|
|
@ -604,16 +604,6 @@ static int nes_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attr
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* nes_modify_port
|
||||
*/
|
||||
static int nes_modify_port(struct ib_device *ibdev, u8 port,
|
||||
int port_modify_mask, struct ib_port_modify *props)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* nes_query_pkey
|
||||
*/
|
||||
|
@ -3882,7 +3872,6 @@ struct nes_ib_device *nes_init_ofa_device(struct net_device *netdev)
|
|||
nesibdev->ibdev.dev.parent = &nesdev->pcidev->dev;
|
||||
nesibdev->ibdev.query_device = nes_query_device;
|
||||
nesibdev->ibdev.query_port = nes_query_port;
|
||||
nesibdev->ibdev.modify_port = nes_modify_port;
|
||||
nesibdev->ibdev.query_pkey = nes_query_pkey;
|
||||
nesibdev->ibdev.query_gid = nes_query_gid;
|
||||
nesibdev->ibdev.alloc_ucontext = nes_alloc_ucontext;
|
||||
|
|
Loading…
Reference in New Issue