Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F105299469
D38030.id114986.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
15 KB
Referenced Files
None
Subscribers
None
D38030.id114986.diff
View Options
diff --git a/sys/net/if.h b/sys/net/if.h
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -49,6 +49,11 @@
#endif
#endif
+#ifdef _KERNEL
+#include <sys/ck.h>
+#include <sys/epoch.h> /* For ifma_epoch_ctx. */
+#endif
+
/*
* Length of interface external name, including terminating '\0'.
* Note: this is the same size as a generic device's external name.
@@ -655,13 +660,184 @@
* Opaque interface structure.
*/
+struct mbuf;
+struct route;
+struct m_snd_tag;
+union if_snd_tag_alloc_params;
+union if_snd_tag_query_params;
+union if_snd_tag_modify_params;
+
typedef struct ifnet * if_t;
#ifdef _KERNEL
+
+typedef enum {
+ IFCOUNTER_IPACKETS = 0,
+ IFCOUNTER_IERRORS,
+ IFCOUNTER_OPACKETS,
+ IFCOUNTER_OERRORS,
+ IFCOUNTER_COLLISIONS,
+ IFCOUNTER_IBYTES,
+ IFCOUNTER_OBYTES,
+ IFCOUNTER_IMCASTS,
+ IFCOUNTER_OMCASTS,
+ IFCOUNTER_IQDROPS,
+ IFCOUNTER_OQDROPS,
+ IFCOUNTER_NOPROTO,
+ IFCOUNTERS /* Array size. */
+} ift_counter;
+
#ifdef MALLOC_DECLARE
MALLOC_DECLARE(M_IFADDR);
MALLOC_DECLARE(M_IFMADDR);
#endif
+typedef void (*if_start_fn_t)(if_t);
+typedef int (*if_ioctl_fn_t)(if_t, u_long, caddr_t);
+typedef void (*if_init_fn_t)(void *);
+typedef void (*if_input_fn_t)(if_t, struct mbuf *);
+typedef int (*if_output_fn_t)
+ (if_t, struct mbuf *, const struct sockaddr *, struct route *);
+typedef void (*if_qflush_fn_t)(if_t);
+typedef int (*if_transmit_fn_t)(if_t, struct mbuf *);
+typedef uint64_t (*if_get_counter_t)(if_t, ift_counter);
+
+typedef int (if_snd_tag_alloc_t)(if_t, union if_snd_tag_alloc_params *,
+ struct m_snd_tag **);
+typedef int (if_snd_tag_modify_t)(struct m_snd_tag *, union if_snd_tag_modify_params *);
+typedef int (if_snd_tag_query_t)(struct m_snd_tag *, union if_snd_tag_query_params *);
+typedef void (if_snd_tag_free_t)(struct m_snd_tag *);
+typedef struct m_snd_tag *(if_next_send_tag_t)(struct m_snd_tag *);
+
+struct ifnet* if_alloc(u_char);
+struct ifnet* if_alloc_dev(u_char, device_t dev);
+void if_attach(if_t);
+void if_free(if_t);
+void if_initname(if_t, const char *, int);
+void if_down(if_t);
+void if_link_state_change(if_t, int);
+int if_printf(if_t, const char *, ...) __printflike(2, 3);
+
+uint64_t if_get_counter_default(if_t, ift_counter);
+void if_inc_counter(if_t, ift_counter, int64_t);
+
+uint64_t if_setbaudrate(if_t ifp, uint64_t baudrate);
+uint64_t if_getbaudrate(const if_t ifp);
+int if_setcapabilities(if_t ifp, int capabilities);
+int if_setcapabilitiesbit(if_t ifp, int setbit, int clearbit);
+int if_getcapabilities(const if_t ifp);
+int if_togglecapenable(if_t ifp, int togglecap);
+int if_setcapenable(if_t ifp, int capenable);
+int if_setcapenablebit(if_t ifp, int setcap, int clearcap);
+int if_getcapenable(const if_t ifp);
+int if_getdunit(const if_t ifp);
+int if_getindex(const if_t ifp);
+const char *if_getdname(const if_t ifp);
+void if_setdname(if_t ifp, const char *name);
+const char *if_name(if_t ifp);
+int if_setname(if_t ifp, const char *name);
+void if_setdescr(if_t ifp, char *descrbuf);
+char *if_allocdescr(size_t sz, int malloc_flag);
+void if_freedescr(char *descrbuf);
+int if_getalloctype(const if_t ifp);
+int if_setdev(if_t ifp, void *dev);
+int if_setdrvflagbits(if_t ifp, int if_setflags, int clear_flags);
+int if_getdrvflags(const if_t ifp);
+int if_setdrvflags(if_t ifp, int flags);
+int if_clearhwassist(if_t ifp);
+int if_sethwassistbits(if_t ifp, int toset, int toclear);
+int if_sethwassist(if_t ifp, int hwassist_bit);
+int if_gethwassist(const if_t ifp);
+int if_togglehwassist(if_t ifp, int toggle_bits);
+int if_setsoftc(if_t ifp, void *softc);
+void *if_getsoftc(if_t ifp);
+int if_setflags(if_t ifp, int flags);
+int if_gethwaddr(const if_t ifp, struct ifreq *);
+int if_setmtu(if_t ifp, int mtu);
+int if_getmtu(const if_t ifp);
+int if_getmtu_family(const if_t ifp, int family);
+int if_setflagbits(if_t ifp, int set, int clear);
+int if_getflags(const if_t ifp);
+int if_sendq_empty(if_t ifp);
+int if_setsendqready(if_t ifp);
+int if_setsendqlen(if_t ifp, int tx_desc_count);
+int if_sethwtsomax(if_t ifp, u_int if_hw_tsomax);
+int if_sethwtsomaxsegcount(if_t ifp, u_int if_hw_tsomaxsegcount);
+int if_sethwtsomaxsegsize(if_t ifp, u_int if_hw_tsomaxsegsize);
+u_int if_gethwtsomax(const if_t ifp);
+u_int if_gethwtsomaxsegcount(const if_t ifp);
+u_int if_gethwtsomaxsegsize(const if_t ifp);
+int if_input(if_t ifp, struct mbuf* sendmp);
+int if_sendq_prepend(if_t ifp, struct mbuf *m);
+struct mbuf *if_dequeue(if_t ifp);
+int if_setifheaderlen(if_t ifp, int len);
+void if_setrcvif(struct mbuf *m, if_t ifp);
+void if_setvtag(struct mbuf *m, u_int16_t tag);
+u_int16_t if_getvtag(struct mbuf *m);
+int if_vlantrunkinuse(if_t ifp);
+caddr_t if_getlladdr(const if_t ifp);
+void *if_gethandle(u_char);
+void if_bpfmtap(if_t ifp, struct mbuf *m);
+void if_etherbpfmtap(if_t ifp, struct mbuf *m);
+void if_vlancap(if_t ifp);
+int if_transmit(if_t ifp, struct mbuf *m);
+int if_init(if_t ifp);
+
+/*
+ * Traversing through interface address lists.
+ */
+struct sockaddr_dl;
+typedef u_int iflladdr_cb_t(void *, struct sockaddr_dl *, u_int);
+u_int if_foreach_lladdr(if_t, iflladdr_cb_t, void *);
+u_int if_foreach_llmaddr(if_t, iflladdr_cb_t, void *);
+u_int if_lladdr_count(if_t);
+u_int if_llmaddr_count(if_t);
+
+int if_getamcount(const if_t ifp);
+struct ifaddr * if_getifaddr(const if_t ifp);
+typedef u_int if_addr_cb_t(void *, struct ifaddr *, u_int);
+u_int if_foreach_addr_type(if_t ifp, int type, if_addr_cb_t cb, void *cb_arg);
+
+/* Functions */
+void if_setinitfn(if_t ifp, if_init_fn_t);
+void if_setinputfn(if_t ifp, if_input_fn_t);
+void if_setioctlfn(if_t ifp, if_ioctl_fn_t);
+void if_setoutputfn(if_t ifp, int(*)
+ (if_t, struct mbuf *, const struct sockaddr *, struct route *));
+void if_setstartfn(if_t ifp, void (*)(if_t));
+void if_settransmitfn(if_t ifp, if_transmit_fn_t);
+void if_setqflushfn(if_t ifp, if_qflush_fn_t);
+void if_setgetcounterfn(if_t ifp, if_get_counter_t);
+void if_setsndtagallocfn(if_t ifp, if_snd_tag_alloc_t);
+
+/* accessors for struct ifreq */
+void *ifr_data_get_ptr(void *ifrp);
+void *ifr_buffer_get_buffer(void *data);
+size_t ifr_buffer_get_length(void *data);
+
+/*
+ * Multicast address structure. This is analogous to the ifaddr
+ * structure except that it keeps track of multicast addresses.
+ */
+#define IFMA_F_ENQUEUED 0x1
+struct ifmultiaddr {
+ CK_STAILQ_ENTRY(ifmultiaddr) ifma_link; /* queue macro glue */
+ struct sockaddr *ifma_addr; /* address this membership is for */
+ struct sockaddr *ifma_lladdr; /* link-layer translation, if any */
+ struct ifnet *ifma_ifp; /* back-pointer to interface */
+ u_int ifma_refcount; /* reference count */
+ int ifma_flags;
+ void *ifma_protospec; /* protocol-specific state, if any */
+ struct ifmultiaddr *ifma_llifma; /* pointer to ifma for ifma_lladdr */
+ struct epoch_context ifma_epoch_ctx;
+};
+
+#ifdef DEVICE_POLLING
+enum poll_cmd { POLL_ONLY, POLL_AND_CHECK_STATUS };
+
+typedef int poll_handler_t(if_t ifp, enum poll_cmd cmd, int count);
+int ether_poll_register(poll_handler_t *h, if_t ifp);
+int ether_poll_deregister(if_t ifp);
+#endif /* DEVICE_POLLING */
extern struct sx ifnet_detach_sxlock;
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -88,6 +88,7 @@
#define IF_DUNIT_NONE -1
#include <net/altq/if_altq.h>
+#include <net/if.h>
CK_STAILQ_HEAD(ifnethead, ifnet); /* we use TAILQs so that the order of */
CK_STAILQ_HEAD(ifaddrhead, ifaddr); /* instantiation is preserved in the list */
@@ -108,32 +109,6 @@
#define V_ipsec_hhh_out VNET(ipsec_hhh_out)
#endif /* _KERNEL */
-typedef enum {
- IFCOUNTER_IPACKETS = 0,
- IFCOUNTER_IERRORS,
- IFCOUNTER_OPACKETS,
- IFCOUNTER_OERRORS,
- IFCOUNTER_COLLISIONS,
- IFCOUNTER_IBYTES,
- IFCOUNTER_OBYTES,
- IFCOUNTER_IMCASTS,
- IFCOUNTER_OMCASTS,
- IFCOUNTER_IQDROPS,
- IFCOUNTER_OQDROPS,
- IFCOUNTER_NOPROTO,
- IFCOUNTERS /* Array size. */
-} ift_counter;
-
-typedef void (*if_start_fn_t)(if_t);
-typedef int (*if_ioctl_fn_t)(if_t, u_long, caddr_t);
-typedef void (*if_init_fn_t)(void *);
-typedef void (*if_input_fn_t)(struct ifnet *, struct mbuf *);
-typedef int (*if_output_fn_t)
- (struct ifnet *, struct mbuf *, const struct sockaddr *, struct route *);
-typedef void (*if_qflush_fn_t)(if_t);
-typedef int (*if_transmit_fn_t)(if_t, struct mbuf *);
-typedef uint64_t (*if_get_counter_t)(if_t, ift_counter);
-
struct ifnet_hw_tsomax {
u_int tsomaxbytes; /* TSO total burst length limit in bytes */
u_int tsomaxsegcount; /* TSO maximum segment count */
@@ -274,13 +249,6 @@
struct if_snd_tag_rate_limit_params tls_rate_limit;
};
-typedef int (if_snd_tag_alloc_t)(struct ifnet *, union if_snd_tag_alloc_params *,
- struct m_snd_tag **);
-typedef int (if_snd_tag_modify_t)(struct m_snd_tag *, union if_snd_tag_modify_params *);
-typedef int (if_snd_tag_query_t)(struct m_snd_tag *, union if_snd_tag_query_params *);
-typedef void (if_snd_tag_free_t)(struct m_snd_tag *);
-typedef struct m_snd_tag *(if_next_send_tag_t)(struct m_snd_tag *);
-
struct if_snd_tag_sw {
if_snd_tag_modify_t *snd_tag_modify;
if_snd_tag_query_t *snd_tag_query;
@@ -608,23 +576,6 @@
void ifa_ref(struct ifaddr *ifa);
int __result_use_check ifa_try_ref(struct ifaddr *ifa);
-/*
- * Multicast address structure. This is analogous to the ifaddr
- * structure except that it keeps track of multicast addresses.
- */
-#define IFMA_F_ENQUEUED 0x1
-struct ifmultiaddr {
- CK_STAILQ_ENTRY(ifmultiaddr) ifma_link; /* queue macro glue */
- struct sockaddr *ifma_addr; /* address this membership is for */
- struct sockaddr *ifma_lladdr; /* link-layer translation, if any */
- struct ifnet *ifma_ifp; /* back-pointer to interface */
- u_int ifma_refcount; /* reference count */
- int ifma_flags;
- void *ifma_protospec; /* protocol-specific state, if any */
- struct ifmultiaddr *ifma_llifma; /* pointer to ifma for ifma_lladdr */
- struct epoch_context ifma_epoch_ctx;
-};
-
extern struct sx ifnet_sxlock;
#define IFNET_WLOCK() sx_xlock(&ifnet_sxlock)
@@ -667,9 +618,6 @@
int if_delgroup(struct ifnet *, const char *);
int if_addmulti(struct ifnet *, struct sockaddr *, struct ifmultiaddr **);
int if_allmulti(struct ifnet *, int);
-struct ifnet* if_alloc(u_char);
-struct ifnet* if_alloc_dev(u_char, device_t dev);
-void if_attach(struct ifnet *);
void if_dead(struct ifnet *);
int if_delmulti(struct ifnet *, struct sockaddr *);
void if_delmulti_ifma(struct ifmultiaddr *);
@@ -677,14 +625,9 @@
void if_detach(struct ifnet *);
void if_purgeaddrs(struct ifnet *);
void if_delallmulti(struct ifnet *);
-void if_down(struct ifnet *);
struct ifmultiaddr *
if_findmulti(struct ifnet *, const struct sockaddr *);
void if_freemulti(struct ifmultiaddr *ifma);
-void if_free(struct ifnet *);
-void if_initname(struct ifnet *, const char *, int);
-void if_link_state_change(struct ifnet *, int);
-int if_printf(struct ifnet *, const char *, ...) __printflike(2, 3);
int if_log(struct ifnet *, int, const char *, ...) __printflike(3, 4);
void if_ref(struct ifnet *);
void if_rele(struct ifnet *);
@@ -718,120 +661,16 @@
void if_register_com_alloc(u_char type, if_com_alloc_t *a, if_com_free_t *f);
void if_deregister_com_alloc(u_char type);
void if_data_copy(struct ifnet *, struct if_data *);
-uint64_t if_get_counter_default(struct ifnet *, ift_counter);
-void if_inc_counter(struct ifnet *, ift_counter, int64_t);
#define IF_LLADDR(ifp) \
LLADDR((struct sockaddr_dl *)((ifp)->if_addr->ifa_addr))
-uint64_t if_setbaudrate(if_t ifp, uint64_t baudrate);
-uint64_t if_getbaudrate(const if_t ifp);
-int if_setcapabilities(if_t ifp, int capabilities);
-int if_setcapabilitiesbit(if_t ifp, int setbit, int clearbit);
-int if_getcapabilities(const if_t ifp);
-int if_togglecapenable(if_t ifp, int togglecap);
-int if_setcapenable(if_t ifp, int capenable);
-int if_setcapenablebit(if_t ifp, int setcap, int clearcap);
-int if_getcapenable(const if_t ifp);
-int if_getdunit(const if_t ifp);
-int if_getindex(const if_t ifp);
-const char *if_getdname(const if_t ifp);
-void if_setdname(if_t ifp, const char *name);
-const char *if_name(if_t ifp);
-int if_setname(if_t ifp, const char *name);
-void if_setdescr(if_t ifp, char *descrbuf);
-char *if_allocdescr(size_t sz, int malloc_flag);
-void if_freedescr(char *descrbuf);
-int if_getalloctype(const if_t ifp);
-int if_setdev(if_t ifp, void *dev);
-int if_setdrvflagbits(if_t ifp, int if_setflags, int clear_flags);
-int if_getdrvflags(const if_t ifp);
-int if_setdrvflags(if_t ifp, int flags);
-int if_clearhwassist(if_t ifp);
-int if_sethwassistbits(if_t ifp, int toset, int toclear);
-int if_sethwassist(if_t ifp, int hwassist_bit);
-int if_gethwassist(const if_t ifp);
-int if_togglehwassist(if_t ifp, int toggle_bits);
-int if_setsoftc(if_t ifp, void *softc);
-void *if_getsoftc(if_t ifp);
-int if_setflags(if_t ifp, int flags);
-int if_gethwaddr(const if_t ifp, struct ifreq *);
-int if_setmtu(if_t ifp, int mtu);
-int if_getmtu(const if_t ifp);
-int if_getmtu_family(const if_t ifp, int family);
-int if_setflagbits(if_t ifp, int set, int clear);
-int if_getflags(const if_t ifp);
-int if_sendq_empty(if_t ifp);
-int if_setsendqready(if_t ifp);
-int if_setsendqlen(if_t ifp, int tx_desc_count);
-int if_sethwtsomax(if_t ifp, u_int if_hw_tsomax);
-int if_sethwtsomaxsegcount(if_t ifp, u_int if_hw_tsomaxsegcount);
-int if_sethwtsomaxsegsize(if_t ifp, u_int if_hw_tsomaxsegsize);
-u_int if_gethwtsomax(const if_t ifp);
-u_int if_gethwtsomaxsegcount(const if_t ifp);
-u_int if_gethwtsomaxsegsize(const if_t ifp);
-int if_input(if_t ifp, struct mbuf* sendmp);
-int if_sendq_prepend(if_t ifp, struct mbuf *m);
-struct mbuf *if_dequeue(if_t ifp);
-int if_setifheaderlen(if_t ifp, int len);
-void if_setrcvif(struct mbuf *m, if_t ifp);
-void if_setvtag(struct mbuf *m, u_int16_t tag);
-u_int16_t if_getvtag(struct mbuf *m);
-int if_vlantrunkinuse(if_t ifp);
-caddr_t if_getlladdr(const if_t ifp);
-void *if_gethandle(u_char);
-void if_bpfmtap(if_t ifp, struct mbuf *m);
-void if_etherbpfmtap(if_t ifp, struct mbuf *m);
-void if_vlancap(if_t ifp);
-int if_transmit(if_t ifp, struct mbuf *m);
-int if_init(if_t ifp);
-
-/*
- * Traversing through interface address lists.
- */
-struct sockaddr_dl;
-typedef u_int iflladdr_cb_t(void *, struct sockaddr_dl *, u_int);
-u_int if_foreach_lladdr(if_t, iflladdr_cb_t, void *);
-u_int if_foreach_llmaddr(if_t, iflladdr_cb_t, void *);
-u_int if_lladdr_count(if_t);
-u_int if_llmaddr_count(if_t);
-
-int if_getamcount(const if_t ifp);
-struct ifaddr * if_getifaddr(const if_t ifp);
-typedef u_int if_addr_cb_t(void *, struct ifaddr *, u_int);
-u_int if_foreach_addr_type(if_t ifp, int type, if_addr_cb_t cb, void *cb_arg);
-
-/* Functions */
-void if_setinitfn(if_t ifp, if_init_fn_t);
-void if_setinputfn(if_t ifp, if_input_fn_t);
-void if_setioctlfn(if_t ifp, if_ioctl_fn_t);
-void if_setoutputfn(if_t ifp, int(*)
- (if_t, struct mbuf *, const struct sockaddr *, struct route *));
-void if_setstartfn(if_t ifp, void (*)(if_t));
-void if_settransmitfn(if_t ifp, if_transmit_fn_t);
-void if_setqflushfn(if_t ifp, if_qflush_fn_t);
-void if_setgetcounterfn(if_t ifp, if_get_counter_t);
-void if_setsndtagallocfn(if_t ifp, if_snd_tag_alloc_t);
-
/* TSO */
void if_hw_tsomax_common(if_t ifp, struct ifnet_hw_tsomax *);
int if_hw_tsomax_update(if_t ifp, struct ifnet_hw_tsomax *);
-/* accessors for struct ifreq */
-void *ifr_data_get_ptr(void *ifrp);
-void *ifr_buffer_get_buffer(void *data);
-size_t ifr_buffer_get_length(void *data);
-
int ifhwioctl(u_long, struct ifnet *, caddr_t, struct thread *);
-#ifdef DEVICE_POLLING
-enum poll_cmd { POLL_ONLY, POLL_AND_CHECK_STATUS };
-
-typedef int poll_handler_t(if_t ifp, enum poll_cmd cmd, int count);
-int ether_poll_register(poll_handler_t *h, if_t ifp);
-int ether_poll_deregister(if_t ifp);
-#endif /* DEVICE_POLLING */
-
#endif /* _KERNEL */
#include <net/ifq.h> /* XXXAO: temporary unconditional include */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 15, 3:47 PM (18 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15413129
Default Alt Text
D38030.id114986.diff (15 KB)
Attached To
Mode
D38030: ifnet/API: Move the IfAPI from if_var.h to if.h
Attached
Detach File
Event Timeline
Log In to Comment