FreeBSD/sys/dev/ixl/ixlvc.c
/*
** ixlv_configure_queues
**
** Request that the PF set up our queues.
*/
ixlv_configure_queues
Request that the PF set up our queues.
ixlv_configure_queues Request that the PF set up our queues .
void
ixlv_configure_queues(struct ixlv_sc *sc)
{
	device_t		dev = sc->dev;
	struct ixl_vsi		*vsi = &sc->vsi;
	struct ixl_queue	*que = vsi->queues;
	struct tx_ring		*txr;
	struct rx_ring		*rxr;
	int			len, pairs;
	struct i40e_virtchnl_vsi_queue_config_info *vqci;
	struct i40e_virtchnl_queue_pair_info *vqpi;
	pairs = vsi->num_queues;
	len = sizeof(struct i40e_virtchnl_vsi_queue_config_info) +
		       (sizeof(struct i40e_virtchnl_queue_pair_info) * pairs);
	vqci = malloc(len, M_DEVBUF, M_NOWAIT | M_ZERO);
	if (!vqci) {
		device_printf(dev, "%s: unable to allocate memory\n", __func__);
		ixl_vc_schedule_retry(&sc->vc_mgr);
		return;
	}
	vqci->vsi_id = sc->vsi_res->vsi_id;
	vqci->num_queue_pairs = pairs;
	vqpi = vqci->qpair;
	for (int i = 0; i < pairs; i++, que++, vqpi++) {
		txr = &que->txr;
		rxr = &que->rxr;
		vqpi->txq.vsi_id = vqci->vsi_id;
		vqpi->txq.queue_id = i;
		vqpi->txq.ring_len = que->num_desc;
		vqpi->txq.dma_ring_addr = txr->dma.pa;
		vqpi->txq.headwb_enabled = 1;
		vqpi->txq.dma_headwb_addr = txr->dma.pa +
		    (que->num_desc * sizeof(struct i40e_tx_desc));
		vqpi->rxq.vsi_id = vqci->vsi_id;
		vqpi->rxq.queue_id = i;
		vqpi->rxq.ring_len = que->num_desc;
		vqpi->rxq.dma_ring_addr = rxr->dma.pa;
		vqpi->rxq.max_pkt_size = vsi->max_frame_size;
		vqpi->rxq.databuffer_size = rxr->mbuf_sz;
		vqpi->rxq.splithdr_enabled = 0;
	}
	ixlv_send_pf_msg(sc, I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES,
			   (u8 *)vqci, len);
	free(vqci, M_DEVBUF);
}
void ixlv_configure_queues ( struct ixlv_sc * sc ) { device_t dev = sc -> dev ; struct ixl_vsi * vsi = & sc -> vsi ; struct ixl_queue * que = vsi -> queues ; struct tx_ring * txr ; struct rx_ring * rxr ; int len , pairs ; struct i40e_virtchnl_vsi_queue_config_info * vqci ; struct i40e_virtchnl_queue_pair_info * vqpi ; pairs = vsi -> num_queues ; len = sizeof ( struct i40e_virtchnl_vsi_queue_config_info ) + ( sizeof ( struct i40e_virtchnl_queue_pair_info ) * pairs ) ; vqci = malloc ( len , M_DEVBUF , M_NOWAIT | M_ZERO ) ; if ( ! vqci ) { device_printf ( dev , " \n " , __func__ ) ; ixl_vc_schedule_retry ( & sc -> vc_mgr ) ; return ; } vqci -> vsi_id = sc -> vsi_res -> vsi_id ; vqci -> num_queue_pairs = pairs ; vqpi = vqci -> qpair ; for ( int i = 0 ; i < pairs ; i ++ , que ++ , vqpi ++ ) { txr = & que -> txr ; rxr = & que -> rxr ; vqpi -> txq . vsi_id = vqci -> vsi_id ; vqpi -> txq . queue_id = i ; vqpi -> txq . ring_len = que -> num_desc ; vqpi -> txq . dma_ring_addr = txr -> dma . pa ; vqpi -> txq . headwb_enabled = 1 ; vqpi -> txq . dma_headwb_addr = txr -> dma . pa + ( que -> num_desc * sizeof ( struct i40e_tx_desc ) ) ; vqpi -> rxq . vsi_id = vqci -> vsi_id ; vqpi -> rxq . queue_id = i ; vqpi -> rxq . ring_len = que -> num_desc ; vqpi -> rxq . dma_ring_addr = rxr -> dma . pa ; vqpi -> rxq . max_pkt_size = vsi -> max_frame_size ; vqpi -> rxq . databuffer_size = rxr -> mbuf_sz ; vqpi -> rxq . splithdr_enabled = 0 ; } ixlv_send_pf_msg ( sc , I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES , ( u8 * ) vqci , len ) ; free ( vqci , M_DEVBUF ) ; }
ixlv_configure_queues
Request that the PF set up our queues.
ixlv_configure_queues Request that the PF set up our queues .
/* Size check is not needed here - HW max is 16 queue pairs, and we
	 * can fit info for 31 of them into the AQ buffer before it overflows.
	 */ /* Enable Head writeback */