All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: zhenwei pi <zhenwei.pi@linux.dev>
Cc: linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
	zyjzyj2000@gmail.com, jgg@ziepe.ca
Subject: Re: [PATCH v3 1/3] RDMA/rxe: use RXE_PORT instead of magic number 1
Date: Sun, 5 Apr 2026 22:09:54 +0300	[thread overview]
Message-ID: <20260405190954.GA86584@unreal> (raw)
In-Reply-To: <20260329054156.125362-2-zhenwei.pi@linux.dev>

On Sun, Mar 29, 2026 at 01:41:54PM +0800, zhenwei pi wrote:
> Align with the existing code:
> static ... rxe_ib_device_get_netdev(struct ib_device *dev)
> {
>         return ib_device_get_netdev(dev, RXE_PORT);
> }

Please submit the inverse patch that removes 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.

Thanks

> 
> Use *RXE_PORT* instead of magic number 1 for all.
> 
> Signed-off-by: zhenwei pi <zhenwei.pi@linux.dev>
> ---
>  drivers/infiniband/sw/rxe/rxe_net.c   | 6 +++---
>  drivers/infiniband/sw/rxe/rxe_verbs.c | 8 ++++----
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
> index 0bd0902b11f7..20338cb8e3c2 100644
> --- a/drivers/infiniband/sw/rxe/rxe_net.c
> +++ b/drivers/infiniband/sw/rxe/rxe_net.c
> @@ -234,7 +234,7 @@ static int rxe_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
>  
>  	udph = udp_hdr(skb);
>  	pkt->rxe = rxe;
> -	pkt->port_num = 1;
> +	pkt->port_num = RXE_PORT;
>  	pkt->hdr = (u8 *)(udph + 1);
>  	pkt->mask = RXE_GRH_MASK;
>  	pkt->paylen = be16_to_cpu(udph->len) - sizeof(*udph);
> @@ -535,7 +535,7 @@ struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,
>  	struct sk_buff *skb = NULL;
>  	struct net_device *ndev;
>  	const struct ib_gid_attr *attr;
> -	const int port_num = 1;
> +	const int port_num = RXE_PORT;
>  
>  	attr = rdma_get_gid_attr(&rxe->ib_dev, port_num, av->grh.sgid_index);
>  	if (IS_ERR(attr))
> @@ -630,7 +630,7 @@ static void rxe_port_event(struct rxe_dev *rxe,
>  	struct ib_event ev;
>  
>  	ev.device = &rxe->ib_dev;
> -	ev.element.port_num = 1;
> +	ev.element.port_num = RXE_PORT;
>  	ev.event = event;
>  
>  	ib_dispatch_event(&ev);
> diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
> index fe41362c5144..bcd486e8668b 100644
> --- a/drivers/infiniband/sw/rxe/rxe_verbs.c
> +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
> @@ -44,7 +44,7 @@ static int rxe_query_port(struct ib_device *ibdev,
>  	struct net_device *ndev;
>  	int err, ret;
>  
> -	if (port_num != 1) {
> +	if (port_num != RXE_PORT) {
>  		err = -EINVAL;
>  		rxe_dbg_dev(rxe, "bad port_num = %d\n", port_num);
>  		goto err_out;
> @@ -147,7 +147,7 @@ static int rxe_modify_port(struct ib_device *ibdev, u32 port_num,
>  	struct rxe_port *port;
>  	int err;
>  
> -	if (port_num != 1) {
> +	if (port_num != RXE_PORT) {
>  		err = -EINVAL;
>  		rxe_dbg_dev(rxe, "bad port_num = %d\n", port_num);
>  		goto err_out;
> @@ -180,7 +180,7 @@ static enum rdma_link_layer rxe_get_link_layer(struct ib_device *ibdev,
>  	struct rxe_dev *rxe = to_rdev(ibdev);
>  	int err;
>  
> -	if (port_num != 1) {
> +	if (port_num != RXE_PORT) {
>  		err = -EINVAL;
>  		rxe_dbg_dev(rxe, "bad port_num = %d\n", port_num);
>  		goto err_out;
> @@ -200,7 +200,7 @@ static int rxe_port_immutable(struct ib_device *ibdev, u32 port_num,
>  	struct ib_port_attr attr = {};
>  	int err;
>  
> -	if (port_num != 1) {
> +	if (port_num != RXE_PORT) {
>  		err = -EINVAL;
>  		rxe_dbg_dev(rxe, "bad port_num = %d\n", port_num);
>  		goto err_out;
> -- 
> 2.43.0
> 
> 

  parent reply	other threads:[~2026-04-05 19:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-29  5:41 [PATCH v3 0/3] Support PERF MGMT for RXE zhenwei pi
2026-03-29  5:41 ` [PATCH v3 1/3] RDMA/rxe: use RXE_PORT instead of magic number 1 zhenwei pi
2026-03-29  7:01   ` Zhu Yanjun
2026-04-05 19:09   ` Leon Romanovsky [this message]
2026-03-29  5:41 ` [PATCH v3 2/3] RDMA/rxe: add SENT/RCVD bytes zhenwei pi
2026-03-29  7:01   ` Zhu Yanjun
2026-04-05 19:18   ` Leon Romanovsky
2026-03-29  5:41 ` [PATCH v3 3/3] RDMA/rxe: support perf mgmt GET method zhenwei pi
2026-03-29  7:03   ` Zhu Yanjun
2026-04-05 19:20   ` Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260405190954.GA86584@unreal \
    --to=leon@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=zhenwei.pi@linux.dev \
    --cc=zyjzyj2000@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.