device.c (0cce284537fb42d9c28b9b31038ffc9b464555f5) | device.c (24dc831b77eca9361cf835be59fa69ea0e471afc) |
---|---|
1/* 2 * Copyright (c) 2004 Topspin Communications. All rights reserved. 3 * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. 4 * 5 * This software is available to you under a choice of one of two 6 * licenses. You may choose to be licensed under the terms of the GNU 7 * General Public License (GPL) Version 2, available from the file 8 * COPYING in the main directory of this source tree, or the --- 645 unchanged lines hidden (view full) --- 654 */ 655int ib_query_port(struct ib_device *device, 656 u8 port_num, 657 struct ib_port_attr *port_attr) 658{ 659 union ib_gid gid; 660 int err; 661 | 1/* 2 * Copyright (c) 2004 Topspin Communications. All rights reserved. 3 * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. 4 * 5 * This software is available to you under a choice of one of two 6 * licenses. You may choose to be licensed under the terms of the GNU 7 * General Public License (GPL) Version 2, available from the file 8 * COPYING in the main directory of this source tree, or the --- 645 unchanged lines hidden (view full) --- 654 */ 655int ib_query_port(struct ib_device *device, 656 u8 port_num, 657 struct ib_port_attr *port_attr) 658{ 659 union ib_gid gid; 660 int err; 661 |
662 if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) | 662 if (!rdma_is_port_valid(device, port_num)) |
663 return -EINVAL; 664 665 memset(port_attr, 0, sizeof(*port_attr)); 666 err = device->query_port(device, port_num, port_attr); 667 if (err || port_attr->subnet_prefix) 668 return err; 669 670 if (rdma_port_get_link_layer(device, port_num) != IB_LINK_LAYER_INFINIBAND) --- 149 unchanged lines hidden (view full) --- 820 */ 821int ib_modify_port(struct ib_device *device, 822 u8 port_num, int port_modify_mask, 823 struct ib_port_modify *port_modify) 824{ 825 if (!device->modify_port) 826 return -ENOSYS; 827 | 663 return -EINVAL; 664 665 memset(port_attr, 0, sizeof(*port_attr)); 666 err = device->query_port(device, port_num, port_attr); 667 if (err || port_attr->subnet_prefix) 668 return err; 669 670 if (rdma_port_get_link_layer(device, port_num) != IB_LINK_LAYER_INFINIBAND) --- 149 unchanged lines hidden (view full) --- 820 */ 821int ib_modify_port(struct ib_device *device, 822 u8 port_num, int port_modify_mask, 823 struct ib_port_modify *port_modify) 824{ 825 if (!device->modify_port) 826 return -ENOSYS; 827 |
828 if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) | 828 if (!rdma_is_port_valid(device, port_num)) |
829 return -EINVAL; 830 831 return device->modify_port(device, port_num, port_modify_mask, 832 port_modify); 833} 834EXPORT_SYMBOL(ib_modify_port); 835 836/** --- 242 unchanged lines hidden --- | 829 return -EINVAL; 830 831 return device->modify_port(device, port_num, port_modify_mask, 832 port_modify); 833} 834EXPORT_SYMBOL(ib_modify_port); 835 836/** --- 242 unchanged lines hidden --- |