* Create an interface instance. */
| 94 | * Create an interface instance. |
| 95 | */ |
| 96 | static int |
| 97 | edsc_clone_create(struct if_clone *ifc, int unit, caddr_t params) |
| 98 | { |
| 99 | struct edsc_softc *sc; |
| 100 | struct ifnet *ifp; |
| 101 | struct ether_addr eaddr; |
| 102 | |
| 103 | /* |
| 104 | * Allocate soft and ifnet structures. Link each to the other. |
| 105 | */ |
| 106 | sc = malloc(sizeof(struct edsc_softc), M_EDSC, M_WAITOK | M_ZERO); |
| 107 | ifp = sc->sc_ifp = if_alloc(IFT_ETHER); |
| 108 | if (ifp == NULL) { |
| 109 | free(sc, M_EDSC); |
| 110 | return (ENOSPC); |
| 111 | } |
| 112 | |
| 113 | ifp->if_softc = sc; |
| 114 | |
| 115 | /* |
| 116 | * Get a name for this particular interface in its ifnet structure. |
| 117 | */ |
| 118 | if_initname(ifp, edscname, unit); |
| 119 | |
| 120 | /* |
| 121 | * Typical Ethernet interface flags: we can do broadcast and |
| 122 | * multicast but can't hear our own broadcasts or multicasts. |
| 123 | */ |
| 124 | ifp->if_flags = IFF_BROADCAST | IFF_MULTICAST | IFF_SIMPLEX; |
| 125 | |
| 126 | /* |
| 127 | * We can pretent we have the whole set of hardware features |
| 128 | * because we just discard all packets we get from the upper layer. |
| 129 | * However, the features are disabled initially. They can be |
| 130 | * enabled via edsc_ioctl() when needed. |
| 131 | */ |
| 132 | ifp->if_capabilities = |
| 133 | IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWCSUM | |
| 134 | IFCAP_HWCSUM | IFCAP_TSO | |
| 135 | IFCAP_JUMBO_MTU; |
| 136 | ifp->if_capenable = 0; |
| 137 | |
| 138 | /* |
| 139 | * Set the interface driver methods. |
| 140 | */ |
| 141 | ifp->if_init = edsc_init; |
| 142 | /* ifp->if_input = edsc_input; */ |
| 143 | ifp->if_ioctl = edsc_ioctl; |
| 144 | ifp->if_start = edsc_start; |
| 145 | |
| 146 | /* |
| 147 | * Set the maximum output queue length from the global parameter. |
| 148 | */ |
| 149 | ifp->if_snd.ifq_maxlen = ifqmaxlen; |
| 150 | |
| 151 | /* |
| 152 | * Generate an arbitrary MAC address for the cloned interface. |
| 153 | */ |
nothing calls this directly
no test coverage detected