diff mbox

[v5,18/20] net/smc: Simplify ib_post_(send|recv|srq_recv)() calls

Message ID 20180718162532.14633-19-bart.vanassche@wdc.com (mailing list archive)
State Accepted
Delegated to: Jason Gunthorpe
Headers show

Commit Message

Bart Van Assche July 18, 2018, 4:25 p.m. UTC
Instead of declaring and passing a dummy 'bad_wr' pointer, pass NULL
as third argument to ib_post_(send|recv|srq_recv)().

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Ursula Braun <ubraun@linux.ibm.com>
---
 net/smc/smc_tx.c | 3 +--
 net/smc/smc_wr.c | 8 ++------
 net/smc/smc_wr.h | 3 +--
 3 files changed, 4 insertions(+), 10 deletions(-)

Comments

Ursula Braun July 19, 2018, 4:23 p.m. UTC | #1
On 07/18/2018 06:25 PM, Bart Van Assche wrote:
> Instead of declaring and passing a dummy 'bad_wr' pointer, pass NULL
> as third argument to ib_post_(send|recv|srq_recv)().
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
> Cc: Ursula Braun <ubraun@linux.ibm.com>

Looks good, thanks!

Acked-by: Ursula Braun <ubraun@linux.ibm.com>

> ---
>  net/smc/smc_tx.c | 3 +--
>  net/smc/smc_wr.c | 8 ++------
>  net/smc/smc_wr.h | 3 +--
>  3 files changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/net/smc/smc_tx.c b/net/smc/smc_tx.c
> index cee666400752..a171c168f98e 100644
> --- a/net/smc/smc_tx.c
> +++ b/net/smc/smc_tx.c
> @@ -255,7 +255,6 @@ static int smc_tx_rdma_write(struct smc_connection *conn, int peer_rmbe_offset,
>  			     int num_sges, struct ib_sge sges[])
>  {
>  	struct smc_link_group *lgr = conn->lgr;
> -	struct ib_send_wr *failed_wr = NULL;
>  	struct ib_rdma_wr rdma_wr;
>  	struct smc_link *link;
>  	int rc;
> @@ -273,7 +272,7 @@ static int smc_tx_rdma_write(struct smc_connection *conn, int peer_rmbe_offset,
>  		/* offset within RMBE */
>  		peer_rmbe_offset;
>  	rdma_wr.rkey = lgr->rtokens[conn->rtoken_idx][SMC_SINGLE_LINK].rkey;
> -	rc = ib_post_send(link->roce_qp, &rdma_wr.wr, &failed_wr);
> +	rc = ib_post_send(link->roce_qp, &rdma_wr.wr, NULL);
>  	if (rc) {
>  		conn->local_tx_ctrl.conn_state_flags.peer_conn_abort = 1;
>  		smc_lgr_terminate(lgr);
> diff --git a/net/smc/smc_wr.c b/net/smc/smc_wr.c
> index 8b9bdd9bc615..de1a438cf977 100644
> --- a/net/smc/smc_wr.c
> +++ b/net/smc/smc_wr.c
> @@ -240,15 +240,13 @@ int smc_wr_tx_put_slot(struct smc_link *link,
>   */
>  int smc_wr_tx_send(struct smc_link *link, struct smc_wr_tx_pend_priv *priv)
>  {
> -	struct ib_send_wr *failed_wr = NULL;
>  	struct smc_wr_tx_pend *pend;
>  	int rc;
>  
>  	ib_req_notify_cq(link->smcibdev->roce_cq_send,
>  			 IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS);
>  	pend = container_of(priv, struct smc_wr_tx_pend, priv);
> -	rc = ib_post_send(link->roce_qp, &link->wr_tx_ibs[pend->idx],
> -			  &failed_wr);
> +	rc = ib_post_send(link->roce_qp, &link->wr_tx_ibs[pend->idx], NULL);
>  	if (rc) {
>  		struct smc_link_group *lgr =
>  			container_of(link, struct smc_link_group,
> @@ -263,7 +261,6 @@ int smc_wr_tx_send(struct smc_link *link, struct smc_wr_tx_pend_priv *priv)
>  /* Register a memory region and wait for result. */
>  int smc_wr_reg_send(struct smc_link *link, struct ib_mr *mr)
>  {
> -	struct ib_send_wr *failed_wr = NULL;
>  	int rc;
>  
>  	ib_req_notify_cq(link->smcibdev->roce_cq_send,
> @@ -272,8 +269,7 @@ int smc_wr_reg_send(struct smc_link *link, struct ib_mr *mr)
>  	link->wr_reg.wr.wr_id = (u64)(uintptr_t)mr;
>  	link->wr_reg.mr = mr;
>  	link->wr_reg.key = mr->rkey;
> -	failed_wr = &link->wr_reg.wr;
> -	rc = ib_post_send(link->roce_qp, &link->wr_reg.wr, &failed_wr);
> +	rc = ib_post_send(link->roce_qp, &link->wr_reg.wr, NULL);
>  	if (rc)
>  		return rc;
>  
> diff --git a/net/smc/smc_wr.h b/net/smc/smc_wr.h
> index 210bec3c3ebe..1d85bb14fd6f 100644
> --- a/net/smc/smc_wr.h
> +++ b/net/smc/smc_wr.h
> @@ -63,7 +63,6 @@ static inline void smc_wr_tx_set_wr_id(atomic_long_t *wr_tx_id, long val)
>  /* post a new receive work request to fill a completed old work request entry */
>  static inline int smc_wr_rx_post(struct smc_link *link)
>  {
> -	struct ib_recv_wr *bad_recv_wr = NULL;
>  	int rc;
>  	u64 wr_id, temp_wr_id;
>  	u32 index;
> @@ -72,7 +71,7 @@ static inline int smc_wr_rx_post(struct smc_link *link)
>  	temp_wr_id = wr_id;
>  	index = do_div(temp_wr_id, link->wr_rx_cnt);
>  	link->wr_rx_ibs[index].wr_id = wr_id;
> -	rc = ib_post_recv(link->roce_qp, &link->wr_rx_ibs[index], &bad_recv_wr);
> +	rc = ib_post_recv(link->roce_qp, &link->wr_rx_ibs[index], NULL);
>  	return rc;
>  }
>  
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/smc/smc_tx.c b/net/smc/smc_tx.c
index cee666400752..a171c168f98e 100644
--- a/net/smc/smc_tx.c
+++ b/net/smc/smc_tx.c
@@ -255,7 +255,6 @@  static int smc_tx_rdma_write(struct smc_connection *conn, int peer_rmbe_offset,
 			     int num_sges, struct ib_sge sges[])
 {
 	struct smc_link_group *lgr = conn->lgr;
-	struct ib_send_wr *failed_wr = NULL;
 	struct ib_rdma_wr rdma_wr;
 	struct smc_link *link;
 	int rc;
@@ -273,7 +272,7 @@  static int smc_tx_rdma_write(struct smc_connection *conn, int peer_rmbe_offset,
 		/* offset within RMBE */
 		peer_rmbe_offset;
 	rdma_wr.rkey = lgr->rtokens[conn->rtoken_idx][SMC_SINGLE_LINK].rkey;
-	rc = ib_post_send(link->roce_qp, &rdma_wr.wr, &failed_wr);
+	rc = ib_post_send(link->roce_qp, &rdma_wr.wr, NULL);
 	if (rc) {
 		conn->local_tx_ctrl.conn_state_flags.peer_conn_abort = 1;
 		smc_lgr_terminate(lgr);
diff --git a/net/smc/smc_wr.c b/net/smc/smc_wr.c
index 8b9bdd9bc615..de1a438cf977 100644
--- a/net/smc/smc_wr.c
+++ b/net/smc/smc_wr.c
@@ -240,15 +240,13 @@  int smc_wr_tx_put_slot(struct smc_link *link,
  */
 int smc_wr_tx_send(struct smc_link *link, struct smc_wr_tx_pend_priv *priv)
 {
-	struct ib_send_wr *failed_wr = NULL;
 	struct smc_wr_tx_pend *pend;
 	int rc;
 
 	ib_req_notify_cq(link->smcibdev->roce_cq_send,
 			 IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS);
 	pend = container_of(priv, struct smc_wr_tx_pend, priv);
-	rc = ib_post_send(link->roce_qp, &link->wr_tx_ibs[pend->idx],
-			  &failed_wr);
+	rc = ib_post_send(link->roce_qp, &link->wr_tx_ibs[pend->idx], NULL);
 	if (rc) {
 		struct smc_link_group *lgr =
 			container_of(link, struct smc_link_group,
@@ -263,7 +261,6 @@  int smc_wr_tx_send(struct smc_link *link, struct smc_wr_tx_pend_priv *priv)
 /* Register a memory region and wait for result. */
 int smc_wr_reg_send(struct smc_link *link, struct ib_mr *mr)
 {
-	struct ib_send_wr *failed_wr = NULL;
 	int rc;
 
 	ib_req_notify_cq(link->smcibdev->roce_cq_send,
@@ -272,8 +269,7 @@  int smc_wr_reg_send(struct smc_link *link, struct ib_mr *mr)
 	link->wr_reg.wr.wr_id = (u64)(uintptr_t)mr;
 	link->wr_reg.mr = mr;
 	link->wr_reg.key = mr->rkey;
-	failed_wr = &link->wr_reg.wr;
-	rc = ib_post_send(link->roce_qp, &link->wr_reg.wr, &failed_wr);
+	rc = ib_post_send(link->roce_qp, &link->wr_reg.wr, NULL);
 	if (rc)
 		return rc;
 
diff --git a/net/smc/smc_wr.h b/net/smc/smc_wr.h
index 210bec3c3ebe..1d85bb14fd6f 100644
--- a/net/smc/smc_wr.h
+++ b/net/smc/smc_wr.h
@@ -63,7 +63,6 @@  static inline void smc_wr_tx_set_wr_id(atomic_long_t *wr_tx_id, long val)
 /* post a new receive work request to fill a completed old work request entry */
 static inline int smc_wr_rx_post(struct smc_link *link)
 {
-	struct ib_recv_wr *bad_recv_wr = NULL;
 	int rc;
 	u64 wr_id, temp_wr_id;
 	u32 index;
@@ -72,7 +71,7 @@  static inline int smc_wr_rx_post(struct smc_link *link)
 	temp_wr_id = wr_id;
 	index = do_div(temp_wr_id, link->wr_rx_cnt);
 	link->wr_rx_ibs[index].wr_id = wr_id;
-	rc = ib_post_recv(link->roce_qp, &link->wr_rx_ibs[index], &bad_recv_wr);
+	rc = ib_post_recv(link->roce_qp, &link->wr_rx_ibs[index], NULL);
 	return rc;
 }