From: Zhu Yanjun <zyjzyj2000@gmail.com>
To: Bob Pearson <rpearsonhpe@gmail.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>,
RDMA mailing list <linux-rdma@vger.kernel.org>
Subject: Re: [PATCH v2 2/9] RDMA/rxe: Move rxe_xmit_packet to a subroutine
Date: Wed, 14 Jul 2021 11:24:01 +0800 [thread overview]
Message-ID: <CAD=hENfMtLzYV53xpX-EC=05gZN9ZHp1yb+-g=Yb3E=w-mA01Q@mail.gmail.com> (raw)
In-Reply-To: <20210707040040.15434-3-rpearsonhpe@gmail.com>
On Wed, Jul 7, 2021 at 12:01 PM Bob Pearson <rpearsonhpe@gmail.com> wrote:
>
> rxe_xmit_packet() was an overlong inline subroutine. This patch moves it
> into rxe_net.c as an ordinary subroutine.
In this commit, the function rxe_xmit_packet is moved from rxe_loc.h
to rxe_net.c.
No other changes.
I am fine with this. Thanks.
Reviewed-by: Zhu Yanjun <zyjzyj2000@gmail.com>
Zhu Yanjun
>
> Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
> ---
> drivers/infiniband/sw/rxe/rxe_loc.h | 45 ++---------------------------
> drivers/infiniband/sw/rxe/rxe_net.c | 43 +++++++++++++++++++++++++++
> 2 files changed, 45 insertions(+), 43 deletions(-)
>
> diff --git a/drivers/infiniband/sw/rxe/rxe_loc.h b/drivers/infiniband/sw/rxe/rxe_loc.h
> index 015777e31ec9..409d10f20948 100644
> --- a/drivers/infiniband/sw/rxe/rxe_loc.h
> +++ b/drivers/infiniband/sw/rxe/rxe_loc.h
> @@ -104,6 +104,8 @@ int rxe_send(struct rxe_pkt_info *pkt, struct sk_buff *skb);
> struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,
> int paylen, struct rxe_pkt_info *pkt);
> int rxe_prepare(struct rxe_pkt_info *pkt, struct sk_buff *skb, u32 *crc);
> +int rxe_xmit_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
> + struct sk_buff *skb);
> const char *rxe_parent_name(struct rxe_dev *rxe, unsigned int port_num);
> int rxe_mcast_add(struct rxe_dev *rxe, union ib_gid *mgid);
> int rxe_mcast_delete(struct rxe_dev *rxe, union ib_gid *mgid);
> @@ -206,47 +208,4 @@ static inline unsigned int wr_opcode_mask(int opcode, struct rxe_qp *qp)
> return rxe_wr_opcode_info[opcode].mask[qp->ibqp.qp_type];
> }
>
> -static inline int rxe_xmit_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
> - struct sk_buff *skb)
> -{
> - int err;
> - int is_request = pkt->mask & RXE_REQ_MASK;
> - struct rxe_dev *rxe = to_rdev(qp->ibqp.device);
> -
> - if ((is_request && (qp->req.state != QP_STATE_READY)) ||
> - (!is_request && (qp->resp.state != QP_STATE_READY))) {
> - pr_info("Packet dropped. QP is not in ready state\n");
> - goto drop;
> - }
> -
> - if (pkt->mask & RXE_LOOPBACK_MASK) {
> - memcpy(SKB_TO_PKT(skb), pkt, sizeof(*pkt));
> - rxe_loopback(skb);
> - err = 0;
> - } else {
> - err = rxe_send(pkt, skb);
> - }
> -
> - if (err) {
> - rxe->xmit_errors++;
> - rxe_counter_inc(rxe, RXE_CNT_SEND_ERR);
> - return err;
> - }
> -
> - if ((qp_type(qp) != IB_QPT_RC) &&
> - (pkt->mask & RXE_END_MASK)) {
> - pkt->wqe->state = wqe_state_done;
> - rxe_run_task(&qp->comp.task, 1);
> - }
> -
> - rxe_counter_inc(rxe, RXE_CNT_SENT_PKTS);
> - goto done;
> -
> -drop:
> - kfree_skb(skb);
> - err = 0;
> -done:
> - return err;
> -}
> -
> #endif /* RXE_LOC_H */
> diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
> index dec92928a1cd..c93a379a1b28 100644
> --- a/drivers/infiniband/sw/rxe/rxe_net.c
> +++ b/drivers/infiniband/sw/rxe/rxe_net.c
> @@ -421,6 +421,49 @@ void rxe_loopback(struct sk_buff *skb)
> rxe_rcv(skb);
> }
>
> +int rxe_xmit_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
> + struct sk_buff *skb)
> +{
> + int err;
> + int is_request = pkt->mask & RXE_REQ_MASK;
> + struct rxe_dev *rxe = to_rdev(qp->ibqp.device);
> +
> + if ((is_request && (qp->req.state != QP_STATE_READY)) ||
> + (!is_request && (qp->resp.state != QP_STATE_READY))) {
> + pr_info("Packet dropped. QP is not in ready state\n");
> + goto drop;
> + }
> +
> + if (pkt->mask & RXE_LOOPBACK_MASK) {
> + memcpy(SKB_TO_PKT(skb), pkt, sizeof(*pkt));
> + rxe_loopback(skb);
> + err = 0;
> + } else {
> + err = rxe_send(pkt, skb);
> + }
> +
> + if (err) {
> + rxe->xmit_errors++;
> + rxe_counter_inc(rxe, RXE_CNT_SEND_ERR);
> + return err;
> + }
> +
> + if ((qp_type(qp) != IB_QPT_RC) &&
> + (pkt->mask & RXE_END_MASK)) {
> + pkt->wqe->state = wqe_state_done;
> + rxe_run_task(&qp->comp.task, 1);
> + }
> +
> + rxe_counter_inc(rxe, RXE_CNT_SENT_PKTS);
> + goto done;
> +
> +drop:
> + kfree_skb(skb);
> + err = 0;
> +done:
> + return err;
> +}
> +
> struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,
> int paylen, struct rxe_pkt_info *pkt)
> {
> --
> 2.30.2
>
next prev parent reply other threads:[~2021-07-14 3:24 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-07 4:00 [PATCH for-next v2 0/9] ICRC cleanup Bob Pearson
2021-07-07 4:00 ` [PATCH v2 1/9] RDMA/rxe: Move ICRC checking to a subroutine Bob Pearson
2021-07-13 7:27 ` Zhu Yanjun
2021-07-16 15:55 ` Jason Gunthorpe
2021-07-07 4:00 ` [PATCH v2 2/9] RDMA/rxe: Move rxe_xmit_packet " Bob Pearson
2021-07-14 3:24 ` Zhu Yanjun [this message]
2021-07-07 4:00 ` [PATCH v2 3/9] RDMA/rxe: Fixup rxe_send and rxe_loopback Bob Pearson
2021-07-07 4:00 ` [PATCH v2 4/9] RDMA/rxe: Move ICRC generation to a subroutine Bob Pearson
2021-07-16 15:57 ` Jason Gunthorpe
2021-07-16 16:08 ` Bob Pearson
2021-07-16 16:29 ` Jason Gunthorpe
2021-07-16 16:38 ` Pearson, Robert B
2021-07-07 4:00 ` [PATCH v2 5/9] RDMA/rxe: Move rxe_crc32 " Bob Pearson
2021-07-07 4:00 ` [PATCH v2 6/9] RDMA/rxe: Fixup rxe_icrc_hdr Bob Pearson
2021-07-07 4:00 ` [PATCH v2 7/9] RDMA/rxe: Move crc32 init code to rxe_icrc.c Bob Pearson
2021-07-07 4:00 ` [PATCH v2 8/9] RDMA/rxe: Add kernel-doc comments " Bob Pearson
2021-07-07 4:00 ` [PATCH v2 9/9] RDMA/rxe: Fix types in rxe_icrc.c Bob Pearson
2021-07-16 16:06 ` Jason Gunthorpe
2021-07-08 7:36 ` [PATCH for-next v2 0/9] ICRC cleanup Zhu Yanjun
2021-07-16 17:38 ` Jason Gunthorpe
2021-07-19 8:42 ` Zhu Yanjun
2021-07-19 15:53 ` Olga Kornievskaia
2021-07-19 17:10 ` Jason Gunthorpe
2021-07-19 21:26 ` Bob Pearson
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='CAD=hENfMtLzYV53xpX-EC=05gZN9ZHp1yb+-g=Yb3E=w-mA01Q@mail.gmail.com' \
--to=zyjzyj2000@gmail.com \
--cc=jgg@nvidia.com \
--cc=linux-rdma@vger.kernel.org \
--cc=rpearsonhpe@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).