Page MenuHomeFreeBSD

D38499.diff
No OneTemporary

D38499.diff

diff --git a/sys/net/if.c b/sys/net/if.c
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -3964,7 +3964,6 @@
static int
if_requestencap_default(struct ifnet *ifp, struct if_encap_req *req)
{
-
if (req->rtype != IFENCAP_LL)
return (EOPNOTSUPP);
@@ -4034,7 +4033,6 @@
int
if_gethwaddr(struct ifnet *ifp, struct ifreq *ifr)
{
-
if (ifp->if_hw_addr == NULL)
return (ENODEV);
@@ -4121,7 +4119,6 @@
static void
if_input_default(struct ifnet *ifp __unused, struct mbuf *m)
{
-
m_freem(m);
}
@@ -4198,47 +4195,42 @@
uint64_t
if_getbaudrate(const if_t ifp)
{
-
- return (((struct ifnet *)ifp)->if_baudrate);
+ return (ifp->if_baudrate);
}
int
if_setcapabilities(if_t ifp, int capabilities)
{
- ((struct ifnet *)ifp)->if_capabilities = capabilities;
+ ifp->if_capabilities = capabilities;
return (0);
}
int
if_setcapabilitiesbit(if_t ifp, int setbit, int clearbit)
{
- ((struct ifnet *)ifp)->if_capabilities &= ~clearbit;
- ((struct ifnet *)ifp)->if_capabilities |= setbit;
-
+ ifp->if_capabilities &= ~clearbit;
+ ifp->if_capabilities |= setbit;
return (0);
}
int
if_getcapabilities(const if_t ifp)
{
- return ((struct ifnet *)ifp)->if_capabilities;
+ return (ifp->if_capabilities);
}
int
if_setcapenable(if_t ifp, int capabilities)
{
- ((struct ifnet *)ifp)->if_capenable = capabilities;
+ ifp->if_capenable = capabilities;
return (0);
}
int
if_setcapenablebit(if_t ifp, int setcap, int clearcap)
{
- if(clearcap)
- ((struct ifnet *)ifp)->if_capenable &= ~clearcap;
- if(setcap)
- ((struct ifnet *)ifp)->if_capenable |= setcap;
-
+ ifp->if_capenable &= ~clearcap;
+ ifp->if_capenable |= setcap;
return (0);
}
@@ -4281,19 +4273,19 @@
const char *
if_getdname(const if_t ifp)
{
- return ((struct ifnet *)ifp)->if_dname;
+ return (ifp->if_dname);
}
void
if_setdname(if_t ifp, const char *dname)
{
- ((struct ifnet *)ifp)->if_dname = dname;
+ ifp->if_dname = dname;
}
const char *
if_name(if_t ifp)
{
- return ((struct ifnet *)ifp)->if_xname;
+ return (ifp->if_xname);
}
int
@@ -4301,7 +4293,7 @@
{
if (strlen(name) > sizeof(ifp->if_xname) - 1)
return (ENAMETOOLONG);
- strlcpy(ifp->if_xname, name, sizeof(ifp->if_xname));
+ strcpy(ifp->if_xname, name);
return (0);
}
@@ -4309,14 +4301,14 @@
int
if_togglecapenable(if_t ifp, int togglecap)
{
- ((struct ifnet *)ifp)->if_capenable ^= togglecap;
+ ifp->if_capenable ^= togglecap;
return (0);
}
int
if_getcapenable(const if_t ifp)
{
- return ((struct ifnet *)ifp)->if_capenable;
+ return (ifp->if_capenable);
}
int
@@ -4335,13 +4327,13 @@
int
if_getdunit(const if_t ifp)
{
- return ((struct ifnet *)ifp)->if_dunit;
+ return (ifp->if_dunit);
}
int
if_getindex(const if_t ifp)
{
- return ((struct ifnet *)ifp)->if_index;
+ return (ifp->if_index);
}
int
@@ -4377,7 +4369,7 @@
int
if_getalloctype(const if_t ifp)
{
- return ((struct ifnet *)ifp)->if_alloctype;
+ return (ifp->if_alloctype);
}
/*
@@ -4395,8 +4387,8 @@
int
if_setdrvflagbits(if_t ifp, int set_flags, int clear_flags)
{
- ((struct ifnet *)ifp)->if_drv_flags &= ~clear_flags;
- ((struct ifnet *)ifp)->if_drv_flags |= set_flags;
+ ifp->if_drv_flags &= ~clear_flags;
+ ifp->if_drv_flags |= set_flags;
return (0);
}
@@ -4404,20 +4396,19 @@
int
if_getdrvflags(const if_t ifp)
{
- return ((struct ifnet *)ifp)->if_drv_flags;
+ return (ifp->if_drv_flags);
}
int
if_setdrvflags(if_t ifp, int flags)
{
- ((struct ifnet *)ifp)->if_drv_flags = flags;
+ ifp->if_drv_flags = flags;
return (0);
}
int
if_setflags(if_t ifp, int flags)
{
-
ifp->if_flags = flags;
return (0);
}
@@ -4425,30 +4416,29 @@
int
if_setflagbits(if_t ifp, int set, int clear)
{
- ((struct ifnet *)ifp)->if_flags &= ~clear;
- ((struct ifnet *)ifp)->if_flags |= set;
-
+ ifp->if_flags &= ~clear;
+ ifp->if_flags |= set;
return (0);
}
int
if_getflags(const if_t ifp)
{
- return ((struct ifnet *)ifp)->if_flags;
+ return (ifp->if_flags);
}
int
if_clearhwassist(if_t ifp)
{
- ((struct ifnet *)ifp)->if_hwassist = 0;
+ ifp->if_hwassist = 0;
return (0);
}
int
if_sethwassistbits(if_t ifp, int toset, int toclear)
{
- ((struct ifnet *)ifp)->if_hwassist &= ~toclear;
- ((struct ifnet *)ifp)->if_hwassist |= toset;
+ ifp->if_hwassist &= ~toclear;
+ ifp->if_hwassist |= toset;
return (0);
}
@@ -4456,34 +4446,34 @@
int
if_sethwassist(if_t ifp, int hwassist_bit)
{
- ((struct ifnet *)ifp)->if_hwassist = hwassist_bit;
+ ifp->if_hwassist = hwassist_bit;
return (0);
}
int
if_gethwassist(const if_t ifp)
{
- return ((struct ifnet *)ifp)->if_hwassist;
+ return (ifp->if_hwassist);
}
int
if_togglehwassist(if_t ifp, int toggle_bits)
{
- ((struct ifnet *)ifp)->if_hwassist ^= toggle_bits;
+ ifp->if_hwassist ^= toggle_bits;
return (0);
}
int
if_setmtu(if_t ifp, int mtu)
{
- ((struct ifnet *)ifp)->if_mtu = mtu;
+ ifp->if_mtu = mtu;
return (0);
}
int
if_getmtu(const if_t ifp)
{
- return ((struct ifnet *)ifp)->if_mtu;
+ return (ifp->if_mtu);
}
int
@@ -4493,10 +4483,10 @@
SLIST_FOREACH(dp, &domains, dom_next) {
if (dp->dom_family == family && dp->dom_ifmtu != NULL)
- return (dp->dom_ifmtu((struct ifnet *)ifp));
+ return (dp->dom_ifmtu(ifp));
}
- return (((struct ifnet *)ifp)->if_mtu);
+ return (ifp->if_mtu);
}
/*
@@ -4625,14 +4615,14 @@
int
if_setsoftc(if_t ifp, void *softc)
{
- ((struct ifnet *)ifp)->if_softc = softc;
+ ifp->if_softc = softc;
return (0);
}
void *
if_getsoftc(const if_t ifp)
{
- return ((struct ifnet *)ifp)->if_softc;
+ return (ifp->if_softc);
}
void
@@ -4652,41 +4642,39 @@
uint16_t
if_getvtag(struct mbuf *m)
{
-
return (m->m_pkthdr.ether_vtag);
}
int
if_sendq_empty(if_t ifp)
{
- return IFQ_DRV_IS_EMPTY(&((struct ifnet *)ifp)->if_snd);
+ return (IFQ_DRV_IS_EMPTY(&ifp->if_snd));
}
struct ifaddr *
if_getifaddr(const if_t ifp)
{
- return ((struct ifnet *)ifp)->if_addr;
+ return (ifp->if_addr);
}
int
if_getamcount(const if_t ifp)
{
- return ((struct ifnet *)ifp)->if_amcount;
+ return (ifp->if_amcount);
}
int
if_setsendqready(if_t ifp)
{
- IFQ_SET_READY(&((struct ifnet *)ifp)->if_snd);
+ IFQ_SET_READY(&ifp->if_snd);
return (0);
}
int
if_setsendqlen(if_t ifp, int tx_desc_count)
{
- IFQ_SET_MAXLEN(&((struct ifnet *)ifp)->if_snd, tx_desc_count);
- ((struct ifnet *)ifp)->if_snd.ifq_drv_maxlen = tx_desc_count;
-
+ IFQ_SET_MAXLEN(&ifp->if_snd, tx_desc_count);
+ ifp->if_snd.ifq_drv_maxlen = tx_desc_count;
return (0);
}
@@ -4705,29 +4693,25 @@
int
if_vlantrunkinuse(if_t ifp)
{
- return ((struct ifnet *)ifp)->if_vlantrunk != NULL?1:0;
+ return (ifp->if_vlantrunk != NULL);
}
-int
+void
if_init(if_t ifp, void *ctx)
{
- (*((struct ifnet *)ifp)->if_init)(ctx);
- return (0);
+ (*ifp->if_init)(ctx);
}
-int
+void
if_input(if_t ifp, struct mbuf* sendmp)
{
- (*((struct ifnet *)ifp)->if_input)((struct ifnet *)ifp, sendmp);
- return (0);
-
+ (*ifp->if_input)(ifp, sendmp);
}
int
if_transmit(if_t ifp, struct mbuf *m)
{
- (*((struct ifnet *)ifp)->if_transmit)((struct ifnet *)ifp, m);
- return (0);
+ return ((*ifp->if_transmit)(ifp, m));
}
int
@@ -4743,29 +4727,29 @@
if_dequeue(if_t ifp)
{
struct mbuf *m;
- IFQ_DRV_DEQUEUE(&((struct ifnet *)ifp)->if_snd, m);
+ IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
return (m);
}
int
if_sendq_prepend(if_t ifp, struct mbuf *m)
{
- IFQ_DRV_PREPEND(&((struct ifnet *)ifp)->if_snd, m);
+ IFQ_DRV_PREPEND(&ifp->if_snd, m);
return (0);
}
int
if_setifheaderlen(if_t ifp, int len)
{
- ((struct ifnet *)ifp)->if_hdrlen = len;
+ ifp->if_hdrlen = len;
return (0);
}
caddr_t
if_getlladdr(const if_t ifp)
{
- return (IF_LLADDR((struct ifnet *)ifp));
+ return (IF_LLADDR(ifp));
}
void *
@@ -4775,83 +4759,72 @@
}
void
-if_bpfmtap(if_t ifh, struct mbuf *m)
+if_bpfmtap(if_t ifp, struct mbuf *m)
{
- struct ifnet *ifp = (struct ifnet *)ifh;
-
BPF_MTAP(ifp, m);
}
void
-if_etherbpfmtap(if_t ifh, struct mbuf *m)
+if_etherbpfmtap(if_t ifp, struct mbuf *m)
{
- struct ifnet *ifp = (struct ifnet *)ifh;
-
ETHER_BPF_MTAP(ifp, m);
}
void
-if_vlancap(if_t ifh)
+if_vlancap(if_t ifp)
{
- struct ifnet *ifp = (struct ifnet *)ifh;
VLAN_CAPABILITIES(ifp);
}
int
if_sethwtsomax(if_t ifp, u_int if_hw_tsomax)
{
-
- ((struct ifnet *)ifp)->if_hw_tsomax = if_hw_tsomax;
+ ifp->if_hw_tsomax = if_hw_tsomax;
return (0);
}
int
if_sethwtsomaxsegcount(if_t ifp, u_int if_hw_tsomaxsegcount)
{
-
- ((struct ifnet *)ifp)->if_hw_tsomaxsegcount = if_hw_tsomaxsegcount;
+ ifp->if_hw_tsomaxsegcount = if_hw_tsomaxsegcount;
return (0);
}
int
if_sethwtsomaxsegsize(if_t ifp, u_int if_hw_tsomaxsegsize)
{
-
- ((struct ifnet *)ifp)->if_hw_tsomaxsegsize = if_hw_tsomaxsegsize;
+ ifp->if_hw_tsomaxsegsize = if_hw_tsomaxsegsize;
return (0);
}
u_int
if_gethwtsomax(const if_t ifp)
{
-
- return (((struct ifnet *)ifp)->if_hw_tsomax);
+ return (ifp->if_hw_tsomax);
}
u_int
if_gethwtsomaxsegcount(const if_t ifp)
{
-
- return (((struct ifnet *)ifp)->if_hw_tsomaxsegcount);
+ return (ifp->if_hw_tsomaxsegcount);
}
u_int
if_gethwtsomaxsegsize(const if_t ifp)
{
-
- return (((struct ifnet *)ifp)->if_hw_tsomaxsegsize);
+ return (ifp->if_hw_tsomaxsegsize);
}
void
if_setinitfn(if_t ifp, if_init_fn_t init_fn)
{
- ((struct ifnet *)ifp)->if_init = init_fn;
+ ifp->if_init = init_fn;
}
void
if_setinputfn(if_t ifp, if_input_fn_t input_fn)
{
- ((struct ifnet *)ifp)->if_input = input_fn;
+ ifp->if_input = input_fn;
}
if_input_fn_t
@@ -4863,19 +4836,19 @@
void
if_setioctlfn(if_t ifp, if_ioctl_fn_t ioctl_fn)
{
- ((struct ifnet *)ifp)->if_ioctl = (void *)ioctl_fn;
+ ifp->if_ioctl = ioctl_fn;
}
void
if_setoutputfn(if_t ifp, if_output_fn_t output_fn)
{
- ((struct ifnet *)ifp)->if_output = output_fn;
+ ifp->if_output = output_fn;
}
void
if_setstartfn(if_t ifp, if_start_fn_t start_fn)
{
- ((struct ifnet *)ifp)->if_start = (void *)start_fn;
+ ifp->if_start = start_fn;
}
if_start_fn_t
@@ -4887,7 +4860,7 @@
void
if_settransmitfn(if_t ifp, if_transmit_fn_t start_fn)
{
- ((struct ifnet *)ifp)->if_transmit = start_fn;
+ ifp->if_transmit = start_fn;
}
if_transmit_fn_t
@@ -4899,21 +4872,19 @@
void
if_setqflushfn(if_t ifp, if_qflush_fn_t flush_fn)
{
- ((struct ifnet *)ifp)->if_qflush = flush_fn;
-
+ ifp->if_qflush = flush_fn;
}
void
if_setsndtagallocfn(if_t ifp, if_snd_tag_alloc_t alloc_fn)
{
- ((struct ifnet *)ifp)->if_snd_tag_alloc = alloc_fn;
+ ifp->if_snd_tag_alloc = alloc_fn;
}
int
-if_snd_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params,
+if_snd_tag_alloc(if_t ifp, union if_snd_tag_alloc_params *params,
struct m_snd_tag **mstp)
{
-
if (ifp->if_snd_tag_alloc == NULL)
return (EOPNOTSUPP);
return (ifp->if_snd_tag_alloc(ifp, params, mstp));
@@ -4922,7 +4893,6 @@
void
if_setgetcounterfn(if_t ifp, if_get_counter_t fn)
{
-
ifp->if_get_counter = fn;
}
@@ -5062,7 +5032,6 @@
static void
if_show_ifnet(struct ifnet *ifp)
{
-
if (ifp == NULL)
return;
db_printf("%s:\n", ifp->if_xname);
@@ -5112,7 +5081,6 @@
DB_SHOW_COMMAND(ifnet, db_show_ifnet)
{
-
if (!have_addr) {
db_printf("usage: show ifnet <struct ifnet *>\n");
return;
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
@@ -633,7 +633,7 @@
u_int if_gethwtsomaxsegsize(const if_t ifp);
void if_setnetmapadapter(if_t ifp, struct netmap_adapter *na);
struct netmap_adapter *if_getnetmapadapter(if_t ifp);
-int if_input(if_t ifp, struct mbuf* sendmp);
+void 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);
@@ -648,7 +648,7 @@
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, void *ctx);
+void if_init(if_t ifp, void *ctx);
int if_resolvemulti(if_t ifp, struct sockaddr **, struct sockaddr *);
uint64_t if_getcounter(if_t ifp, ift_counter counter);
struct label *if_getmaclabel(if_t ifp);

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 18, 9:42 PM (22 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14705162
Default Alt Text
D38499.diff (11 KB)

Event Timeline