forked from mirrors/linux
		
	net/smc: no WR buffer wait for terminating link group
Avoid waiting for a free work request buffer, if the link group is already terminating. Signed-off-by: Ursula Braun <ubraun@linux.ibm.com> Signed-off-by: Karsten Graul <kgraul@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									5edd6b9cb8
								
							
						
					
					
						commit
						15e1b99aad
					
				
					 3 changed files with 19 additions and 4 deletions
				
			
		| 
						 | 
					@ -656,6 +656,7 @@ void smc_llc_link_active(struct smc_link *link, int testlink_time)
 | 
				
			||||||
void smc_llc_link_deleting(struct smc_link *link)
 | 
					void smc_llc_link_deleting(struct smc_link *link)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	link->state = SMC_LNK_DELETING;
 | 
						link->state = SMC_LNK_DELETING;
 | 
				
			||||||
 | 
						smc_wr_wakeup_tx_wait(link);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* called in tasklet context */
 | 
					/* called in tasklet context */
 | 
				
			||||||
| 
						 | 
					@ -663,6 +664,8 @@ void smc_llc_link_inactive(struct smc_link *link)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	link->state = SMC_LNK_INACTIVE;
 | 
						link->state = SMC_LNK_INACTIVE;
 | 
				
			||||||
	cancel_delayed_work(&link->llc_testlink_wrk);
 | 
						cancel_delayed_work(&link->llc_testlink_wrk);
 | 
				
			||||||
 | 
						smc_wr_wakeup_reg_wait(link);
 | 
				
			||||||
 | 
						smc_wr_wakeup_tx_wait(link);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* called in worker context */
 | 
					/* called in worker context */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -75,7 +75,7 @@ static inline void smc_wr_tx_process_cqe(struct ib_wc *wc)
 | 
				
			||||||
			link->wr_reg_state = FAILED;
 | 
								link->wr_reg_state = FAILED;
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			link->wr_reg_state = CONFIRMED;
 | 
								link->wr_reg_state = CONFIRMED;
 | 
				
			||||||
		wake_up(&link->wr_reg_wait);
 | 
							smc_wr_wakeup_reg_wait(link);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -171,6 +171,7 @@ int smc_wr_tx_get_free_slot(struct smc_link *link,
 | 
				
			||||||
			    struct smc_rdma_wr **wr_rdma_buf,
 | 
								    struct smc_rdma_wr **wr_rdma_buf,
 | 
				
			||||||
			    struct smc_wr_tx_pend_priv **wr_pend_priv)
 | 
								    struct smc_wr_tx_pend_priv **wr_pend_priv)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						struct smc_link_group *lgr = smc_get_lgr(link);
 | 
				
			||||||
	struct smc_wr_tx_pend *wr_pend;
 | 
						struct smc_wr_tx_pend *wr_pend;
 | 
				
			||||||
	u32 idx = link->wr_tx_cnt;
 | 
						u32 idx = link->wr_tx_cnt;
 | 
				
			||||||
	struct ib_send_wr *wr_ib;
 | 
						struct ib_send_wr *wr_ib;
 | 
				
			||||||
| 
						 | 
					@ -179,19 +180,20 @@ int smc_wr_tx_get_free_slot(struct smc_link *link,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	*wr_buf = NULL;
 | 
						*wr_buf = NULL;
 | 
				
			||||||
	*wr_pend_priv = NULL;
 | 
						*wr_pend_priv = NULL;
 | 
				
			||||||
	if (in_softirq()) {
 | 
						if (in_softirq() || lgr->terminating) {
 | 
				
			||||||
		rc = smc_wr_tx_get_free_slot_index(link, &idx);
 | 
							rc = smc_wr_tx_get_free_slot_index(link, &idx);
 | 
				
			||||||
		if (rc)
 | 
							if (rc)
 | 
				
			||||||
			return rc;
 | 
								return rc;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		rc = wait_event_timeout(
 | 
							rc = wait_event_interruptible_timeout(
 | 
				
			||||||
			link->wr_tx_wait,
 | 
								link->wr_tx_wait,
 | 
				
			||||||
			link->state == SMC_LNK_INACTIVE ||
 | 
								link->state == SMC_LNK_INACTIVE ||
 | 
				
			||||||
 | 
								lgr->terminating ||
 | 
				
			||||||
			(smc_wr_tx_get_free_slot_index(link, &idx) != -EBUSY),
 | 
								(smc_wr_tx_get_free_slot_index(link, &idx) != -EBUSY),
 | 
				
			||||||
			SMC_WR_TX_WAIT_FREE_SLOT_TIME);
 | 
								SMC_WR_TX_WAIT_FREE_SLOT_TIME);
 | 
				
			||||||
		if (!rc) {
 | 
							if (!rc) {
 | 
				
			||||||
			/* timeout - terminate connections */
 | 
								/* timeout - terminate connections */
 | 
				
			||||||
			smc_lgr_terminate_sched(smc_get_lgr(link));
 | 
								smc_lgr_terminate_sched(lgr);
 | 
				
			||||||
			return -EPIPE;
 | 
								return -EPIPE;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (idx == link->wr_tx_cnt)
 | 
							if (idx == link->wr_tx_cnt)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -60,6 +60,16 @@ static inline void smc_wr_tx_set_wr_id(atomic_long_t *wr_tx_id, long val)
 | 
				
			||||||
	atomic_long_set(wr_tx_id, val);
 | 
						atomic_long_set(wr_tx_id, val);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static inline void smc_wr_wakeup_tx_wait(struct smc_link *lnk)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						wake_up_all(&lnk->wr_tx_wait);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static inline void smc_wr_wakeup_reg_wait(struct smc_link *lnk)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						wake_up(&lnk->wr_reg_wait);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* post a new receive work request to fill a completed old work request entry */
 | 
					/* 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)
 | 
					static inline int smc_wr_rx_post(struct smc_link *link)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue