Changeset View
Standalone View
sys/net/if.h
Show First 20 Lines • Show All 230 Lines • ▼ Show 20 Lines | |||||
#define IFCAP_TSO6 0x00200 /* can do TCP6 Segmentation Offload */ | #define IFCAP_TSO6 0x00200 /* can do TCP6 Segmentation Offload */ | ||||
#define IFCAP_LRO 0x00400 /* can do Large Receive Offload */ | #define IFCAP_LRO 0x00400 /* can do Large Receive Offload */ | ||||
#define IFCAP_WOL_UCAST 0x00800 /* wake on any unicast frame */ | #define IFCAP_WOL_UCAST 0x00800 /* wake on any unicast frame */ | ||||
#define IFCAP_WOL_MCAST 0x01000 /* wake on any multicast frame */ | #define IFCAP_WOL_MCAST 0x01000 /* wake on any multicast frame */ | ||||
#define IFCAP_WOL_MAGIC 0x02000 /* wake on any Magic Packet */ | #define IFCAP_WOL_MAGIC 0x02000 /* wake on any Magic Packet */ | ||||
#define IFCAP_TOE4 0x04000 /* interface can offload TCP */ | #define IFCAP_TOE4 0x04000 /* interface can offload TCP */ | ||||
#define IFCAP_TOE6 0x08000 /* interface can offload TCP6 */ | #define IFCAP_TOE6 0x08000 /* interface can offload TCP6 */ | ||||
#define IFCAP_VLAN_HWFILTER 0x10000 /* interface hw can filter vlan tag */ | #define IFCAP_VLAN_HWFILTER 0x10000 /* interface hw can filter vlan tag */ | ||||
/* available 0x20000 */ | #define IFCAP_NV 0x20000 /* can do SIOCGIFCAPNV/SIOCSIFCAPNV */ | ||||
#define IFCAP_VLAN_HWTSO 0x40000 /* can do IFCAP_TSO on VLANs */ | #define IFCAP_VLAN_HWTSO 0x40000 /* can do IFCAP_TSO on VLANs */ | ||||
#define IFCAP_LINKSTATE 0x80000 /* the runtime link state is dynamic */ | #define IFCAP_LINKSTATE 0x80000 /* the runtime link state is dynamic */ | ||||
#define IFCAP_NETMAP 0x100000 /* netmap mode supported/enabled */ | #define IFCAP_NETMAP 0x100000 /* netmap mode supported/enabled */ | ||||
#define IFCAP_RXCSUM_IPV6 0x200000 /* can offload checksum on IPv6 RX */ | #define IFCAP_RXCSUM_IPV6 0x200000 /* can offload checksum on IPv6 RX */ | ||||
#define IFCAP_TXCSUM_IPV6 0x400000 /* can offload checksum on IPv6 TX */ | #define IFCAP_TXCSUM_IPV6 0x400000 /* can offload checksum on IPv6 TX */ | ||||
#define IFCAP_HWSTATS 0x800000 /* manages counters internally */ | #define IFCAP_HWSTATS 0x800000 /* manages counters internally */ | ||||
#define IFCAP_TXRTLMT 0x1000000 /* hardware supports TX rate limiting */ | #define IFCAP_TXRTLMT 0x1000000 /* hardware supports TX rate limiting */ | ||||
#define IFCAP_HWRXTSTMP 0x2000000 /* hardware rx timestamping */ | #define IFCAP_HWRXTSTMP 0x2000000 /* hardware rx timestamping */ | ||||
#define IFCAP_MEXTPG 0x4000000 /* understands M_EXTPG mbufs */ | #define IFCAP_MEXTPG 0x4000000 /* understands M_EXTPG mbufs */ | ||||
#define IFCAP_TXTLS4 0x8000000 /* can do TLS encryption and segmentation for TCP */ | #define IFCAP_TXTLS4 0x8000000 /* can do TLS encryption and segmentation for TCP */ | ||||
#define IFCAP_TXTLS6 0x10000000 /* can do TLS encryption and segmentation for TCP6 */ | #define IFCAP_TXTLS6 0x10000000 /* can do TLS encryption and segmentation for TCP6 */ | ||||
#define IFCAP_VXLAN_HWCSUM 0x20000000 /* can do IFCAN_HWCSUM on VXLANs */ | #define IFCAP_VXLAN_HWCSUM 0x20000000 /* can do IFCAN_HWCSUM on VXLANs */ | ||||
#define IFCAP_VXLAN_HWTSO 0x40000000 /* can do IFCAP_TSO on VXLANs */ | #define IFCAP_VXLAN_HWTSO 0x40000000 /* can do IFCAP_TSO on VXLANs */ | ||||
#define IFCAP_TXTLS_RTLMT 0x80000000 /* can do TLS with rate limiting */ | #define IFCAP_TXTLS_RTLMT 0x80000000 /* can do TLS with rate limiting */ | ||||
#define IFCAP2_RXTLS4 0x00001 | |||||
#define IFCAP2_RXTLS6 0x00002 | |||||
#define IFCAP_HWCSUM_IPV6 (IFCAP_RXCSUM_IPV6 | IFCAP_TXCSUM_IPV6) | #define IFCAP_HWCSUM_IPV6 (IFCAP_RXCSUM_IPV6 | IFCAP_TXCSUM_IPV6) | ||||
#define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM) | #define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM) | ||||
#define IFCAP_TSO (IFCAP_TSO4 | IFCAP_TSO6) | #define IFCAP_TSO (IFCAP_TSO4 | IFCAP_TSO6) | ||||
#define IFCAP_WOL (IFCAP_WOL_UCAST | IFCAP_WOL_MCAST | IFCAP_WOL_MAGIC) | #define IFCAP_WOL (IFCAP_WOL_UCAST | IFCAP_WOL_MCAST | IFCAP_WOL_MAGIC) | ||||
#define IFCAP_TOE (IFCAP_TOE4 | IFCAP_TOE6) | #define IFCAP_TOE (IFCAP_TOE4 | IFCAP_TOE6) | ||||
#define IFCAP_TXTLS (IFCAP_TXTLS4 | IFCAP_TXTLS6) | #define IFCAP_TXTLS (IFCAP_TXTLS4 | IFCAP_TXTLS6) | ||||
#define IFCAP2_RXTLS (IFCAP2_RXTLS4 | IFCAP2_RXTLS6) | |||||
#define IFCAP_CANTCHANGE (IFCAP_NETMAP) | #define IFCAP_CANTCHANGE (IFCAP_NETMAP | IFCAP_NV) | ||||
#define IFCAP_ALLCAPS 0xffffffff | |||||
#define IFCAP_RXCSUM_NAME "RXCSUM" | |||||
#define IFCAP_TXCSUM_NAME "TXCSUM" | |||||
#define IFCAP_NETCONS_NAME "NETCONS" | |||||
#define IFCAP_VLAN_MTU_NAME "VLAN_MTU" | |||||
#define IFCAP_VLAN_HWTAGGING_NAME "VLAN_HWTAGGING" | |||||
#define IFCAP_JUMBO_MTU_NAME "JUMBO_MTU" | |||||
#define IFCAP_POLLING_NAME "POLLING" | |||||
#define IFCAP_VLAN_HWCSUM_NAME "VLAN_HWCSUM" | |||||
#define IFCAP_TSO4_NAME "TSO4" | |||||
#define IFCAP_TSO6_NAME "TSO6" | |||||
#define IFCAP_LRO_NAME "LRO" | |||||
#define IFCAP_WOL_UCAST_NAME "WOL_UCAST" | |||||
#define IFCAP_WOL_MCAST_NAME "WOL_MCAST" | |||||
#define IFCAP_WOL_MAGIC_NAME "WOL_MAGIC" | |||||
#define IFCAP_TOE4_NAME "TOE4" | |||||
#define IFCAP_TOE6_NAME "TOE6" | |||||
#define IFCAP_VLAN_HWFILTER_NAME "VLAN_HWFILTER" | |||||
#define IFCAP_VLAN_HWTSO_NAME "VLAN_HWTSO" | |||||
#define IFCAP_LINKSTATE_NAME "LINKSTATE" | |||||
#define IFCAP_NETMAP_NAME "NETMAP" | |||||
#define IFCAP_RXCSUM_IPV6_NAME "RXCSUM_IPV6" | |||||
#define IFCAP_TXCSUM_IPV6_NAME "TXCSUM_IPV6" | |||||
#define IFCAP_HWSTATS_NAME "HWSTATS" | |||||
#define IFCAP_TXRTLMT_NAME "TXRTLMT" | |||||
#define IFCAP_HWRXTSTMP_NAME "HWRXTSTMP" | |||||
#define IFCAP_MEXTPG_NAME "MEXTPG" | |||||
#define IFCAP_TXTLS4_NAME "TXTLS4" | |||||
#define IFCAP_TXTLS6_NAME "TXTLS6" | |||||
#define IFCAP_VXLAN_HWCSUM_NAME "VXLAN_HWCSUM" | |||||
#define IFCAP_VXLAN_HWTSO_NAME "VXLAN_HWTSO" | |||||
#define IFCAP_TXTLS_RTLMT_NAME "TXTLS_RTLMT" | |||||
#define IFCAP2_RXTLS4_NAME "RXTLS4" | |||||
#define IFCAP2_RXTLS6_NAME "RXTLS6" | |||||
#define IFQ_MAXLEN 50 | #define IFQ_MAXLEN 50 | ||||
#define IFNET_SLOWHZ 1 /* granularity is 1 second */ | #define IFNET_SLOWHZ 1 /* granularity is 1 second */ | ||||
/* | /* | ||||
* Message format for use in obtaining information about interfaces | * Message format for use in obtaining information about interfaces | ||||
* from getkerninfo and the routing socket | * from getkerninfo and the routing socket | ||||
* For the new, extensible interface see struct if_msghdrl below. | * For the new, extensible interface see struct if_msghdrl below. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Buffer with length to be used in SIOCGIFDESCR/SIOCSIFDESCR requests | * Buffer with length to be used in SIOCGIFDESCR/SIOCSIFDESCR requests | ||||
*/ | */ | ||||
struct ifreq_buffer { | struct ifreq_buffer { | ||||
size_t length; | size_t length; | ||||
void *buffer; | void *buffer; | ||||
}; | }; | ||||
struct ifreq_nv_req { | |||||
u_int buf_length; /* Total size of buffer, | |||||
u_int for ABI struct ifreq */ | |||||
u_int length; /* Length of the filled part */ | |||||
void *buffer; /* Buffer itself, containing packed nv */ | |||||
}; | |||||
#define IFR_CAP_NV_MAXBUFSIZE (2 * 1024 * 1024) | |||||
hselasky: Maybe 64 Kbytes would be good enough. 2MBytes seems large. | |||||
Done Inline ActionsThis value is arbitrary. I do not see a problem with 'too large value' at the moment. For one-off ioctls, it should not matter. kib: This value is arbitrary. I do not see a problem with 'too large value' at the moment. For one… | |||||
/* | /* | ||||
* Interface request structure used for socket | * Interface request structure used for socket | ||||
* ioctl's. All interface ioctl's must have parameter | * ioctl's. All interface ioctl's must have parameter | ||||
* definitions which begin with ifr_name. The | * definitions which begin with ifr_name. The | ||||
* remainder may be interface specific. | * remainder may be interface specific. | ||||
*/ | */ | ||||
struct ifreq { | struct ifreq { | ||||
char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ | char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ | ||||
union { | union { | ||||
struct sockaddr ifru_addr; | struct sockaddr ifru_addr; | ||||
struct sockaddr ifru_dstaddr; | struct sockaddr ifru_dstaddr; | ||||
struct sockaddr ifru_broadaddr; | struct sockaddr ifru_broadaddr; | ||||
struct ifreq_buffer ifru_buffer; | struct ifreq_buffer ifru_buffer; | ||||
short ifru_flags[2]; | short ifru_flags[2]; | ||||
short ifru_index; | short ifru_index; | ||||
int ifru_jid; | int ifru_jid; | ||||
int ifru_metric; | int ifru_metric; | ||||
int ifru_mtu; | int ifru_mtu; | ||||
int ifru_phys; | int ifru_phys; | ||||
int ifru_media; | int ifru_media; | ||||
caddr_t ifru_data; | caddr_t ifru_data; | ||||
int ifru_cap[2]; | int ifru_cap[2]; | ||||
u_int ifru_fib; | u_int ifru_fib; | ||||
u_char ifru_vlan_pcp; | u_char ifru_vlan_pcp; | ||||
struct ifreq_nv_req ifru_nv; | |||||
Done Inline ActionsI wonder if we shouldn't make this a generic 'struct ifreq_cap ifru_nv' instead. Odds are that sooner or later we'll want other nvlist-based calls. If we do we should also think about adding a second size fields to it. (We do this in pf, because for some calls you want both the request and the response to be an nvlist, and then you need to know the size of the requesting nvlist and the available space for the response.) kp: I wonder if we shouldn't make this a generic 'struct ifreq_cap ifru_nv' instead. Odds are that… | |||||
Done Inline ActionsDone. I had to use u_int instead of size_t for lengths, otherwise I cannot fit larger structure into existing union, without breaking all other ioctl's ABI. kib: Done. I had to use u_int instead of size_t for lengths, otherwise I cannot fit larger… | |||||
} ifr_ifru; | } ifr_ifru; | ||||
#define ifr_addr ifr_ifru.ifru_addr /* address */ | #define ifr_addr ifr_ifru.ifru_addr /* address */ | ||||
#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ | #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ | ||||
#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ | #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ | ||||
#ifndef _KERNEL | #ifndef _KERNEL | ||||
#define ifr_buffer ifr_ifru.ifru_buffer /* user supplied buffer with its length */ | #define ifr_buffer ifr_ifru.ifru_buffer /* user supplied buffer with its length */ | ||||
#endif | #endif | ||||
#define ifr_flags ifr_ifru.ifru_flags[0] /* flags (low 16 bits) */ | #define ifr_flags ifr_ifru.ifru_flags[0] /* flags (low 16 bits) */ | ||||
#define ifr_flagshigh ifr_ifru.ifru_flags[1] /* flags (high 16 bits) */ | #define ifr_flagshigh ifr_ifru.ifru_flags[1] /* flags (high 16 bits) */ | ||||
#define ifr_jid ifr_ifru.ifru_jid /* jail/vnet */ | #define ifr_jid ifr_ifru.ifru_jid /* jail/vnet */ | ||||
#define ifr_metric ifr_ifru.ifru_metric /* metric */ | #define ifr_metric ifr_ifru.ifru_metric /* metric */ | ||||
#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ | #define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ | ||||
#define ifr_phys ifr_ifru.ifru_phys /* physical wire */ | #define ifr_phys ifr_ifru.ifru_phys /* physical wire */ | ||||
#define ifr_media ifr_ifru.ifru_media /* physical media */ | #define ifr_media ifr_ifru.ifru_media /* physical media */ | ||||
#ifndef _KERNEL | #ifndef _KERNEL | ||||
#define ifr_data ifr_ifru.ifru_data /* for use by interface */ | #define ifr_data ifr_ifru.ifru_data /* for use by interface */ | ||||
#endif | #endif | ||||
#define ifr_reqcap ifr_ifru.ifru_cap[0] /* requested capabilities */ | #define ifr_reqcap ifr_ifru.ifru_cap[0] /* requested capabilities */ | ||||
#define ifr_curcap ifr_ifru.ifru_cap[1] /* current capabilities */ | #define ifr_curcap ifr_ifru.ifru_cap[1] /* current capabilities */ | ||||
#define ifr_index ifr_ifru.ifru_index /* interface index */ | #define ifr_index ifr_ifru.ifru_index /* interface index */ | ||||
#define ifr_fib ifr_ifru.ifru_fib /* interface fib */ | #define ifr_fib ifr_ifru.ifru_fib /* interface fib */ | ||||
#define ifr_vlan_pcp ifr_ifru.ifru_vlan_pcp /* VLAN priority */ | #define ifr_vlan_pcp ifr_ifru.ifru_vlan_pcp /* VLAN priority */ | ||||
#define ifr_lan_pcp ifr_ifru.ifru_vlan_pcp /* VLAN priority */ | #define ifr_lan_pcp ifr_ifru.ifru_vlan_pcp /* VLAN priority */ | ||||
#define ifr_cap_nv ifr_ifru.ifru_nv /* nv-based cap interface */ | |||||
Done Inline ActionsUpper case "nv" -> "NV" ? hselasky: Upper case "nv" -> "NV" ? | |||||
Done Inline ActionsWhy? Other abbreviations, like 'pcp', 'vlan', or 'fib' are not upper-cased. kib: Why? Other abbreviations, like 'pcp', 'vlan', or 'fib' are not upper-cased. | |||||
}; | }; | ||||
#define _SIZEOF_ADDR_IFREQ(ifr) \ | #define _SIZEOF_ADDR_IFREQ(ifr) \ | ||||
((ifr).ifr_addr.sa_len > sizeof(struct sockaddr) ? \ | ((ifr).ifr_addr.sa_len > sizeof(struct sockaddr) ? \ | ||||
(sizeof(struct ifreq) - sizeof(struct sockaddr) + \ | (sizeof(struct ifreq) - sizeof(struct sockaddr) + \ | ||||
(ifr).ifr_addr.sa_len) : sizeof(struct ifreq)) | (ifr).ifr_addr.sa_len) : sizeof(struct ifreq)) | ||||
struct ifaliasreq { | struct ifaliasreq { | ||||
▲ Show 20 Lines • Show All 155 Lines • ▼ Show 20 Lines | |||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
#ifdef MALLOC_DECLARE | #ifdef MALLOC_DECLARE | ||||
MALLOC_DECLARE(M_IFADDR); | MALLOC_DECLARE(M_IFADDR); | ||||
MALLOC_DECLARE(M_IFMADDR); | MALLOC_DECLARE(M_IFMADDR); | ||||
#endif | #endif | ||||
extern struct sx ifnet_detach_sxlock; | extern struct sx ifnet_detach_sxlock; | ||||
struct nvlist; | |||||
struct ifcap_nv_bit_name; | |||||
int if_capnv_to_capint(const struct nvlist *nv, int *old_cap, | |||||
const struct ifcap_nv_bit_name *nn, bool all); | |||||
void if_capint_to_capnv(struct nvlist *nv, | |||||
const struct ifcap_nv_bit_name *nn, int ifr_cap, int ifr_req); | |||||
struct siocsifcapnv_driver_data { | |||||
int reqcap; | |||||
int reqcap2; | |||||
struct nvlist *nvcap; | |||||
}; | |||||
#endif | #endif | ||||
#ifndef _KERNEL | #ifndef _KERNEL | ||||
struct if_nameindex { | struct if_nameindex { | ||||
unsigned int if_index; /* 1, 2, ... */ | unsigned int if_index; /* 1, 2, ... */ | ||||
char *if_name; /* null terminated name: "le0", ... */ | char *if_name; /* null terminated name: "le0", ... */ | ||||
}; | }; | ||||
__BEGIN_DECLS | __BEGIN_DECLS | ||||
void if_freenameindex(struct if_nameindex *); | void if_freenameindex(struct if_nameindex *); | ||||
char *if_indextoname(unsigned int, char *); | char *if_indextoname(unsigned int, char *); | ||||
struct if_nameindex *if_nameindex(void); | struct if_nameindex *if_nameindex(void); | ||||
unsigned int if_nametoindex(const char *); | unsigned int if_nametoindex(const char *); | ||||
__END_DECLS | __END_DECLS | ||||
#endif | #endif | ||||
#endif /* !_NET_IF_H_ */ | #endif /* !_NET_IF_H_ */ |
Maybe 64 Kbytes would be good enough. 2MBytes seems large.