Page MenuHomeFreeBSD

D19946.diff
No OneTemporary

D19946.diff

Index: head/sys/net/iflib.h
===================================================================
--- head/sys/net/iflib.h
+++ head/sys/net/iflib.h
@@ -228,8 +228,10 @@
pci_vendor_info_t isc_vendor_info; /* set by iflib prior to attach_pre */
int isc_disable_msix;
if_txrx_t isc_txrx;
+ struct ifmedia *isc_media;
} *if_softc_ctx_t;
+
/*
* Initialization values for device
*/
@@ -361,6 +363,10 @@
* Interface needs admin task to ignore interface up/down status
*/
#define IFLIB_ADMIN_ALWAYS_RUN 0x10000
+/*
+ * Driver will pass the media
+ */
+#define IFLIB_DRIVER_MEDIA 0x20000
/*
Index: head/sys/net/iflib.c
===================================================================
--- head/sys/net/iflib.c
+++ head/sys/net/iflib.c
@@ -182,6 +182,7 @@
struct grouptask ifc_vflr_task;
struct iflib_filter_info ifc_filter_info;
struct ifmedia ifc_media;
+ struct ifmedia *ifc_mediap;
struct sysctl_oid *ifc_sysctl_node;
uint16_t ifc_sysctl_ntxqs;
@@ -238,7 +239,7 @@
iflib_get_media(if_ctx_t ctx)
{
- return (&ctx->ifc_media);
+ return (ctx->ifc_mediap);
}
uint32_t
@@ -4184,7 +4185,7 @@
/* falls thru */
case SIOCGIFMEDIA:
case SIOCGIFXMEDIA:
- err = ifmedia_ioctl(ifp, ifr, &ctx->ifc_media, command);
+ err = ifmedia_ioctl(ifp, ifr, ctx->ifc_mediap, command);
break;
case SIOCGI2C:
{
@@ -4583,6 +4584,9 @@
_iflib_pre_assert(scctx);
ctx->ifc_txrx = *scctx->isc_txrx;
+ if (sctx->isc_flags & IFLIB_DRIVER_MEDIA)
+ ctx->ifc_mediap = scctx->isc_media;
+
#ifdef INVARIANTS
if (scctx->isc_capabilities & IFCAP_TXCSUM)
MPASS(scctx->isc_tx_csum_flags);
@@ -4819,9 +4823,9 @@
device_printf(dev, "IFDI_CLONEATTACH failed %d\n", err);
goto fail_ctx_free;
}
- ifmedia_add(&ctx->ifc_media, IFM_ETHER | IFM_1000_T | IFM_FDX, 0, NULL);
- ifmedia_add(&ctx->ifc_media, IFM_ETHER | IFM_AUTO, 0, NULL);
- ifmedia_set(&ctx->ifc_media, IFM_ETHER | IFM_AUTO);
+ ifmedia_add(ctx->ifc_mediap, IFM_ETHER | IFM_1000_T | IFM_FDX, 0, NULL);
+ ifmedia_add(ctx->ifc_mediap, IFM_ETHER | IFM_AUTO, 0, NULL);
+ ifmedia_set(ctx->ifc_mediap, IFM_ETHER | IFM_AUTO);
#ifdef INVARIANTS
if (scctx->isc_capabilities & IFCAP_TXCSUM)
@@ -5348,9 +5352,11 @@
EVENTHANDLER_REGISTER(vlan_unconfig, iflib_vlan_unregister, ctx,
EVENTHANDLER_PRI_FIRST);
- ifmedia_init(&ctx->ifc_media, IFM_IMASK,
- iflib_media_change, iflib_media_status);
-
+ if ((sctx->isc_flags & IFLIB_DRIVER_MEDIA) == 0) {
+ ctx->ifc_mediap = &ctx->ifc_media;
+ ifmedia_init(ctx->ifc_mediap, IFM_IMASK,
+ iflib_media_change, iflib_media_status);
+ }
return (0);
}

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 21, 6:15 AM (21 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14756091
Default Alt Text
D19946.diff (2 KB)

Event Timeline