-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net/mlx5e: Introduce mlx5e_channels API to get RQNs
Currently, struct mlx5e_channels is defined in en.h, along with a lot of other stuff. In the following commit mlx5e_rx_res will need to get RQNs (RQ hardware IDs), given a pointer to mlx5e_channels and the channel index. In order to make it possible without including the whole en.h, this commit introduces functions that will hide the implementation details of mlx5e_channels. Signed-off-by: Maxim Mikityanskiy <maximmi@nvidia.com> Reviewed-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
- Loading branch information
Maxim Mikityanskiy
authored and
Saeed Mahameed
committed
Aug 3, 2021
1 parent
43befe9
commit e6e01b5
Showing
3 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB | ||
/* Copyright (c) 2021, Mellanox Technologies inc. All rights reserved. */ | ||
|
||
#include "channels.h" | ||
#include "en.h" | ||
#include "en/ptp.h" | ||
|
||
unsigned int mlx5e_channels_get_num(struct mlx5e_channels *chs) | ||
{ | ||
return chs->num; | ||
} | ||
|
||
void mlx5e_channels_get_regular_rqn(struct mlx5e_channels *chs, unsigned int ix, u32 *rqn) | ||
{ | ||
struct mlx5e_channel *c; | ||
|
||
WARN_ON(ix >= mlx5e_channels_get_num(chs)); | ||
c = chs->c[ix]; | ||
|
||
*rqn = c->rq.rqn; | ||
} | ||
|
||
bool mlx5e_channels_get_xsk_rqn(struct mlx5e_channels *chs, unsigned int ix, u32 *rqn) | ||
{ | ||
struct mlx5e_channel *c; | ||
|
||
WARN_ON(ix >= mlx5e_channels_get_num(chs)); | ||
c = chs->c[ix]; | ||
|
||
if (!test_bit(MLX5E_CHANNEL_STATE_XSK, c->state)) | ||
return false; | ||
|
||
*rqn = c->xskrq.rqn; | ||
return true; | ||
} | ||
|
||
bool mlx5e_channels_get_ptp_rqn(struct mlx5e_channels *chs, u32 *rqn) | ||
{ | ||
struct mlx5e_ptp *c = chs->ptp; | ||
|
||
if (!c || !test_bit(MLX5E_PTP_STATE_RX, c->state)) | ||
return false; | ||
|
||
*rqn = c->rq.rqn; | ||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ | ||
/* Copyright (c) 2021, Mellanox Technologies inc. All rights reserved. */ | ||
|
||
#ifndef __MLX5_EN_CHANNELS_H__ | ||
#define __MLX5_EN_CHANNELS_H__ | ||
|
||
#include <linux/kernel.h> | ||
|
||
struct mlx5e_channels; | ||
|
||
unsigned int mlx5e_channels_get_num(struct mlx5e_channels *chs); | ||
void mlx5e_channels_get_regular_rqn(struct mlx5e_channels *chs, unsigned int ix, u32 *rqn); | ||
bool mlx5e_channels_get_xsk_rqn(struct mlx5e_channels *chs, unsigned int ix, u32 *rqn); | ||
bool mlx5e_channels_get_ptp_rqn(struct mlx5e_channels *chs, u32 *rqn); | ||
|
||
#endif /* __MLX5_EN_CHANNELS_H__ */ |