FreeBSD/sys/dev/ixgbe/if_ixv.c
/*********************************************************************
 *
 *  Setup networking device structure and register an interface.
 *
 **********************************************************************/
Setup networking device structure and register an interface.
Setup networking device structure and register an interface .
static void
ixv_setup_interface(device_t dev, struct adapter *adapter)
{
	struct ifnet   *ifp;
	INIT_DEBUGOUT("ixv_setup_interface: begin");
	ifp = adapter->ifp = if_alloc(IFT_ETHER);
	if (ifp == NULL)
		panic("%s: can not if_alloc()\n", device_get_nameunit(dev));
	if_initname(ifp, device_get_name(dev), device_get_unit(dev));
	ifp->if_baudrate = 1000000000;
	ifp->if_init = ixv_init;
	ifp->if_softc = adapter;
	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
	ifp->if_ioctl = ixv_ioctl;
#if __FreeBSD_version >= 800000
	ifp->if_transmit = ixgbe_mq_start;
	ifp->if_qflush = ixgbe_qflush;
#else
	ifp->if_start = ixgbe_start;
#endif
	ifp->if_snd.ifq_maxlen = adapter->num_tx_desc - 2;
	ether_ifattach(ifp, adapter->hw.mac.addr);
	adapter->max_frame_size =
	    ifp->if_mtu + IXGBE_MTU_HDR_VLAN;
	ifp->if_hdrlen = sizeof(struct ether_vlan_header);
	ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_TSO4 | IFCAP_VLAN_HWCSUM;
	ifp->if_capabilities |= IFCAP_JUMBO_MTU;
	ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING
			     |  IFCAP_VLAN_HWTSO
			     |  IFCAP_VLAN_MTU;
	ifp->if_capabilities |= IFCAP_LRO;
	ifp->if_capenable = ifp->if_capabilities;
	ifmedia_init(&adapter->media, IFM_IMASK, ixv_media_change,
		     ixv_media_status);
	ifmedia_add(&adapter->media, IFM_ETHER | IFM_AUTO, 0, NULL);
	ifmedia_set(&adapter->media, IFM_ETHER | IFM_AUTO);
	return;
}
static void ixv_setup_interface ( device_t dev , struct adapter * adapter ) { struct ifnet * ifp ; INIT_DEBUGOUT ( " " ) ; ifp = adapter -> ifp = if_alloc ( IFT_ETHER ) ; if ( ifp == NULL ) panic ( " \n " , device_get_nameunit ( dev ) ) ; if_initname ( ifp , device_get_name ( dev ) , device_get_unit ( dev ) ) ; ifp -> if_baudrate = 1000000000 ; ifp -> if_init = ixv_init ; ifp -> if_softc = adapter ; ifp -> if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST ; ifp -> if_ioctl = ixv_ioctl ; #if __FreeBSD_version >= 800000 ifp -> if_transmit = ixgbe_mq_start ; ifp -> if_qflush = ixgbe_qflush ; #else ifp -> if_start = ixgbe_start ; #endif ifp -> if_snd . ifq_maxlen = adapter -> num_tx_desc - 2 ; ether_ifattach ( ifp , adapter -> hw . mac . addr ) ; adapter -> max_frame_size = ifp -> if_mtu + IXGBE_MTU_HDR_VLAN ; ifp -> if_hdrlen = sizeof ( struct ether_vlan_header ) ; ifp -> if_capabilities |= IFCAP_HWCSUM | IFCAP_TSO4 | IFCAP_VLAN_HWCSUM ; ifp -> if_capabilities |= IFCAP_JUMBO_MTU ; ifp -> if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWTSO | IFCAP_VLAN_MTU ; ifp -> if_capabilities |= IFCAP_LRO ; ifp -> if_capenable = ifp -> if_capabilities ; ifmedia_init ( & adapter -> media , IFM_IMASK , ixv_media_change , ixv_media_status ) ; ifmedia_add ( & adapter -> media , IFM_ETHER | IFM_AUTO , 0 , NULL ) ; ifmedia_set ( & adapter -> media , IFM_ETHER | IFM_AUTO ) ; return ; }
Setup networking device structure and register an interface.
Setup networking device structure and register an interface .
/*
	 * Tell the upper layer(s) we support long frames.
	 */ /*
	 * Specify the media types supported by this adapter and register
	 * callbacks to update media and link information
	 */