Update to FreeBSD head 2017-06-01

Git mirror commit dfb26efac4ce9101dda240e94d9ab53f80a9e131.

Update #3472.
This commit is contained in:
Sebastian Huber
2018-08-07 12:12:37 +02:00
parent a25e6a9d18
commit de261e0404
257 changed files with 3909 additions and 2604 deletions

View File

@@ -152,7 +152,7 @@
#define RIO_STATS /* collect statistics */
#define TV_DELTA(a, b, delta) { \
register int xxs; \
int xxs; \
\
delta = (a)->tv_usec - (b)->tv_usec; \
if ((xxs = (a)->tv_sec - (b)->tv_sec) != 0) { \

View File

@@ -77,7 +77,7 @@ struct red;
(((a)->tv_usec < (b)->tv_usec) && ((a)->tv_sec <= (b)->tv_sec)))
#define TV_DELTA(a, b, delta) { \
register int xxs; \
int xxs; \
\
delta = (a)->tv_usec - (b)->tv_usec; \
if ((xxs = (a)->tv_sec - (b)->tv_sec)) { \
@@ -98,7 +98,7 @@ struct red;
}
#define TV_ADD_DELTA(a, delta, res) { \
register int xxus = (a)->tv_usec + (delta); \
int xxus = (a)->tv_usec + (delta); \
\
(res)->tv_sec = (a)->tv_sec; \
while (xxus >= 1000000) { \

View File

@@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$");
#ifdef _KERNEL
#define MINDEX(m, k) \
{ \
register int len = m->m_len; \
int len = m->m_len; \
\
while (k >= len) { \
k -= len; \
@@ -343,7 +343,7 @@ bpf_filter(const struct bpf_insn *pc, u_char *p, u_int wirelen, u_int buflen)
k = pc->k;
if (k >= buflen) {
#ifdef _KERNEL
register struct mbuf *m;
struct mbuf *m;
if (buflen != 0)
return (0);
@@ -551,8 +551,8 @@ static const u_short bpf_code_map[] = {
int
bpf_validate(const struct bpf_insn *f, int len)
{
register int i;
register const struct bpf_insn *p;
int i;
const struct bpf_insn *p;
/* Do not accept negative length filter. */
if (len < 0)
@@ -574,7 +574,7 @@ bpf_validate(const struct bpf_insn *f, int len)
* the code block.
*/
if (BPF_CLASS(p->code) == BPF_JMP) {
register u_int offset;
u_int offset;
if (p->code == (BPF_JMP|BPF_JA))
offset = p->k;

View File

@@ -2,7 +2,7 @@
/*-
* Copyright (C) 2002-2003 NetGroup, Politecnico di Torino (Italy)
* Copyright (C) 2005-2009 Jung-uk Kim <jkim@FreeBSD.org>
* Copyright (C) 2005-2017 Jung-uk Kim <jkim@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -52,8 +52,6 @@ __FBSDID("$FreeBSD$");
#include <net/bpf.h>
#include <net/bpf_jitter.h>
bpf_filter_func bpf_jit_compile(struct bpf_insn *, u_int, size_t *);
static u_int bpf_jit_accept_all(u_char *, u_int, u_int);
#ifdef _KERNEL
@@ -103,13 +101,11 @@ void
bpf_destroy_jit_filter(bpf_jit_filter *filter)
{
#ifdef _KERNEL
if (filter->func != bpf_jit_accept_all)
free(filter->func, M_BPFJIT);
bpf_jit_free(filter->func, filter->size);
#ifdef _KERNEL
free(filter, M_BPFJIT);
#else
if (filter->func != bpf_jit_accept_all)
munmap(filter->func, filter->size);
free(filter);
#endif
}

View File

@@ -80,4 +80,12 @@ bpf_jit_filter *bpf_jitter(struct bpf_insn *fp, int nins);
*/
void bpf_destroy_jit_filter(bpf_jit_filter *filter);
/*
* Declarations for machine-dependent functions.
*/
struct bpf_insn;
bpf_filter_func bpf_jit_compile(struct bpf_insn *, u_int, size_t *);
void bpf_jit_free(void *, size_t);
#endif /* _NET_BPF_JITTER_H_ */

View File

@@ -92,7 +92,7 @@ struct ether_vlan_header {
#define EVL_PRIOFTAG(tag) (((tag) >> 13) & 7)
#define EVL_CFIOFTAG(tag) (((tag) >> 12) & 1)
#define EVL_MAKETAG(vlid, pri, cfi) \
((((((pri) & 7) << 13) | ((cfi) & 1)) << 12) | ((vlid) & EVL_VLID_MASK))
((((((pri) & 7) << 1) | ((cfi) & 1)) << 12) | ((vlid) & EVL_VLID_MASK))
/*
* NOTE: 0x0000-0x05DC (0..1500) are generally IEEE 802.3 length fields.

View File

@@ -1123,6 +1123,7 @@ lacp_compose_key(struct lacp_port *lp)
case IFM_10G_CR1:
case IFM_10G_ER:
case IFM_10G_SFI:
case IFM_10G_AOC:
key = IFM_10G_LR;
break;
case IFM_20G_KR2:
@@ -1147,6 +1148,9 @@ lacp_compose_key(struct lacp_port *lp)
case IFM_25G_CR:
case IFM_25G_KR:
case IFM_25G_SR:
case IFM_25G_LR:
case IFM_25G_ACC:
case IFM_25G_AOC:
key = IFM_25G_PCIE;
break;
case IFM_40G_CR4:

View File

@@ -746,6 +746,11 @@ if_attach_internal(struct ifnet *ifp, int vmove, struct if_clone *ifc)
/* Reliably crash if used uninitialized. */
ifp->if_broadcastaddr = NULL;
if (ifp->if_type == IFT_ETHER) {
ifp->if_hw_addr = malloc(ifp->if_addrlen, M_IFADDR,
M_WAITOK | M_ZERO);
}
#if defined(INET) || defined(INET6)
/* Use defaults for TSO, if nothing is set */
if (ifp->if_hw_tsomax == 0 &&
@@ -1061,6 +1066,8 @@ if_detach_internal(struct ifnet *ifp, int vmove, struct if_clone **ifcp)
* Remove link ifaddr pointer and maybe decrement if_index.
* Clean up all addresses.
*/
free(ifp->if_hw_addr, M_IFADDR);
ifp->if_hw_addr = NULL;
ifp->if_addr = NULL;
/* We can now free link ifaddr. */
@@ -2669,6 +2676,10 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td)
ifr->ifr_addr.sa_data, ifr->ifr_addr.sa_len);
break;
case SIOCGHWADDR:
error = if_gethwaddr(ifp, ifr);
break;
case SIOCAIFGROUP:
{
struct ifgroupreq *ifgr = (struct ifgroupreq *)ifr;
@@ -3601,6 +3612,29 @@ if_requestencap_default(struct ifnet *ifp, struct if_encap_req *req)
return (0);
}
/*
* Get the link layer address that was read from the hardware at attach.
*
* This is only set by Ethernet NICs (IFT_ETHER), but laggX interfaces re-type
* their component interfaces as IFT_IEEE8023ADLAG.
*/
int
if_gethwaddr(struct ifnet *ifp, struct ifreq *ifr)
{
if (ifp->if_hw_addr == NULL)
return (ENODEV);
switch (ifp->if_type) {
case IFT_ETHER:
case IFT_IEEE8023ADLAG:
bcopy(ifp->if_hw_addr, ifr->ifr_addr.sa_data, ifp->if_addrlen);
return (0);
default:
return (ENODEV);
}
}
/*
* The name argument must be a pointer to storage which will last as
* long as the interface does. For physical devices, the result of

View File

@@ -942,8 +942,12 @@ bridge_set_ifcap(struct bridge_softc *sc, struct bridge_iflist *bif, int set)
error = (*ifp->if_ioctl)(ifp, SIOCSIFCAP, (caddr_t)&ifr);
if (error)
if_printf(sc->sc_ifp,
"error setting interface capabilities on %s\n",
ifp->if_xname);
"error setting capabilities on %s: %d\n",
ifp->if_xname, error);
if ((ifp->if_capenable & ~set) != 0)
if_printf(sc->sc_ifp,
"can't disable some capabilities on %s: 0x%x\n",
ifp->if_xname, ifp->if_capenable & ~set);
}
}

View File

@@ -404,8 +404,8 @@ epair_start_locked(struct ifnet *ifp)
return;
/*
* We get patckets here from ether_output via if_handoff()
* and ned to put them into the input queue of the oifp
* We get packets here from ether_output via if_handoff()
* and need to put them into the input queue of the oifp
* and call oifp->if_input() via netisr/epair_sintr().
*/
oifp = sc->oifp;

View File

@@ -918,6 +918,9 @@ ether_ifattach(struct ifnet *ifp, const u_int8_t *lla)
sdl->sdl_alen = ifp->if_addrlen;
bcopy(lla, LLADDR(sdl), ifp->if_addrlen);
if (ifp->if_hw_addr != NULL)
bcopy(lla, ifp->if_hw_addr, ifp->if_addrlen);
bpfattach(ifp, DLT_EN10MB, ETHER_HDR_LEN);
if (ng_ether_attach_p != NULL)
(*ng_ether_attach_p)(ifp);

View File

@@ -90,7 +90,7 @@ __FBSDID("$FreeBSD$");
#include <machine/in_cksum.h>
#include <security/mac/mac_framework.h>
#define GREMTU 1500
#define GREMTU 1476
static const char grename[] = "gre";
static MALLOC_DEFINE(M_GRE, grename, "Generic Routing Encapsulation");
static VNET_DEFINE(struct mtx, gre_mtx);
@@ -179,7 +179,7 @@ gre_clone_create(struct if_clone *ifc, int unit, caddr_t params)
GRE2IFP(sc)->if_softc = sc;
if_initname(GRE2IFP(sc), grename, unit);
GRE2IFP(sc)->if_mtu = sc->gre_mtu = GREMTU;
GRE2IFP(sc)->if_mtu = GREMTU;
GRE2IFP(sc)->if_flags = IFF_POINTOPOINT|IFF_MULTICAST;
GRE2IFP(sc)->if_output = gre_output;
GRE2IFP(sc)->if_ioctl = gre_ioctl;
@@ -237,7 +237,8 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
/* XXX: */
if (ifr->ifr_mtu < 576)
return (EINVAL);
break;
ifp->if_mtu = ifr->ifr_mtu;
return (0);
case SIOCSIFADDR:
ifp->if_flags |= IFF_UP;
case SIOCSIFFLAGS:
@@ -261,12 +262,6 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
}
error = 0;
switch (cmd) {
case SIOCSIFMTU:
GRE_WLOCK(sc);
sc->gre_mtu = ifr->ifr_mtu;
gre_updatehdr(sc);
GRE_WUNLOCK(sc);
goto end;
case SIOCSIFPHYADDR:
#ifdef INET6
case SIOCSIFPHYADDR_IN6:
@@ -555,7 +550,6 @@ gre_updatehdr(struct gre_softc *sc)
} else
sc->gre_oseq = 0;
gh->gre_flags = htons(flags);
GRE2IFP(sc)->if_mtu = sc->gre_mtu - sc->gre_hlen;
}
static void

View File

@@ -69,7 +69,6 @@ struct gre_softc {
uint32_t gre_oseq;
uint32_t gre_key;
uint32_t gre_options;
uint32_t gre_mtu;
u_int gre_fibnum;
u_int gre_hlen; /* header size */
union {

File diff suppressed because it is too large Load Diff

View File

@@ -185,10 +185,6 @@ struct lagg_ifreq {
#define sc_ifflags sc_ifp->if_flags /* flags */
#define sc_ifname sc_ifp->if_xname /* name */
#define sc_capabilities sc_ifp->if_capabilities /* capabilities */
#define IFCAP_LAGG_MASK 0xffff0000 /* private capabilities */
#define IFCAP_LAGG_FULLDUPLEX 0x00010000 /* full duplex with >1 ports */
/* Private data used by the loadbalancing protocol */
struct lagg_lb {
@@ -202,19 +198,6 @@ struct lagg_mc {
SLIST_ENTRY(lagg_mc) mc_entries;
};
typedef enum {
LAGG_LLQTYPE_PHYS = 0, /* Task related to physical (underlying) port */
LAGG_LLQTYPE_VIRT, /* Task related to lagg interface itself */
} lagg_llqtype;
/* List of interfaces to have the MAC address modified */
struct lagg_llq {
struct ifnet *llq_ifp;
uint8_t llq_lladdr[ETHER_ADDR_LEN];
lagg_llqtype llq_type;
SLIST_ENTRY(lagg_llq) llq_entries;
};
struct lagg_counters {
uint64_t val[IFCOUNTERS];
};
@@ -222,6 +205,7 @@ struct lagg_counters {
struct lagg_softc {
struct ifnet *sc_ifp; /* virtual interface */
struct rmlock sc_mtx;
struct sx sc_sx;
int sc_proto; /* lagg protocol */
u_int sc_count; /* number of ports */
u_int sc_active; /* active port count */
@@ -232,13 +216,11 @@ struct lagg_softc {
void *sc_psc; /* protocol data */
uint32_t sc_seq; /* sequence counter */
uint32_t sc_flags;
int sc_destroying; /* destroying lagg */
SLIST_HEAD(__tplhd, lagg_port) sc_ports; /* list of interfaces */
SLIST_ENTRY(lagg_softc) sc_entries;
struct task sc_lladdr_task;
SLIST_HEAD(__llqhd, lagg_llq) sc_llq_head; /* interfaces to program
the lladdr on */
eventhandler_tag vlan_attach;
eventhandler_tag vlan_detach;
struct callout sc_callout;
@@ -258,12 +240,10 @@ struct lagg_port {
uint32_t lp_prio; /* port priority */
uint32_t lp_flags; /* port flags */
int lp_ifflags; /* saved ifp flags */
int lp_ifcapenable; /* saved ifp capenable */
void *lh_cookie; /* if state hook */
void *lp_psc; /* protocol data */
int lp_detaching; /* ifnet is detaching */
#define LAGG_PORT_DETACH 0x01 /* detach lagg port */
#define LAGG_CLONE_DESTROY 0x02 /* destroy lagg clone */
SLIST_HEAD(__mclhd, lagg_mc) lp_mc_head; /* multicast addresses */
/* Redirected callbacks */
@@ -285,6 +265,16 @@ struct lagg_port {
#define LAGG_WLOCK_ASSERT(_sc) rm_assert(&(_sc)->sc_mtx, RA_WLOCKED)
#define LAGG_UNLOCK_ASSERT(_sc) rm_assert(&(_sc)->sc_mtx, RA_UNLOCKED)
#define LAGG_SX_INIT(_sc) sx_init(&(_sc)->sc_sx, "if_lagg sx")
#define LAGG_SX_DESTROY(_sc) sx_destroy(&(_sc)->sc_sx)
#define LAGG_SLOCK(_sc) sx_slock(&(_sc)->sc_sx)
#define LAGG_XLOCK(_sc) sx_xlock(&(_sc)->sc_sx)
#define LAGG_SUNLOCK(_sc) sx_sunlock(&(_sc)->sc_sx)
#define LAGG_XUNLOCK(_sc) sx_xunlock(&(_sc)->sc_sx)
#define LAGG_SXLOCK_ASSERT(_sc) sx_assert(&(_sc)->sc_sx, SA_LOCKED)
#define LAGG_SLOCK_ASSERT(_sc) sx_assert(&(_sc)->sc_sx, SA_SLOCKED)
#define LAGG_XLOCK_ASSERT(_sc) sx_assert(&(_sc)->sc_sx, SA_XLOCKED)
extern struct mbuf *(*lagg_input_p)(struct ifnet *, struct mbuf *);
extern void (*lagg_linkstate_p)(struct ifnet *, int );

View File

@@ -536,7 +536,7 @@ lltable_drain(int af)
{
struct lltable *llt;
struct llentry *lle;
register int i;
int i;
LLTABLE_LIST_RLOCK();
SLIST_FOREACH(llt, &V_lltables, llt_link) {

View File

@@ -123,7 +123,7 @@ ifmedia_add(ifm, mword, data, aux)
int data;
void *aux;
{
register struct ifmedia_entry *entry;
struct ifmedia_entry *entry;
#ifdef IFMEDIA_DEBUG
if (ifmedia_debug) {

View File

@@ -196,6 +196,10 @@ uint64_t ifmedia_baudrate(int);
#define IFM_25G_SR IFM_X(55) /* 25GBase-SR */
#define IFM_50G_CR2 IFM_X(56) /* 50GBase-CR2 */
#define IFM_50G_KR2 IFM_X(57) /* 50GBase-KR2 */
#define IFM_25G_LR IFM_X(58) /* 25GBase-LR */
#define IFM_10G_AOC IFM_X(59) /* 10G active optical cable */
#define IFM_25G_ACC IFM_X(60) /* 25G active copper cable */
#define IFM_25G_AOC IFM_X(61) /* 25G active optical cable */
/*
* Please update ieee8023ad_lacp.c:lacp_compose_key()
@@ -450,6 +454,10 @@ struct ifmedia_description {
{ IFM_25G_SR, "25GBase-SR" }, \
{ IFM_50G_CR2, "50GBase-CR2" }, \
{ IFM_50G_KR2, "50GBase-KR2" }, \
{ IFM_25G_LR, "25GBase-LR" }, \
{ IFM_10G_AOC, "10GBase-AOC" }, \
{ IFM_25G_ACC, "25GBase-ACC" }, \
{ IFM_25G_AOC, "25GBase-AOC" }, \
{ 0, NULL }, \
}
@@ -782,6 +790,10 @@ struct ifmedia_baudrate {
{ IFM_ETHER | IFM_25G_SR, IF_Gbps(25ULL) }, \
{ IFM_ETHER | IFM_50G_CR2, IF_Gbps(50ULL) }, \
{ IFM_ETHER | IFM_50G_KR2, IF_Gbps(50ULL) }, \
{ IFM_ETHER | IFM_25G_LR, IF_Gbps(25ULL) }, \
{ IFM_ETHER | IFM_10G_AOC, IF_Gbps(10ULL) }, \
{ IFM_ETHER | IFM_25G_ACC, IF_Gbps(25ULL) }, \
{ IFM_ETHER | IFM_25G_AOC, IF_Gbps(25ULL) }, \
\
{ IFM_TOKEN | IFM_TOK_STP4, IF_Mbps(4) }, \
{ IFM_TOKEN | IFM_TOK_STP16, IF_Mbps(16) }, \

View File

@@ -281,6 +281,7 @@ struct ifnet {
struct ifmultihead if_multiaddrs; /* multicast addresses configured */
int if_amcount; /* number of all-multicast requests */
struct ifaddr *if_addr; /* pointer to link-level address */
void *if_hw_addr; /* hardware link-level address */
const u_int8_t *if_broadcastaddr; /* linklevel broadcast bytestring */
struct rwlock if_afdata_lock;
void *if_afdata[AF_MAX];
@@ -664,6 +665,7 @@ int if_gethwassist(if_t ifp);
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(if_t ifp, struct ifreq *);
int if_setmtu(if_t ifp, int mtu);
int if_getmtu(if_t ifp);
int if_getmtu_family(if_t ifp, int family);

View File

@@ -115,6 +115,7 @@ struct ifvlan {
#define PARENT(ifv) ((ifv)->ifv_trunk->parent)
void *ifv_cookie;
int ifv_pflags; /* special flags we have set on parent */
int ifv_capenable;
struct ifv_linkmib {
int ifvm_encaplen; /* encapsulation length */
int ifvm_mtufudge; /* MTU fudged by this much */
@@ -475,6 +476,7 @@ trunk_destroy(struct ifvlantrunk *trunk)
trunk->parent->if_vlantrunk = NULL;
TRUNK_UNLOCK(trunk);
TRUNK_LOCK_DESTROY(trunk);
if_rele(trunk->parent);
free(trunk, M_VLAN);
}
@@ -849,16 +851,20 @@ vlan_clone_match_ethervid(const char *name, int *vidp)
if ((cp = strchr(ifname, '.')) == NULL)
return (NULL);
*cp = '\0';
if ((ifp = ifunit(ifname)) == NULL)
if ((ifp = ifunit_ref(ifname)) == NULL)
return (NULL);
/* Parse VID. */
if (*++cp == '\0')
if (*++cp == '\0') {
if_rele(ifp);
return (NULL);
}
vid = 0;
for(; *cp >= '0' && *cp <= '9'; cp++)
vid = (vid * 10) + (*cp - '0');
if (*cp != '\0')
if (*cp != '\0') {
if_rele(ifp);
return (NULL);
}
if (vidp != NULL)
*vidp = vid;
@@ -891,7 +897,6 @@ vlan_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params)
int unit;
int error;
int vid;
int ethertag;
struct ifvlan *ifv;
struct ifnet *ifp;
struct ifnet *p;
@@ -916,23 +921,21 @@ vlan_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params)
error = copyin(params, &vlr, sizeof(vlr));
if (error)
return error;
p = ifunit(vlr.vlr_parent);
p = ifunit_ref(vlr.vlr_parent);
if (p == NULL)
return (ENXIO);
error = ifc_name2unit(name, &unit);
if (error != 0)
if (error != 0) {
if_rele(p);
return (error);
ethertag = 1;
}
vid = vlr.vlr_tag;
wildcard = (unit < 0);
} else if ((p = vlan_clone_match_ethervid(name, &vid)) != NULL) {
ethertag = 1;
unit = -1;
wildcard = 0;
} else {
ethertag = 0;
p = NULL;
error = ifc_name2unit(name, &unit);
if (error != 0)
return (error);
@@ -941,8 +944,11 @@ vlan_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params)
}
error = ifc_alloc_unit(ifc, &unit);
if (error != 0)
if (error != 0) {
if (p != NULL)
if_rele(p);
return (error);
}
/* In the wildcard case, we need to update the name. */
if (wildcard) {
@@ -958,6 +964,8 @@ vlan_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params)
if (ifp == NULL) {
ifc_free_unit(ifc, unit);
free(ifv, M_VLAN);
if (p != NULL)
if_rele(p);
return (ENOSPC);
}
SLIST_INIT(&ifv->vlan_mc_listhead);
@@ -991,8 +999,9 @@ vlan_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params)
sdl = (struct sockaddr_dl *)ifa->ifa_addr;
sdl->sdl_type = IFT_L2VLAN;
if (ethertag) {
if (p != NULL) {
error = vlan_config(ifv, p, vid);
if_rele(p);
if (error != 0) {
/*
* Since we've partially failed, we need to back
@@ -1279,6 +1288,7 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t vid)
TRUNK_LOCK(trunk);
p->if_vlantrunk = trunk;
trunk->parent = p;
if_ref(trunk->parent);
} else {
VLAN_LOCK();
exists:
@@ -1296,6 +1306,7 @@ exists:
ifv->ifv_encaplen = ETHER_VLAN_ENCAP_LEN;
ifv->ifv_mintu = ETHERMIN;
ifv->ifv_pflags = 0;
ifv->ifv_capenable = -1;
/*
* If the parent supports the VLAN_MTU capability,
@@ -1547,9 +1558,14 @@ vlan_capabilities(struct ifvlan *ifv)
struct ifnet *p = PARENT(ifv);
struct ifnet *ifp = ifv->ifv_ifp;
struct ifnet_hw_tsomax hw_tsomax;
int cap = 0, ena = 0, mena;
u_long hwa = 0;
TRUNK_LOCK_ASSERT(TRUNK(ifv));
/* Mask parent interface enabled capabilities disabled by user. */
mena = p->if_capenable & ifv->ifv_capenable;
/*
* If the parent interface can do checksum offloading
* on VLANs, then propagate its hardware-assisted
@@ -1557,17 +1573,18 @@ vlan_capabilities(struct ifvlan *ifv)
* offloading requires hardware VLAN tagging.
*/
if (p->if_capabilities & IFCAP_VLAN_HWCSUM)
ifp->if_capabilities = p->if_capabilities & IFCAP_HWCSUM;
cap |= p->if_capabilities & (IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6);
if (p->if_capenable & IFCAP_VLAN_HWCSUM &&
p->if_capenable & IFCAP_VLAN_HWTAGGING) {
ifp->if_capenable = p->if_capenable & IFCAP_HWCSUM;
ifp->if_hwassist = p->if_hwassist & (CSUM_IP | CSUM_TCP |
CSUM_UDP | CSUM_SCTP);
} else {
ifp->if_capenable = 0;
ifp->if_hwassist = 0;
ena |= mena & (IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6);
if (ena & IFCAP_TXCSUM)
hwa |= p->if_hwassist & (CSUM_IP | CSUM_TCP |
CSUM_UDP | CSUM_SCTP);
if (ena & IFCAP_TXCSUM_IPV6)
hwa |= p->if_hwassist & (CSUM_TCP_IPV6 |
CSUM_UDP_IPV6 | CSUM_SCTP_IPV6);
}
/*
* If the parent interface can do TSO on VLANs then
* propagate the hardware-assisted flag. TSO on VLANs
@@ -1577,15 +1594,23 @@ vlan_capabilities(struct ifvlan *ifv)
if_hw_tsomax_common(p, &hw_tsomax);
if_hw_tsomax_update(ifp, &hw_tsomax);
if (p->if_capabilities & IFCAP_VLAN_HWTSO)
ifp->if_capabilities |= p->if_capabilities & IFCAP_TSO;
cap |= p->if_capabilities & IFCAP_TSO;
if (p->if_capenable & IFCAP_VLAN_HWTSO) {
ifp->if_capenable |= p->if_capenable & IFCAP_TSO;
ifp->if_hwassist |= p->if_hwassist & CSUM_TSO;
} else {
ifp->if_capenable &= ~(p->if_capenable & IFCAP_TSO);
ifp->if_hwassist &= ~(p->if_hwassist & CSUM_TSO);
ena |= mena & IFCAP_TSO;
if (ena & IFCAP_TSO)
hwa |= p->if_hwassist & CSUM_TSO;
}
/*
* If the parent interface can do LRO and checksum offloading on
* VLANs, then guess it may do LRO on VLANs. False positive here
* cost nothing, while false negative may lead to some confusions.
*/
if (p->if_capabilities & IFCAP_VLAN_HWCSUM)
cap |= p->if_capabilities & IFCAP_LRO;
if (p->if_capenable & IFCAP_VLAN_HWCSUM)
ena |= p->if_capenable & IFCAP_LRO;
/*
* If the parent interface can offload TCP connections over VLANs then
* propagate its TOE capability to the VLAN interface.
@@ -1596,20 +1621,31 @@ vlan_capabilities(struct ifvlan *ifv)
*/
#define IFCAP_VLAN_TOE IFCAP_TOE
if (p->if_capabilities & IFCAP_VLAN_TOE)
ifp->if_capabilities |= p->if_capabilities & IFCAP_TOE;
cap |= p->if_capabilities & IFCAP_TOE;
if (p->if_capenable & IFCAP_VLAN_TOE) {
TOEDEV(ifp) = TOEDEV(p);
ifp->if_capenable |= p->if_capenable & IFCAP_TOE;
ena |= mena & IFCAP_TOE;
}
/*
* If the parent interface supports dynamic link state, so does the
* VLAN interface.
*/
cap |= (p->if_capabilities & IFCAP_LINKSTATE);
ena |= (mena & IFCAP_LINKSTATE);
#ifdef RATELIMIT
/*
* If the parent interface supports ratelimiting, so does the
* VLAN interface.
*/
ifp->if_capabilities |= (p->if_capabilities & IFCAP_TXRTLMT);
ifp->if_capenable |= (p->if_capenable & IFCAP_TXRTLMT);
cap |= (p->if_capabilities & IFCAP_TXRTLMT);
ena |= (mena & IFCAP_TXRTLMT);
#endif
ifp->if_capabilities = cap;
ifp->if_capenable = ena;
ifp->if_hwassist = hwa;
}
static void
@@ -1668,8 +1704,10 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
VLAN_LOCK();
if (TRUNK(ifv) != NULL) {
p = PARENT(ifv);
if_ref(p);
VLAN_UNLOCK();
error = (*p->if_ioctl)(p, SIOCGIFMEDIA, data);
if_rele(p);
/* Limit the result to the parent's current config. */
if (error == 0) {
struct ifmediareq *ifmr;
@@ -1731,12 +1769,13 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
vlan_unconfig(ifp);
break;
}
p = ifunit(vlr.vlr_parent);
p = ifunit_ref(vlr.vlr_parent);
if (p == NULL) {
error = ENOENT;
break;
}
error = vlan_config(ifv, p, vlr.vlr_tag);
if_rele(p);
if (error)
break;
@@ -1813,6 +1852,18 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
vlan_tag_recalculate(ifv);
break;
case SIOCSIFCAP:
VLAN_LOCK();
ifv->ifv_capenable = ifr->ifr_reqcap;
trunk = TRUNK(ifv);
if (trunk != NULL) {
TRUNK_LOCK(trunk);
vlan_capabilities(ifv);
TRUNK_UNLOCK(trunk);
}
VLAN_UNLOCK();
break;
default:
error = EINVAL;
break;

View File

@@ -215,7 +215,9 @@ typedef struct if_softc_ctx {
iflib_intr_mode_t isc_intr;
uint16_t isc_max_frame_size; /* set at init time by driver */
uint32_t isc_pause_frames; /* set by driver for iflib_timer to detect */
pci_vendor_info_t isc_vendor_info; /* set by iflib prior to attach_pre */
int isc_disable_msix;
if_txrx_t isc_txrx;
} *if_softc_ctx_t;

View File

@@ -55,7 +55,6 @@
#define NETISR_ARP 4 /* same as AF_LINK */
#define NETISR_ETHER 5 /* ethernet input */
#define NETISR_IPV6 6
#define NETISR_NATM 7
#define NETISR_EPAIR 8 /* if_epair(4) */
#define NETISR_IP_DIRECT 9 /* direct-dispatch IPv4 */
#define NETISR_IPV6_DIRECT 10 /* direct-dispatch IPv6 */

View File

@@ -265,25 +265,35 @@ struct rt_msghdr {
/*
* Message types.
*
* The format for each message is annotated below using the following
* identifiers:
*
* (1) struct rt_msghdr
* (2) struct ifa_msghdr
* (3) struct if_msghdr
* (4) struct ifma_msghdr
* (5) struct if_announcemsghdr
*
*/
#define RTM_ADD 0x1 /* Add Route */
#define RTM_DELETE 0x2 /* Delete Route */
#define RTM_CHANGE 0x3 /* Change Metrics or flags */
#define RTM_GET 0x4 /* Report Metrics */
#define RTM_LOSING 0x5 /* Kernel Suspects Partitioning */
#define RTM_REDIRECT 0x6 /* Told to use different route */
#define RTM_MISS 0x7 /* Lookup failed on this address */
#define RTM_LOCK 0x8 /* fix specified metrics */
#define RTM_ADD 0x1 /* (1) Add Route */
#define RTM_DELETE 0x2 /* (1) Delete Route */
#define RTM_CHANGE 0x3 /* (1) Change Metrics or flags */
#define RTM_GET 0x4 /* (1) Report Metrics */
#define RTM_LOSING 0x5 /* (1) Kernel Suspects Partitioning */
#define RTM_REDIRECT 0x6 /* (1) Told to use different route */
#define RTM_MISS 0x7 /* (1) Lookup failed on this address */
#define RTM_LOCK 0x8 /* (1) fix specified metrics */
/* 0x9 */
/* 0xa */
#define RTM_RESOLVE 0xb /* req to resolve dst to LL addr */
#define RTM_NEWADDR 0xc /* address being added to iface */
#define RTM_DELADDR 0xd /* address being removed from iface */
#define RTM_IFINFO 0xe /* iface going up/down etc. */
#define RTM_NEWMADDR 0xf /* mcast group membership being added to if */
#define RTM_DELMADDR 0x10 /* mcast group membership being deleted */
#define RTM_IFANNOUNCE 0x11 /* iface arrival/departure */
#define RTM_IEEE80211 0x12 /* IEEE80211 wireless event */
#define RTM_RESOLVE 0xb /* (1) req to resolve dst to LL addr */
#define RTM_NEWADDR 0xc /* (2) address being added to iface */
#define RTM_DELADDR 0xd /* (2) address being removed from iface */
#define RTM_IFINFO 0xe /* (3) iface going up/down etc. */
#define RTM_NEWMADDR 0xf /* (4) mcast group membership being added to if */
#define RTM_DELMADDR 0x10 /* (4) mcast group membership being deleted */
#define RTM_IFANNOUNCE 0x11 /* (5) iface arrival/departure */
#define RTM_IEEE80211 0x12 /* (5) IEEE80211 wireless event */
/*
* Bitmask values for rtm_inits and rmx_locks.
@@ -342,11 +352,10 @@ struct rt_addrinfo {
* This macro returns the size of a struct sockaddr when passed
* through a routing socket. Basically we round up sa_len to
* a multiple of sizeof(long), with a minimum of sizeof(long).
* The check for a NULL pointer is just a convenience, probably never used.
* The case sa_len == 0 should only apply to empty structures.
*/
#define SA_SIZE(sa) \
( (!(sa) || ((struct sockaddr *)(sa))->sa_len == 0) ? \
( (((struct sockaddr *)(sa))->sa_len == 0) ? \
sizeof(long) : \
1 + ( (((struct sockaddr *)(sa))->sa_len - 1) | (sizeof(long) - 1) ) )

View File

@@ -740,7 +740,7 @@ route_output(struct mbuf *m, struct socket *so, ...)
if (info.rti_info[RTAX_NETMASK] == NULL &&
rtm->rtm_type == RTM_GET) {
/*
* Provide logest prefix match for
* Provide longest prefix match for
* address lookup (no mask).
* 'route -n get addr'
*/

View File

@@ -62,12 +62,10 @@
#define BCOPY(p1, p2, n) bcopy((void *)(p1), (void *)(p2), (int)(n))
void
sl_compress_init(comp, max_state)
struct slcompress *comp;
int max_state;
sl_compress_init(struct slcompress *comp, int max_state)
{
register u_int i;
register struct cstate *tstate = comp->tstate;
u_int i;
struct cstate *tstate = comp->tstate;
if (max_state == -1) {
max_state = MAX_STATES - 1;
@@ -154,20 +152,17 @@ sl_compress_init(comp, max_state)
* if m is an M_PKTHDR mbuf.
*/
u_int
sl_compress_tcp(m, ip, comp, compress_cid)
struct mbuf *m;
register struct ip *ip;
struct slcompress *comp;
int compress_cid;
sl_compress_tcp(struct mbuf *m, struct ip *ip, struct slcompress *comp,
int compress_cid)
{
register struct cstate *cs = comp->last_cs->cs_next;
register u_int hlen = ip->ip_hl;
register struct tcphdr *oth;
register struct tcphdr *th;
register u_int deltaS, deltaA;
register u_int changes = 0;
struct cstate *cs = comp->last_cs->cs_next;
u_int hlen = ip->ip_hl;
struct tcphdr *oth;
struct tcphdr *th;
u_int deltaS, deltaA;
u_int changes = 0;
u_char new_seq[16];
register u_char *cp = new_seq;
u_char *cp = new_seq;
/*
* Bail if this is an IP fragment or if the TCP packet isn't
@@ -204,8 +199,8 @@ sl_compress_tcp(m, ip, comp, compress_cid)
* states via linear search. If we don't find a state
* for the datagram, the oldest state is (re-)used.
*/
register struct cstate *lcs;
register struct cstate *lastcs = comp->last_cs;
struct cstate *lcs;
struct cstate *lastcs = comp->last_cs;
do {
lcs = cs; cs = cs->cs_next;
@@ -414,11 +409,7 @@ uncompressed:
int
sl_uncompress_tcp(bufp, len, type, comp)
u_char **bufp;
int len;
u_int type;
struct slcompress *comp;
sl_uncompress_tcp(u_char **bufp, int len, u_int type, struct slcompress *comp)
{
u_char *hdr, *cp;
int hlen, vjlen;
@@ -462,21 +453,16 @@ sl_uncompress_tcp(bufp, len, type, comp)
* in *hdrp and its length in *hlenp.
*/
int
sl_uncompress_tcp_core(buf, buflen, total_len, type, comp, hdrp, hlenp)
u_char *buf;
int buflen, total_len;
u_int type;
struct slcompress *comp;
u_char **hdrp;
u_int *hlenp;
sl_uncompress_tcp_core(u_char *buf, int buflen, int total_len, u_int type,
struct slcompress *comp, u_char **hdrp, u_int *hlenp)
{
register u_char *cp;
register u_int hlen, changes;
register struct tcphdr *th;
register struct cstate *cs;
register struct ip *ip;
register u_int16_t *bp;
register u_int vjlen;
u_char *cp;
u_int hlen, changes;
struct tcphdr *th;
struct cstate *cs;
struct ip *ip;
u_int16_t *bp;
u_int vjlen;
switch (type) {
@@ -544,7 +530,7 @@ sl_uncompress_tcp_core(buf, buflen, total_len, type, comp, hdrp, hlenp)
switch (changes & SPECIALS_MASK) {
case SPECIAL_I:
{
register u_int i = ntohs(cs->cs_ip.ip_len) - cs->cs_hlen;
u_int i = ntohs(cs->cs_ip.ip_len) - cs->cs_hlen;
th->th_ack = htonl(ntohl(th->th_ack) + i);
th->th_seq = htonl(ntohl(th->th_seq) + i);
}