staging/rdma/hfi1: Reduce number of parameters passed to send handlers
Subsystems (2)
PATCH 1/1 staging/rdma/hfi1: Reduce number of parameters passed to send handlers
From: Dennis Dalessandro <[email protected]>
The current send function handlers are passed a bunch of parameters that are already part of the data structure that is passed in first (qp). This patch removes all of this and just passes the QP.
--- drivers/staging/rdma/hfi1/diag.c | 27 ++++++++++--------- drivers/staging/rdma/hfi1/hfi.h | 20 ++++++-------- drivers/staging/rdma/hfi1/ruc.c | 15 ++++++----- drivers/staging/rdma/hfi1/verbs.c | 55 ++++++++++++++++++--------------------- drivers/staging/rdma/hfi1/verbs.h | 23 ++++++++++------ 5 files changed, 71 insertions(+), 69 deletions(-)
drivers/staging/rdma/hfi1/diag.c +14 -13
@@ -1618,14 +1618,12 @@ int snoop_recv_handler(struct hfi1_packet *packet)/* * Handle snooping and capturing packets when sdma is being used. */ -int snoop_send_dma_handler (struct hfi1_qp *qp,struct ahg_ib_header *ibhdr, -u32 hdrwords,struct hfi1_sge_state *ss,u32 len, -u32 plen,u32 dwords,u64 pbc) +int snoop_send_dma_handler (struct hfi1_qp *qp,struct hfi1_pkt_state *ps, +u64 pbc) { -pr_alert ("Snooping/Capture of Send DMA Packets Is Not Supported!\n" ); +pr_alert ("Snooping/Capture of Send DMA Packets Is Not Supported!\n" );snoop_dbg ("Unsupported Operation" ); -return hfi1_verbs_send_dma (qp, ibhdr, hdrwords, ss, len, plen, dwords, -0 ); +return hfi1_verbs_send_dma (qp, ps,0 ); }/*
@@ -1633,12 +1631,16 @@ int snoop_send_dma_handler(struct hfi1_qp *qp, struct ahg_ib_header *ibhdr,* bypass packets. The only way to send a bypass packet currently is to use the * diagpkt interface. When that interface is enable snoop/capture is not. */ -int snoop_send_pio_handler (struct hfi1_qp *qp,struct ahg_ib_header *ahdr, -u32 hdrwords,struct hfi1_sge_state *ss,u32 len, -u32 plen,u32 dwords,u64 pbc) +int snoop_send_pio_handler (struct hfi1_qp *qp,struct hfi1_pkt_state *ps, +u64 pbc) { -struct hfi1_ibport *ibp =to_iport (qp->ibqp.device, qp->port_num); -struct hfi1_pportdata *ppd =ppd_from_ibp (ibp); +struct ahg_ib_header *ahdr = qp->s_hdr; +u32 hdrwords = qp->s_hdrwords; +struct hfi1_sge_state *ss = qp->s_cur_sge; +u32 len = qp->s_cur_size; +u32 dwords = (len +3 ) >>2 ; +u32 plen = hdrwords + dwords +2 ;/* includes pbc */ +struct hfi1_pportdata *ppd = ps->ppd;struct snoop_packet *s_packet =NULL ;u32 *hdr = (u32 *)&ahdr->ibh;u32 length =0 ;
@@ -1783,8 +1785,7 @@ int snoop_send_pio_handler(struct hfi1_qp *qp, struct ahg_ib_header *ahdr,break ; } out: -return hfi1_verbs_send_pio (qp, ahdr, hdrwords, ss, len, plen, dwords, - md.u.pbc); +return hfi1_verbs_send_pio (qp, ps, md.u.pbc); }/*
drivers/staging/rdma/hfi1/hfi.h +8 -12
@@ -1048,12 +1048,10 @@ struct hfi1_devdata {* Handlers for outgoing data so that snoop/capture does not * have to have its hooks in the send path */ -int (*process_pio_send)(struct hfi1_qp *qp,struct ahg_ib_header *ibhdr, -u32 hdrwords,struct hfi1_sge_state *ss, -u32 len,u32 plen,u32 dwords,u64 pbc); -int (*process_dma_send)(struct hfi1_qp *qp,struct ahg_ib_header *ibhdr, -u32 hdrwords,struct hfi1_sge_state *ss, -u32 len,u32 plen,u32 dwords,u64 pbc); +int (*process_pio_send)(struct hfi1_qp *qp,struct hfi1_pkt_state *ps, +u64 pbc); +int (*process_dma_send)(struct hfi1_qp *qp,struct hfi1_pkt_state *ps, +u64 pbc);void (*pio_inline_send)(struct hfi1_devdata *dd,struct pio_buf *pbuf,u64 pbc,const void *from,size_t count);
@@ -1401,12 +1399,10 @@ void reset_link_credits(struct hfi1_devdata *dd);void assign_remote_cm_au_table (struct hfi1_devdata *dd,u8 vcu);int snoop_recv_handler (struct hfi1_packet *packet); -int snoop_send_dma_handler (struct hfi1_qp *qp,struct ahg_ib_header *ibhdr, -u32 hdrwords,struct hfi1_sge_state *ss,u32 len, -u32 plen,u32 dwords,u64 pbc); -int snoop_send_pio_handler (struct hfi1_qp *qp,struct ahg_ib_header *ibhdr, -u32 hdrwords,struct hfi1_sge_state *ss,u32 len, -u32 plen,u32 dwords,u64 pbc); +int snoop_send_dma_handler (struct hfi1_qp *qp,struct hfi1_pkt_state *ps, +u64 pbc); +int snoop_send_pio_handler (struct hfi1_qp *qp,struct hfi1_pkt_state *ps, +u64 pbc);void snoop_inline_pio_send (struct hfi1_devdata *dd,struct pio_buf *pbuf,u64 pbc,const void *from,size_t count);
drivers/staging/rdma/hfi1/ruc.c +9 -6
@@ -809,16 +809,20 @@ void hfi1_do_send(struct work_struct *work) { struct iowait *wait = container_of(work, struct iowait, iowork); struct hfi1_qp *qp = container_of(wait, struct hfi1_qp, s_iowait); -struct hfi1_ibport *ibp =to_iport (qp->ibqp.device, qp->port_num); -struct hfi1_pportdata *ppd =ppd_from_ibp (ibp); +struct hfi1_pkt_state ps;int (*make_req)(struct hfi1_qp *qp);unsigned long flags;unsigned long timeout; + ps.dev =to_idev (qp->ibqp.device); + ps.ibp =to_iport (qp->ibqp.device, qp->port_num); + ps.ppd =ppd_from_ibp (ps.ibp); +if ((qp->ibqp.qp_type ==IB_QPT_RC || qp->ibqp.qp_type ==IB_QPT_UC ) && !loopback && - (qp->remote_ah_attr.dlid & ~((1 << ppd->lmc) -1 )) == ppd->lid) { + (qp->remote_ah_attr.dlid & ~((1 << ps.ppd->lmc) -1 )) == + ps.ppd->lid) {ruc_loopback (qp);return ; }
@@ -850,8 +854,7 @@ void hfi1_do_send(struct work_struct *work)* If the packet cannot be sent now, return and * the send tasklet will be woken up later. */ -if (hfi1_verbs_send (qp, qp->s_hdr, qp->s_hdrwords, - qp->s_cur_sge, qp->s_cur_size)) +if (hfi1_verbs_send (qp, &ps))break ;/* Record that s_hdr is empty. */ qp->s_hdrwords =0 ;
@@ -860,7 +863,7 @@ void hfi1_do_send(struct work_struct *work)/* allow other tasks to run */ if (unlikely (time_after (jiffies, timeout))) {cond_resched (); - ppd->dd->verbs_dev.n_send_schedule++; + ps.ppd->dd->verbs_dev.n_send_schedule++; timeout = jiffies +SEND_RESCHED_TIMEOUT ; } }while (make_req (qp));
drivers/staging/rdma/hfi1/verbs.c +25 -30
96 lines not on this page · raw message
drivers/staging/rdma/hfi1/verbs.h +15 -8
@@ -540,6 +540,16 @@ struct hfi1_qp { };/* +* This structure is used to hold commonly lookedup and computed values during +* the send engine progress. +*/ +struct hfi1_pkt_state { +struct hfi1_ibdev *dev; +struct hfi1_ibport *ibp; +struct hfi1_pportdata *ppd; +}; + +/* * Atomic bit definitions for r_aflags. */ #define HFI1_R_WRID_VALID 0
@@ -922,8 +932,7 @@ int hfi1_mcast_tree_empty(struct hfi1_ibport *ibp);struct verbs_txreq ;void hfi1_put_txreq (struct verbs_txreq *tx); -int hfi1_verbs_send (struct hfi1_qp *qp,struct ahg_ib_header *ahdr, -u32 hdrwords,struct hfi1_sge_state *ss,u32 len); +int hfi1_verbs_send (struct hfi1_qp *qp,struct hfi1_pkt_state *ps);void hfi1_copy_sge (struct hfi1_sge_state *ss,void *data,u32 length,int release);
@@ -1101,13 +1110,11 @@ void hfi1_ib_rcv(struct hfi1_packet *packet);unsigned hfi1_get_npkeys (struct hfi1_devdata *); -int hfi1_verbs_send_dma (struct hfi1_qp *qp,struct ahg_ib_header *hdr, -u32 hdrwords,struct hfi1_sge_state *ss,u32 len, -u32 plen,u32 dwords,u64 pbc); +int hfi1_verbs_send_dma (struct hfi1_qp *qp,struct hfi1_pkt_state *ps, +u64 pbc); -int hfi1_verbs_send_pio (struct hfi1_qp *qp,struct ahg_ib_header *hdr, -u32 hdrwords,struct hfi1_sge_state *ss,u32 len, -u32 plen,u32 dwords,u64 pbc); +int hfi1_verbs_send_pio (struct hfi1_qp *qp,struct hfi1_pkt_state *ps, +u64 pbc);struct send_context *qp_to_send_context (struct hfi1_qp *qp,u8 sc5);
Signature · 6 lines
1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1447220077-8325-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
drivers/staging/rdma/hfi1/diag.c int snoop_recv_handler(struct hfi1_packet *packet) · line 1625
Quoted 8 lines · On Wed, Nov 11, 2015 at 12:34:37AM -0500…
From: Dennis Dalessandro <[email protected]>
drivers/staging/rdma/hfi1/diag.c +3
-1+int snoop_send_dma_handler (struct hfi1_qp *qp,struct hfi1_pkt_state *ps, +u64 pbc) { -pr_alert ("Snooping/Capture of Send DMA Packets Is Not Supported!\n" ); +pr_alert ("Snooping/Capture of Send DMA Packets Is Not Supported!\n" );snoop_dbg ("Unsupported Operation" );
Is it really necessary to do both print alert to message log (pr_alert) and to trace buffer (snoop_dbg)?
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20151111062535.GG4023-2ukJVAZIZ/[email protected]
Quoted 11 lines · Leon Romanovsky
drivers/staging/rdma/hfi1/diag.c int snoop_recv_handler(struct hfi1_packet *packet) · line 1625
Quoted 8 lines · On Wed, Nov 11, 2015 at 12:34:37AM -0500…
From: Dennis Dalessandro <[email protected]>
drivers/staging/rdma/hfi1/diag.c +3
-1+int snoop_send_dma_handler (struct hfi1_qp *qp,struct hfi1_pkt_state *ps, +u64 pbc) { -pr_alert ("Snooping/Capture of Send DMA Packets Is Not Supported!\n" ); +pr_alert ("Snooping/Capture of Send DMA Packets Is Not Supported!\n" );snoop_dbg ("Unsupported Operation" );Is it really necessary to do both print alert to message log (
pr_alert) and to trace buffer (snoop_dbg)?
Well yes, and no. They serve two different purposes. One for users of the snoop feature the other for developers.
However, I don't think we really even need to keep this function around anymore. How about we just remove it in a follow on patch, and let this one stand as is?
-Denny
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20151111133907.GA21044-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org
Quoted 13 lines · Dennis Dalessandro
Quoted 11 lines · Leon Romanovsky
Quoted 8 lines · On Wed, Nov 11, 2015 at 12:34:37AM -0500…
From: Dennis Dalessandro <[email protected]>
drivers/staging/rdma/hfi1/diag.c +2
-0+int snoop_send_dma_handler (struct hfi1_qp *qp,struct hfi1_pkt_state *ps, +u64 pbc){
drivers/staging/rdma/hfi1/diag.c +1
-1-pr_alert ("Snooping/Capture of Send DMA Packets Is Not Supported!\n" ); +pr_alert ("Snooping/Capture of Send DMA Packets Is Not Supported!\n" );snoop_dbg("Unsupported Operation");Is it really necessary to do both print alert to message log (
pr_alert) and to trace buffer (snoop_dbg)?
Quoted 6 lines
Well yes, and no. They serve two different purposes. One for users of the snoop feature the other for developers.
However, I don't think we really even need to keep this function around anymore. How about we just remove it in a follow on patch, and let this one stand as is?
Sure, I'm fine with that.
Quoted 2 lines
-Denny
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 8 lines · Dennis Dalessandro
Quoted 7 lines · Leon Romanovsky
Quoted 6 lines · On Wed, Nov 11, 2015 at 12:34:37AM -0500…
From: Dennis Dalessandro <[email protected]>
drivers/staging/rdma/hfi1/diag.c +1
-1+int snoop_send_dma_handler(struct hfi1_qp *qp, struct hfi1_pkt_state *ps, - pr_alert("Snooping/Capture of Send DMA Packets Is NotSupported!\n");
+pr_alert("Snooping/Capture of Send DMA Packets Is Not Supported!\n");
Dennis, can we have less camelcase sort of speak in this upstream driver? this is linux here not windowZ.
Quoted 2 lines
Well yes, and no. They serve two different purposes. One for users of the snoop feature the other for developers.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): CAJ3xEMiaKkPX0gjTYqvdSjiHqiXSxGuPL=t8yfkwpamGa0+e3w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 7 lines · Or Gerlitz
Quoted 4 lines · Dennis Dalessandro
Quoted 3 lines · Leon Romanovsky
Quoted 2 lines · On Wed, Nov 11, 2015 at 12:34:37AM -0500…
From: Dennis Dalessandro <[email protected]> +int snoop_send_dma_handler(struct
hfi1_qp*qp, structhfi1_pkt_state*ps,
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
- pr_alert("Snooping/Capture of Send DMA Packets Is Not
Supported!\n");
+pr_alert("Snooping/Capture of Send DMA Packets Is Not Supported!\n");Dennis, can we have less camelcase sort of speak in this upstream driver? this is linux here not windowZ.
I plan to just remove this function.
See: http://www.spinics.net/lists/linux-rdma/msg30244.html
-Denny
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20151112132538.GA23251-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org
Quoted 7 lines · Dennis Dalessandro
Quoted 2 lines · Or Gerlitz
Dennis, can we have less camelcase sort of speak in this upstream driver? this is linux here not windowZ.
I plan to just remove this function.
See: http://www.spinics.net/lists/linux-rdma/msg30244.html
my comment was general
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html