Changeset View
Changeset View
Standalone View
Standalone View
sys/net/ethernet.h
| Show First 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | |||||
| struct ether_vlan_header { | struct ether_vlan_header { | ||||
| uint8_t evl_dhost[ETHER_ADDR_LEN]; | uint8_t evl_dhost[ETHER_ADDR_LEN]; | ||||
| uint8_t evl_shost[ETHER_ADDR_LEN]; | uint8_t evl_shost[ETHER_ADDR_LEN]; | ||||
| uint16_t evl_encap_proto; | uint16_t evl_encap_proto; | ||||
| uint16_t evl_tag; | uint16_t evl_tag; | ||||
| uint16_t evl_proto; | uint16_t evl_proto; | ||||
| } __packed; | } __packed; | ||||
| /* | |||||
| * 802.1q full tag. | |||||
| */ | |||||
| struct ether_8021q_tag { | |||||
| uint16_t proto; | |||||
| uint16_t vid; | |||||
| uint8_t pcp; | |||||
| }; | |||||
| #define EVL_VLID_MASK 0x0FFF | #define EVL_VLID_MASK 0x0FFF | ||||
| #define EVL_PRI_MASK 0xE000 | #define EVL_PRI_MASK 0xE000 | ||||
| #define EVL_VLANOFTAG(tag) ((tag) & EVL_VLID_MASK) | #define EVL_VLANOFTAG(tag) ((tag) & EVL_VLID_MASK) | ||||
| #define EVL_PRIOFTAG(tag) (((tag) >> 13) & 7) | #define EVL_PRIOFTAG(tag) (((tag) >> 13) & 7) | ||||
| #define EVL_CFIOFTAG(tag) (((tag) >> 12) & 1) | #define EVL_CFIOFTAG(tag) (((tag) >> 12) & 1) | ||||
| #define EVL_MAKETAG(vlid, pri, cfi) \ | #define EVL_MAKETAG(vlid, pri, cfi) \ | ||||
| ((((((pri) & 7) << 1) | ((cfi) & 1)) << 12) | ((vlid) & EVL_VLID_MASK)) | ((((((pri) & 7) << 1) | ((cfi) & 1)) << 12) | ((vlid) & EVL_VLID_MASK)) | ||||
| ▲ Show 20 Lines • Show All 336 Lines • ▼ Show 20 Lines | |||||
| extern void ether_ifdetach(struct ifnet *); | extern void ether_ifdetach(struct ifnet *); | ||||
| extern int ether_ioctl(struct ifnet *, u_long, caddr_t); | extern int ether_ioctl(struct ifnet *, u_long, caddr_t); | ||||
| extern int ether_output(struct ifnet *, struct mbuf *, | extern int ether_output(struct ifnet *, struct mbuf *, | ||||
| const struct sockaddr *, struct route *); | const struct sockaddr *, struct route *); | ||||
| extern int ether_output_frame(struct ifnet *, struct mbuf *); | extern int ether_output_frame(struct ifnet *, struct mbuf *); | ||||
| extern char *ether_sprintf(const u_int8_t *); | extern char *ether_sprintf(const u_int8_t *); | ||||
| void ether_vlan_mtap(struct bpf_if *, struct mbuf *, | void ether_vlan_mtap(struct bpf_if *, struct mbuf *, | ||||
| void *, u_int); | void *, u_int); | ||||
| struct mbuf *ether_vlanencap(struct mbuf *, uint16_t); | struct mbuf *ether_vlanencap_proto(struct mbuf *, uint16_t, uint16_t); | ||||
| bool ether_8021q_frame(struct mbuf **mp, struct ifnet *ife, struct ifnet *p, | bool ether_8021q_frame(struct mbuf **mp, struct ifnet *ife, | ||||
| uint16_t vid, uint8_t pcp); | struct ifnet *p, struct ether_8021q_tag *); | ||||
| void ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr); | void ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr); | ||||
| static __inline struct mbuf *ether_vlanencap(struct mbuf *m, uint16_t tag) | |||||
| { return ether_vlanencap_proto(m, tag, ETHERTYPE_VLAN); } | |||||
melifaro: worth splitting into multiple lines? | |||||
| /* new ethernet interface attached event */ | /* new ethernet interface attached event */ | ||||
| typedef void (*ether_ifattach_event_handler_t)(void *, struct ifnet *); | typedef void (*ether_ifattach_event_handler_t)(void *, struct ifnet *); | ||||
| EVENTHANDLER_DECLARE(ether_ifattach_event, ether_ifattach_event_handler_t); | EVENTHANDLER_DECLARE(ether_ifattach_event, ether_ifattach_event_handler_t); | ||||
| #else /* _KERNEL */ | #else /* _KERNEL */ | ||||
| #include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
| Show All 17 Lines | |||||
worth splitting into multiple lines?