mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
IB/core: Create common start/end port functions
Previously start_port and end_port were defined in 2 places, cache.c and device.c and this prevented their use in other modules. Make these common functions, change the name to reflect the rdma name space, and update existing users. Signed-off-by: Ira Weiny <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
This commit is contained in:
parent
296ec00995
commit
0cf18d7723
3 changed files with 59 additions and 55 deletions
|
|
@ -1752,6 +1752,33 @@ int ib_query_port(struct ib_device *device,
|
|||
enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device,
|
||||
u8 port_num);
|
||||
|
||||
/**
|
||||
* rdma_start_port - Return the first valid port number for the device
|
||||
* specified
|
||||
*
|
||||
* @device: Device to be checked
|
||||
*
|
||||
* Return start port number
|
||||
*/
|
||||
static inline u8 rdma_start_port(const struct ib_device *device)
|
||||
{
|
||||
return (device->node_type == RDMA_NODE_IB_SWITCH) ? 0 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* rdma_end_port - Return the last valid port number for the device
|
||||
* specified
|
||||
*
|
||||
* @device: Device to be checked
|
||||
*
|
||||
* Return last port number
|
||||
*/
|
||||
static inline u8 rdma_end_port(const struct ib_device *device)
|
||||
{
|
||||
return (device->node_type == RDMA_NODE_IB_SWITCH) ?
|
||||
0 : device->phys_port_cnt;
|
||||
}
|
||||
|
||||
static inline bool rdma_protocol_ib(struct ib_device *device, u8 port_num)
|
||||
{
|
||||
return device->query_protocol(device, port_num) == RDMA_PROTOCOL_IB;
|
||||
|
|
|
|||
Loading…
Reference in a new issue