if_vlan.c (89856f7e2d63bcaaacf105f679ade0bf5d40e821) | if_vlan.c (f3e7afe2d7b262ab55ab818445d4dfdb6e0c70a9) |
---|---|
1/*- 2 * Copyright 1998 Massachusetts Institute of Technology 3 * Copyright 2012 ADARA Networks, Inc. 4 * 5 * Portions of this software were developed by Robert N. M. Watson under 6 * contract to ADARA Networks, Inc. 7 * 8 * Permission to use, copy, modify, and distribute this software and --- 32 unchanged lines hidden (view full) --- 41 * use by the real outgoing interface, and ask it to send them. 42 */ 43 44#include <sys/cdefs.h> 45__FBSDID("$FreeBSD$"); 46 47#include "opt_inet.h" 48#include "opt_vlan.h" | 1/*- 2 * Copyright 1998 Massachusetts Institute of Technology 3 * Copyright 2012 ADARA Networks, Inc. 4 * 5 * Portions of this software were developed by Robert N. M. Watson under 6 * contract to ADARA Networks, Inc. 7 * 8 * Permission to use, copy, modify, and distribute this software and --- 32 unchanged lines hidden (view full) --- 41 * use by the real outgoing interface, and ask it to send them. 42 */ 43 44#include <sys/cdefs.h> 45__FBSDID("$FreeBSD$"); 46 47#include "opt_inet.h" 48#include "opt_vlan.h" |
49#include "opt_ratelimit.h" |
|
49 50#include <sys/param.h> 51#include <sys/eventhandler.h> 52#include <sys/kernel.h> 53#include <sys/lock.h> 54#include <sys/malloc.h> 55#include <sys/mbuf.h> 56#include <sys/module.h> --- 150 unchanged lines hidden (view full) --- 207static __inline struct ifvlan * vlan_gethash(struct ifvlantrunk *trunk, 208 uint16_t vid); 209#endif 210static void trunk_destroy(struct ifvlantrunk *trunk); 211 212static void vlan_init(void *foo); 213static void vlan_input(struct ifnet *ifp, struct mbuf *m); 214static int vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr); | 50 51#include <sys/param.h> 52#include <sys/eventhandler.h> 53#include <sys/kernel.h> 54#include <sys/lock.h> 55#include <sys/malloc.h> 56#include <sys/mbuf.h> 57#include <sys/module.h> --- 150 unchanged lines hidden (view full) --- 208static __inline struct ifvlan * vlan_gethash(struct ifvlantrunk *trunk, 209 uint16_t vid); 210#endif 211static void trunk_destroy(struct ifvlantrunk *trunk); 212 213static void vlan_init(void *foo); 214static void vlan_input(struct ifnet *ifp, struct mbuf *m); 215static int vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr); |
216#ifdef RATELIMIT 217static int vlan_snd_tag_alloc(struct ifnet *, 218 union if_snd_tag_alloc_params *, struct m_snd_tag **); 219#endif |
|
215static void vlan_qflush(struct ifnet *ifp); 216static int vlan_setflag(struct ifnet *ifp, int flag, int status, 217 int (*func)(struct ifnet *, int)); 218static int vlan_setflags(struct ifnet *ifp, int status); 219static int vlan_setmulti(struct ifnet *ifp); 220static int vlan_transmit(struct ifnet *ifp, struct mbuf *m); 221static void vlan_unconfig(struct ifnet *ifp); 222static void vlan_unconfig_locked(struct ifnet *ifp, int departing); --- 743 unchanged lines hidden (view full) --- 966 ifp->if_linkmib = &ifv->ifv_mib; 967 ifp->if_linkmiblen = sizeof(ifv->ifv_mib); 968 /* NB: mtu is not set here */ 969 970 ifp->if_init = vlan_init; 971 ifp->if_transmit = vlan_transmit; 972 ifp->if_qflush = vlan_qflush; 973 ifp->if_ioctl = vlan_ioctl; | 220static void vlan_qflush(struct ifnet *ifp); 221static int vlan_setflag(struct ifnet *ifp, int flag, int status, 222 int (*func)(struct ifnet *, int)); 223static int vlan_setflags(struct ifnet *ifp, int status); 224static int vlan_setmulti(struct ifnet *ifp); 225static int vlan_transmit(struct ifnet *ifp, struct mbuf *m); 226static void vlan_unconfig(struct ifnet *ifp); 227static void vlan_unconfig_locked(struct ifnet *ifp, int departing); --- 743 unchanged lines hidden (view full) --- 971 ifp->if_linkmib = &ifv->ifv_mib; 972 ifp->if_linkmiblen = sizeof(ifv->ifv_mib); 973 /* NB: mtu is not set here */ 974 975 ifp->if_init = vlan_init; 976 ifp->if_transmit = vlan_transmit; 977 ifp->if_qflush = vlan_qflush; 978 ifp->if_ioctl = vlan_ioctl; |
979#ifdef RATELIMIT 980 ifp->if_snd_tag_alloc = vlan_snd_tag_alloc; 981#endif |
|
974 ifp->if_flags = VLAN_IFFLAGS; 975 ether_ifattach(ifp, eaddr); 976 /* Now undo some of the damage... */ 977 ifp->if_baudrate = 0; 978 ifp->if_type = IFT_L2VLAN; 979 ifp->if_hdrlen = ETHER_VLAN_ENCAP_LEN; 980 ifa = ifp->if_addr; 981 sdl = (struct sockaddr_dl *)ifa->ifa_addr; --- 604 unchanged lines hidden (view full) --- 1586 */ 1587#define IFCAP_VLAN_TOE IFCAP_TOE 1588 if (p->if_capabilities & IFCAP_VLAN_TOE) 1589 ifp->if_capabilities |= p->if_capabilities & IFCAP_TOE; 1590 if (p->if_capenable & IFCAP_VLAN_TOE) { 1591 TOEDEV(ifp) = TOEDEV(p); 1592 ifp->if_capenable |= p->if_capenable & IFCAP_TOE; 1593 } | 982 ifp->if_flags = VLAN_IFFLAGS; 983 ether_ifattach(ifp, eaddr); 984 /* Now undo some of the damage... */ 985 ifp->if_baudrate = 0; 986 ifp->if_type = IFT_L2VLAN; 987 ifp->if_hdrlen = ETHER_VLAN_ENCAP_LEN; 988 ifa = ifp->if_addr; 989 sdl = (struct sockaddr_dl *)ifa->ifa_addr; --- 604 unchanged lines hidden (view full) --- 1594 */ 1595#define IFCAP_VLAN_TOE IFCAP_TOE 1596 if (p->if_capabilities & IFCAP_VLAN_TOE) 1597 ifp->if_capabilities |= p->if_capabilities & IFCAP_TOE; 1598 if (p->if_capenable & IFCAP_VLAN_TOE) { 1599 TOEDEV(ifp) = TOEDEV(p); 1600 ifp->if_capenable |= p->if_capenable & IFCAP_TOE; 1601 } |
1602 1603#ifdef RATELIMIT 1604 /* 1605 * If the parent interface supports ratelimiting, so does the 1606 * VLAN interface. 1607 */ 1608 ifp->if_capabilities |= (p->if_capabilities & IFCAP_TXRTLMT); 1609 ifp->if_capenable |= (p->if_capenable & IFCAP_TXRTLMT); 1610#endif |
|
1594} 1595 1596static void 1597vlan_trunk_capabilities(struct ifnet *ifp) 1598{ 1599 struct ifvlantrunk *trunk = ifp->if_vlantrunk; 1600 struct ifvlan *ifv; 1601 int i; --- 194 unchanged lines hidden (view full) --- 1796 1797 default: 1798 error = EINVAL; 1799 break; 1800 } 1801 1802 return (error); 1803} | 1611} 1612 1613static void 1614vlan_trunk_capabilities(struct ifnet *ifp) 1615{ 1616 struct ifvlantrunk *trunk = ifp->if_vlantrunk; 1617 struct ifvlan *ifv; 1618 int i; --- 194 unchanged lines hidden (view full) --- 1813 1814 default: 1815 error = EINVAL; 1816 break; 1817 } 1818 1819 return (error); 1820} |
1821 1822#ifdef RATELIMIT 1823static int 1824vlan_snd_tag_alloc(struct ifnet *ifp, 1825 union if_snd_tag_alloc_params *params, 1826 struct m_snd_tag **ppmt) 1827{ 1828 1829 /* get trunk device */ 1830 ifp = vlan_trunkdev(ifp); 1831 if (ifp == NULL || (ifp->if_capenable & IFCAP_TXRTLMT) == 0) 1832 return (EOPNOTSUPP); 1833 /* forward allocation request */ 1834 return (ifp->if_snd_tag_alloc(ifp, params, ppmt)); 1835} 1836#endif |
|