FreeBSD Bugzilla – Attachment 158065 Details for
Bug 171744
[PATCH] Fix wake(8) command not sending proper WOL packet
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Same patch but for stable/10
bge-stable10.diff (text/plain), 2.71 KB, created by
Cy Schubert
on 2015-06-26 03:14:36 UTC
(
hide
)
Description:
Same patch but for stable/10
Filename:
MIME Type:
Creator:
Cy Schubert
Created:
2015-06-26 03:14:36 UTC
Size:
2.71 KB
patch
obsolete
>Index: sys/dev/bge/if_bge.c >=================================================================== >--- sys/dev/bge/if_bge.c (revision 284539) >+++ sys/dev/bge/if_bge.c (working copy) >@@ -485,6 +485,7 @@ > static void bge_stop_fw(struct bge_softc *); > static int bge_reset(struct bge_softc *); > static void bge_link_upd(struct bge_softc *); >+static void bge_setwol(struct bge_softc *); > > static void bge_ape_lock_init(struct bge_softc *); > static void bge_ape_read_fw_ver(struct bge_softc *); >@@ -3735,7 +3736,7 @@ > IFQ_SET_READY(&ifp->if_snd); > ifp->if_hwassist = sc->bge_csum_features; > ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_VLAN_HWTAGGING | >- IFCAP_VLAN_MTU; >+ IFCAP_VLAN_MTU | IFCAP_WOL_MAGIC; > if ((sc->bge_flags & (BGE_FLAG_TSO | BGE_FLAG_TSO3)) != 0) { > ifp->if_hwassist |= CSUM_TSO; > ifp->if_capabilities |= IFCAP_TSO4 | IFCAP_VLAN_HWTSO; >@@ -3743,6 +3744,8 @@ > #ifdef IFCAP_VLAN_HWCSUM > ifp->if_capabilities |= IFCAP_VLAN_HWCSUM; > #endif >+ if (pci_find_cap(dev, PCIY_PMG, ®) == 0) >+ ifp->if_capabilities |= IFCAP_WOL_MAGIC; > ifp->if_capenable = ifp->if_capabilities; > #ifdef DEVICE_POLLING > ifp->if_capabilities |= IFCAP_POLLING; >@@ -5847,6 +5850,9 @@ > } > } > #endif >+ if ((mask & IFCAP_WOL_MAGIC) != 0 && >+ (ifp->if_capabilities & IFCAP_WOL_MAGIC) != 0) >+ ifp->if_capenable ^= IFCAP_WOL_MAGIC; > if ((mask & IFCAP_TXCSUM) != 0 && > (ifp->if_capabilities & IFCAP_TXCSUM) != 0) { > ifp->if_capenable ^= IFCAP_TXCSUM; >@@ -6073,6 +6079,7 @@ > sc = device_get_softc(dev); > BGE_LOCK(sc); > bge_stop(sc); >+ bge_setwol(sc); > BGE_UNLOCK(sc); > > return (0); >@@ -6086,6 +6093,7 @@ > sc = device_get_softc(dev); > BGE_LOCK(sc); > bge_stop(sc); >+ bge_setwol(sc); > BGE_UNLOCK(sc); > > return (0); >@@ -6771,3 +6779,35 @@ > } > return (*func == NULL ? ENXIO : 0); > } >+ >+static void >+bge_setwol(struct bge_softc *sc) >+{ >+ struct ifnet *ifp; >+ uint16_t pmstat; >+ int pmc; >+ >+ BGE_LOCK_ASSERT(sc); >+ >+ if (pci_find_cap(sc->bge_dev, PCIY_PMG, &pmc) != 0) >+ return; >+ ifp = sc->bge_ifp; >+ if ((ifp->if_capenable & IFCAP_WOL_MAGIC) == 0) >+ return; >+ if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0) { >+ BGE_SETBIT(sc, BGE_MAC_MODE, BGE_MACMODE_MAGIC_PKT_ENB); >+ BGE_CLRBIT(sc, BGE_MAC_MODE, BGE_MACMODE_PORTMODE); >+ BGE_SETBIT(sc, BGE_MAC_MODE, BGE_PORTMODE_GMII); >+ BGE_SETBIT(sc, BGE_RX_MODE, BGE_RXMODE_ENABLE); >+ } >+ else { >+ BGE_CLRBIT(sc, BGE_MAC_MODE, BGE_MACMODE_MAGIC_PKT_ENB); >+ } >+ >+ /* Request PME if WOL is requested. */ >+ pmstat = pci_read_config(sc->bge_dev, pmc + PCIR_POWER_STATUS, 2); >+ pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE); >+ if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0) >+ pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; >+ pci_write_config(sc->bge_dev, pmc + PCIR_POWER_STATUS, pmstat, 2); >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 171744
:
127868
|
158062
|
158065
|
191146