FreeBSD/sys/dev/ixl/ixl_pf_main.c
/*
** Tasklet handler for MSIX Adminq interrupts
**  - do outside interrupt since it might sleep
*/
Tasklet handler for MSIX Adminq interrupts
do outside interrupt since it might sleep
Tasklet handler for MSIX Adminq interrupts do outside interrupt since it might sleep
void
ixl_do_adminq(void *context, int pending)
{
	struct ixl_pf			*pf = context;
	struct i40e_hw			*hw = &pf->hw;
	struct i40e_arq_event_info	event;
	i40e_status			ret;
	device_t			dev = pf->dev;
	u32				loop = 0;
	u16				opcode, result;
	if (pf->state & IXL_PF_STATE_EMPR_RESETTING) {
		ixl_handle_empr_reset(pf);
		return;
	}
	event.buf_len = IXL_AQ_BUF_SZ;
	event.msg_buf = malloc(event.buf_len,
	    M_DEVBUF, M_NOWAIT | M_ZERO);
	if (!event.msg_buf) {
		device_printf(dev, "%s: Unable to allocate memory for Admin"
		    " Queue event!\n", __func__);
		return;
	}
	IXL_PF_LOCK(pf);
	do {
		ret = i40e_clean_arq_element(hw, &event, &result);
		if (ret)
			break;
		opcode = LE16_TO_CPU(event.desc.opcode);
		ixl_dbg(pf, IXL_DBG_AQ,
		    "%s: Admin Queue event: %#06x\n", __func__, opcode);
		switch (opcode) {
		case i40e_aqc_opc_get_link_status:
			ixl_link_event(pf, &event);
			break;
		case i40e_aqc_opc_send_msg_to_pf:
#ifdef PCI_IOV
			ixl_handle_vf_msg(pf, &event);
#endif
			break;
		case i40e_aqc_opc_event_lan_overflow:
		default:
			break;
		}
	} while (result && (loop++ < IXL_ADM_LIMIT));
	free(event.msg_buf, M_DEVBUF);
	if (result > 0)
		taskqueue_enqueue(pf->tq, &pf->adminq);
	else
		ixl_enable_adminq(hw);
	IXL_PF_UNLOCK(pf);
}
void ixl_do_adminq ( void * context , int pending ) { struct ixl_pf * pf = context ; struct i40e_hw * hw = & pf -> hw ; struct i40e_arq_event_info event ; i40e_status ret ; device_t dev = pf -> dev ; u32 loop = 0 ; u16 opcode , result ; if ( pf -> state & IXL_PF_STATE_EMPR_RESETTING ) { ixl_handle_empr_reset ( pf ) ; return ; } event . buf_len = IXL_AQ_BUF_SZ ; event . msg_buf = malloc ( event . buf_len , M_DEVBUF , M_NOWAIT | M_ZERO ) ; if ( ! event . msg_buf ) { device_printf ( dev , " " " \n " , __func__ ) ; return ; } IXL_PF_LOCK ( pf ) ; do { ret = i40e_clean_arq_element ( hw , & event , & result ) ; if ( ret ) break ; opcode = LE16_TO_CPU ( event . desc . opcode ) ; ixl_dbg ( pf , IXL_DBG_AQ , " \n " , __func__ , opcode ) ; switch ( opcode ) { case i40e_aqc_opc_get_link_status : ixl_link_event ( pf , & event ) ; break ; case i40e_aqc_opc_send_msg_to_pf : #ifdef PCI_IOV ixl_handle_vf_msg ( pf , & event ) ; #endif break ; case i40e_aqc_opc_event_lan_overflow : default : break ; } } while ( result && ( loop ++ < IXL_ADM_LIMIT ) ) ; free ( event . msg_buf , M_DEVBUF ) ; if ( result > 0 ) taskqueue_enqueue ( pf -> tq , & pf -> adminq ) ; else ixl_enable_adminq ( hw ) ; IXL_PF_UNLOCK ( pf ) ; }
Tasklet handler for MSIX Adminq interrupts
 do outside interrupt since it might sleep
Tasklet handler for MSIX Adminq interrupts do outside interrupt since it might sleep
/* Flag cleared at end of this function */ /* Admin Queue handling */ /* clean and process any events */ /*
	 * If there are still messages to process, reschedule ourselves.
	 * Otherwise, re-enable our interrupt.
	 */