RDMA/srp: Support more than 255 rdma ports
Currently ib_srp module does not support devices with more than 256
ports. Switch from u8 to u32 to fix the problem.
Fixes: 1fb7f8973f
("RDMA: Support more than 255 rdma ports")
Reviewed-by: Shay Drory <shayd@nvidia.com>
Signed-off-by: Mikhael Goikhman <migo@nvidia.com>
Link: https://lore.kernel.org/r/7d80d8844f1abb3a54170b7259f0a02be38080a6.1663747327.git.leonro@nvidia.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
This commit is contained in:
parent
954afc5a8f
commit
b05398aff9
@ -2988,7 +2988,7 @@ static ssize_t local_ib_port_show(struct device *dev,
|
|||||||
{
|
{
|
||||||
struct srp_target_port *target = host_to_target(class_to_shost(dev));
|
struct srp_target_port *target = host_to_target(class_to_shost(dev));
|
||||||
|
|
||||||
return sysfs_emit(buf, "%d\n", target->srp_host->port);
|
return sysfs_emit(buf, "%u\n", target->srp_host->port);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DEVICE_ATTR_RO(local_ib_port);
|
static DEVICE_ATTR_RO(local_ib_port);
|
||||||
@ -3886,7 +3886,7 @@ static ssize_t port_show(struct device *dev, struct device_attribute *attr,
|
|||||||
{
|
{
|
||||||
struct srp_host *host = container_of(dev, struct srp_host, dev);
|
struct srp_host *host = container_of(dev, struct srp_host, dev);
|
||||||
|
|
||||||
return sysfs_emit(buf, "%d\n", host->port);
|
return sysfs_emit(buf, "%u\n", host->port);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DEVICE_ATTR_RO(port);
|
static DEVICE_ATTR_RO(port);
|
||||||
@ -3898,7 +3898,7 @@ static struct attribute *srp_class_attrs[] = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct srp_host *srp_add_port(struct srp_device *device, u8 port)
|
static struct srp_host *srp_add_port(struct srp_device *device, u32 port)
|
||||||
{
|
{
|
||||||
struct srp_host *host;
|
struct srp_host *host;
|
||||||
|
|
||||||
@ -3915,7 +3915,7 @@ static struct srp_host *srp_add_port(struct srp_device *device, u8 port)
|
|||||||
device_initialize(&host->dev);
|
device_initialize(&host->dev);
|
||||||
host->dev.class = &srp_class;
|
host->dev.class = &srp_class;
|
||||||
host->dev.parent = device->dev->dev.parent;
|
host->dev.parent = device->dev->dev.parent;
|
||||||
if (dev_set_name(&host->dev, "srp-%s-%d", dev_name(&device->dev->dev),
|
if (dev_set_name(&host->dev, "srp-%s-%u", dev_name(&device->dev->dev),
|
||||||
port))
|
port))
|
||||||
goto put_host;
|
goto put_host;
|
||||||
if (device_add(&host->dev))
|
if (device_add(&host->dev))
|
||||||
@ -3937,7 +3937,7 @@ static void srp_rename_dev(struct ib_device *device, void *client_data)
|
|||||||
list_for_each_entry_safe(host, tmp_host, &srp_dev->dev_list, list) {
|
list_for_each_entry_safe(host, tmp_host, &srp_dev->dev_list, list) {
|
||||||
char name[IB_DEVICE_NAME_MAX + 8];
|
char name[IB_DEVICE_NAME_MAX + 8];
|
||||||
|
|
||||||
snprintf(name, sizeof(name), "srp-%s-%d",
|
snprintf(name, sizeof(name), "srp-%s-%u",
|
||||||
dev_name(&device->dev), host->port);
|
dev_name(&device->dev), host->port);
|
||||||
device_rename(&host->dev, name);
|
device_rename(&host->dev, name);
|
||||||
}
|
}
|
||||||
@ -3949,7 +3949,7 @@ static int srp_add_one(struct ib_device *device)
|
|||||||
struct ib_device_attr *attr = &device->attrs;
|
struct ib_device_attr *attr = &device->attrs;
|
||||||
struct srp_host *host;
|
struct srp_host *host;
|
||||||
int mr_page_shift;
|
int mr_page_shift;
|
||||||
unsigned int p;
|
u32 p;
|
||||||
u64 max_pages_per_mr;
|
u64 max_pages_per_mr;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ struct srp_device {
|
|||||||
*/
|
*/
|
||||||
struct srp_host {
|
struct srp_host {
|
||||||
struct srp_device *srp_dev;
|
struct srp_device *srp_dev;
|
||||||
u8 port;
|
u32 port;
|
||||||
struct device dev;
|
struct device dev;
|
||||||
struct list_head target_list;
|
struct list_head target_list;
|
||||||
spinlock_t target_lock;
|
spinlock_t target_lock;
|
||||||
|
Loading…
Reference in New Issue
Block a user