Commit 62661038 authored by Mike Marciniszyn's avatar Mike Marciniszyn Committed by Jason Gunthorpe

IB/hfi1: Create API for auto activate

Add an auto activate routine for use by the interrupt handler.

Link: https://lore.kernel.org/r/20200106134210.119356.43079.stgit@awfm-01.aw.intel.comReviewed-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: default avatarKaike Wan <kaike.wan@intel.com>
Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent cd47b594
...@@ -924,11 +924,8 @@ void set_all_slowpath(struct hfi1_devdata *dd) ...@@ -924,11 +924,8 @@ void set_all_slowpath(struct hfi1_devdata *dd)
} }
} }
static inline int set_armed_to_active(struct hfi1_ctxtdata *rcd, static bool __set_armed_to_active(struct hfi1_packet *packet)
struct hfi1_packet *packet,
struct hfi1_devdata *dd)
{ {
struct work_struct *lsaw = &rcd->ppd->linkstate_active_work;
u8 etype = rhf_rcv_type(packet->rhf); u8 etype = rhf_rcv_type(packet->rhf);
u8 sc = SC15_PACKET; u8 sc = SC15_PACKET;
...@@ -943,19 +940,34 @@ static inline int set_armed_to_active(struct hfi1_ctxtdata *rcd, ...@@ -943,19 +940,34 @@ static inline int set_armed_to_active(struct hfi1_ctxtdata *rcd,
sc = hfi1_16B_get_sc(hdr); sc = hfi1_16B_get_sc(hdr);
} }
if (sc != SC15_PACKET) { if (sc != SC15_PACKET) {
int hwstate = driver_lstate(rcd->ppd); int hwstate = driver_lstate(packet->rcd->ppd);
struct work_struct *lsaw =
&packet->rcd->ppd->linkstate_active_work;
if (hwstate != IB_PORT_ACTIVE) { if (hwstate != IB_PORT_ACTIVE) {
dd_dev_info(dd, dd_dev_info(packet->rcd->dd,
"Unexpected link state %s\n", "Unexpected link state %s\n",
opa_lstate_name(hwstate)); opa_lstate_name(hwstate));
return 0; return false;
} }
queue_work(rcd->ppd->link_wq, lsaw); queue_work(packet->rcd->ppd->link_wq, lsaw);
return 1; return true;
} }
return 0; return false;
}
/**
* armed to active - the fast path for armed to active
* @packet: the packet structure
*
* Return true if packet processing needs to bail.
*/
static bool set_armed_to_active(struct hfi1_packet *packet)
{
if (likely(packet->rcd->ppd->host_link_state != HLS_UP_ARMED))
return false;
return __set_armed_to_active(packet);
} }
/* /*
...@@ -1016,10 +1028,7 @@ int handle_receive_interrupt(struct hfi1_ctxtdata *rcd, int thread) ...@@ -1016,10 +1028,7 @@ int handle_receive_interrupt(struct hfi1_ctxtdata *rcd, int thread)
last = skip_rcv_packet(&packet, thread); last = skip_rcv_packet(&packet, thread);
skip_pkt = 0; skip_pkt = 0;
} else { } else {
/* Auto activate link on non-SC15 packet receive */ if (set_armed_to_active(&packet))
if (unlikely(rcd->ppd->host_link_state ==
HLS_UP_ARMED) &&
set_armed_to_active(rcd, &packet, dd))
goto bail; goto bail;
last = process_rcv_packet(&packet, thread); last = process_rcv_packet(&packet, thread);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment