Verify interface up status using its link state only
if the interface has such capability. The interface capability flag indicates whether such capability exists. This approach is much more backward compatible. Physical device driver changes will be part of another commit. Also updated the ifconfig utility to show the LINKSTATE capability if present. Reviewed by: rwatson, imp, juli MFC after: 3 days
This commit is contained in:
parent
f584dfd113
commit
6b533b5ddb
@ -881,7 +881,7 @@ unsetifdescr(const char *val, int value, int s, const struct afswtch *afp)
|
|||||||
#define IFCAPBITS \
|
#define IFCAPBITS \
|
||||||
"\020\1RXCSUM\2TXCSUM\3NETCONS\4VLAN_MTU\5VLAN_HWTAGGING\6JUMBO_MTU\7POLLING" \
|
"\020\1RXCSUM\2TXCSUM\3NETCONS\4VLAN_MTU\5VLAN_HWTAGGING\6JUMBO_MTU\7POLLING" \
|
||||||
"\10VLAN_HWCSUM\11TSO4\12TSO6\13LRO\14WOL_UCAST\15WOL_MCAST\16WOL_MAGIC" \
|
"\10VLAN_HWCSUM\11TSO4\12TSO6\13LRO\14WOL_UCAST\15WOL_MCAST\16WOL_MAGIC" \
|
||||||
"\21VLAN_HWFILTER\23VLAN_HWTSO"
|
"\21VLAN_HWFILTER\23VLAN_HWTSO\24LINKSTATE"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Print the status of the interface. If an address family was
|
* Print the status of the interface. If an address family was
|
||||||
|
@ -219,6 +219,7 @@ struct if_data {
|
|||||||
#define IFCAP_VLAN_HWFILTER 0x10000 /* interface hw can filter vlan tag */
|
#define IFCAP_VLAN_HWFILTER 0x10000 /* interface hw can filter vlan tag */
|
||||||
#define IFCAP_POLLING_NOCOUNT 0x20000 /* polling ticks cannot be fragmented */
|
#define IFCAP_POLLING_NOCOUNT 0x20000 /* polling ticks cannot be fragmented */
|
||||||
#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_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)
|
||||||
|
@ -443,6 +443,8 @@ tapcreate(struct cdev *dev)
|
|||||||
ifp->if_mtu = ETHERMTU;
|
ifp->if_mtu = ETHERMTU;
|
||||||
ifp->if_flags = (IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST);
|
ifp->if_flags = (IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST);
|
||||||
ifp->if_snd.ifq_maxlen = ifqmaxlen;
|
ifp->if_snd.ifq_maxlen = ifqmaxlen;
|
||||||
|
ifp->if_capabilities |= IFCAP_LINKSTATE;
|
||||||
|
ifp->if_capenable |= IFCAP_LINKSTATE;
|
||||||
|
|
||||||
dev->si_drv1 = tp;
|
dev->si_drv1 = tp;
|
||||||
tp->tap_dev = dev;
|
tp->tap_dev = dev;
|
||||||
|
@ -386,6 +386,8 @@ tuncreate(const char *name, struct cdev *dev)
|
|||||||
ifp->if_snd.ifq_drv_maxlen = 0;
|
ifp->if_snd.ifq_drv_maxlen = 0;
|
||||||
IFQ_SET_READY(&ifp->if_snd);
|
IFQ_SET_READY(&ifp->if_snd);
|
||||||
knlist_init_mtx(&sc->tun_rsel.si_note, NULL);
|
knlist_init_mtx(&sc->tun_rsel.si_note, NULL);
|
||||||
|
ifp->if_capabilities |= IFCAP_LINKSTATE;
|
||||||
|
ifp->if_capenable |= IFCAP_LINKSTATE;
|
||||||
|
|
||||||
if_attach(ifp);
|
if_attach(ifp);
|
||||||
bpfattach(ifp, DLT_NULL, sizeof(u_int32_t));
|
bpfattach(ifp, DLT_NULL, sizeof(u_int32_t));
|
||||||
|
@ -319,8 +319,7 @@ struct rt_addrinfo {
|
|||||||
|
|
||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
|
|
||||||
#define RT_LINK_IS_UP(ifp) (((ifp)->if_flags & \
|
#define RT_LINK_IS_UP(ifp) (!((ifp)->if_capabilities & IFCAP_LINKSTATE) \
|
||||||
(IFF_LOOPBACK | IFF_POINTOPOINT)) \
|
|
||||||
|| (ifp)->if_link_state == LINK_STATE_UP)
|
|| (ifp)->if_link_state == LINK_STATE_UP)
|
||||||
|
|
||||||
#define RT_LOCK_INIT(_rt) \
|
#define RT_LOCK_INIT(_rt) \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user