Re: [PATCH v2 2/9] RDMA/rxe: Move rxe_xmit_packet to a subroutine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 7, 2021 at 12:01 PM Bob Pearson <rpearsonhpe@xxxxxxxxx> 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@xxxxxxxxx>

Zhu Yanjun

>
> Signed-off-by: Bob Pearson <rpearsonhpe@xxxxxxxxx>
> ---
>  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
>



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux