FreeBSD/sys/dev/ixl/ixl_pf_main.c
/*********************************************************************
 *
 *  Get Firmware Switch configuration
 *	- this will need to be more robust when more complex
 *	  switch configurations are enabled.
 *
 **********************************************************************/
Get Firmware Switch configuration
- this will need to be more robust when more complex
switch configurations are enabled.
Get Firmware Switch configuration - this will need to be more robust when more complex switch configurations are enabled .
int
ixl_switch_config(struct ixl_pf *pf)
{
	struct i40e_hw	*hw = &pf->hw; 
	struct ixl_vsi	*vsi = &pf->vsi;
	device_t 	dev = vsi->dev;
	struct i40e_aqc_get_switch_config_resp *sw_config;
	u8	aq_buf[I40E_AQ_LARGE_BUF];
	int	ret;
	u16	next = 0;
	memset(&aq_buf, 0, sizeof(aq_buf));
	sw_config = (struct i40e_aqc_get_switch_config_resp *)aq_buf;
	ret = i40e_aq_get_switch_config(hw, sw_config,
	    sizeof(aq_buf), &next, NULL);
	if (ret) {
		device_printf(dev, "aq_get_switch_config() failed, error %d,"
		    " aq_error %d\n", ret, pf->hw.aq.asq_last_status);
		return (ret);
	}
	if (pf->dbg_mask & IXL_DBG_SWITCH_INFO) {
		device_printf(dev,
		    "Switch config: header reported: %d in structure, %d total\n",
		    sw_config->header.num_reported, sw_config->header.num_total);
		for (int i = 0; i < sw_config->header.num_reported; i++) {
			device_printf(dev,
			    "%d: type=%d seid=%d uplink=%d downlink=%d\n", i,
			    sw_config->element[i].element_type,
			    sw_config->element[i].seid,
			    sw_config->element[i].uplink_seid,
			    sw_config->element[i].downlink_seid);
		}
	}
	vsi->uplink_seid = sw_config->element[0].uplink_seid;
	vsi->downlink_seid = sw_config->element[0].downlink_seid;
	vsi->seid = sw_config->element[0].seid;
	return (ret);
}
int ixl_switch_config ( struct ixl_pf * pf ) { struct i40e_hw * hw = & pf -> hw ; struct ixl_vsi * vsi = & pf -> vsi ; device_t dev = vsi -> dev ; struct i40e_aqc_get_switch_config_resp * sw_config ; u8 aq_buf [ I40E_AQ_LARGE_BUF ] ; int ret ; u16 next = 0 ; memset ( & aq_buf , 0 , sizeof ( aq_buf ) ) ; sw_config = ( struct i40e_aqc_get_switch_config_resp * ) aq_buf ; ret = i40e_aq_get_switch_config ( hw , sw_config , sizeof ( aq_buf ) , & next , NULL ) ; if ( ret ) { device_printf ( dev , " " " \n " , ret , pf -> hw . aq . asq_last_status ) ; return ( ret ) ; } if ( pf -> dbg_mask & IXL_DBG_SWITCH_INFO ) { device_printf ( dev , " \n " , sw_config -> header . num_reported , sw_config -> header . num_total ) ; for ( int i = 0 ; i < sw_config -> header . num_reported ; i ++ ) { device_printf ( dev , " \n " , i , sw_config -> element [ i ] . element_type , sw_config -> element [ i ] . seid , sw_config -> element [ i ] . uplink_seid , sw_config -> element [ i ] . downlink_seid ) ; } } vsi -> uplink_seid = sw_config -> element [ 0 ] . uplink_seid ; vsi -> downlink_seid = sw_config -> element [ 0 ] . downlink_seid ; vsi -> seid = sw_config -> element [ 0 ] . seid ; return ( ret ) ; }
Get Firmware Switch configuration
      - this will need to be more robust when more complex
        switch configurations are enabled.
Get Firmware Switch configuration - this will need to be more robust when more complex switch configurations are enabled .
/* Simplified due to a single VSI */