RDMA/rxe: remove rxe_ib_device_get_netdev() and RXE_PORT

Suggested by Leon, remove the rxe_ib_device_get_netdev() wrapper and
the RXE_PORT definition. These additions do not improve readability,
and RXE has always had only a single port.

Signed-off-by: zhenwei pi <zhenwei.pi@linux.dev>
Link: https://patch.msgid.link/20260414062948.671658-2-zhenwei.pi@linux.dev
Signed-off-by: Leon Romanovsky <leon@kernel.org>
This commit is contained in:
zhenwei pi 2026-04-14 14:29:45 +08:00 committed by Leon Romanovsky
parent a38e4410af
commit dd67760975
4 changed files with 7 additions and 14 deletions

View File

@ -34,7 +34,7 @@ static int rxe_mcast_add(struct rxe_dev *rxe, union ib_gid *mgid)
struct net_device *ndev;
int ret;
ndev = rxe_ib_device_get_netdev(&rxe->ib_dev);
ndev = ib_device_get_netdev(&rxe->ib_dev, 1);
if (!ndev)
return -ENODEV;
@ -59,7 +59,7 @@ static int rxe_mcast_del(struct rxe_dev *rxe, union ib_gid *mgid)
struct net_device *ndev;
int ret;
ndev = rxe_ib_device_get_netdev(&rxe->ib_dev);
ndev = ib_device_get_netdev(&rxe->ib_dev, 1);
if (!ndev)
return -ENODEV;

View File

@ -600,7 +600,7 @@ const char *rxe_parent_name(struct rxe_dev *rxe, unsigned int port_num)
struct net_device *ndev;
char *ndev_name;
ndev = rxe_ib_device_get_netdev(&rxe->ib_dev);
ndev = ib_device_get_netdev(&rxe->ib_dev, 1);
if (!ndev)
return NULL;
ndev_name = ndev->name;
@ -644,12 +644,11 @@ static void rxe_sock_put(struct sock *sk,
void rxe_net_del(struct ib_device *dev)
{
struct rxe_dev *rxe = container_of(dev, struct rxe_dev, ib_dev);
struct net_device *ndev;
struct sock *sk;
struct net *net;
ndev = rxe_ib_device_get_netdev(&rxe->ib_dev);
ndev = ib_device_get_netdev(dev, 1);
if (!ndev)
return;
@ -697,7 +696,7 @@ void rxe_set_port_state(struct rxe_dev *rxe)
{
struct net_device *ndev;
ndev = rxe_ib_device_get_netdev(&rxe->ib_dev);
ndev = ib_device_get_netdev(&rxe->ib_dev, 1);
if (!ndev)
return;

View File

@ -50,7 +50,7 @@ static int rxe_query_port(struct ib_device *ibdev,
goto err_out;
}
ndev = rxe_ib_device_get_netdev(ibdev);
ndev = ib_device_get_netdev(ibdev, 1);
if (!ndev) {
err = -ENODEV;
goto err_out;
@ -1441,7 +1441,7 @@ static int rxe_enable_driver(struct ib_device *ib_dev)
struct rxe_dev *rxe = container_of(ib_dev, struct rxe_dev, ib_dev);
struct net_device *ndev;
ndev = rxe_ib_device_get_netdev(ib_dev);
ndev = ib_device_get_netdev(ib_dev, 1);
if (!ndev)
return -ENODEV;

View File

@ -415,7 +415,6 @@ struct rxe_port {
u32 qp_gsi_index;
};
#define RXE_PORT 1
struct rxe_dev {
struct ib_device ib_dev;
struct ib_device_attr attr;
@ -451,11 +450,6 @@ struct rxe_dev {
struct rxe_port port;
};
static inline struct net_device *rxe_ib_device_get_netdev(struct ib_device *dev)
{
return ib_device_get_netdev(dev, RXE_PORT);
}
static inline void rxe_counter_inc(struct rxe_dev *rxe, enum rxe_counters index)
{
atomic64_inc(&rxe->stats_counters[index]);