Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F160186470
D55419.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D55419.diff
View Options
diff --git a/sys/dev/rge/if_rge.c b/sys/dev/rge/if_rge.c
--- a/sys/dev/rge/if_rge.c
+++ b/sys/dev/rge/if_rge.c
@@ -67,6 +67,9 @@
#include "if_rge_sysctl.h"
#include "if_rge_stats.h"
+#define ETHER_IS_VALID(addr) \
+ (!ETHER_IS_MULTICAST(addr.octet) && !ETHER_IS_ZERO(addr.octet))
+
#define RGE_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP)
static int rge_attach(device_t);
@@ -182,7 +185,7 @@
static int
rge_attach(device_t dev)
{
- uint8_t eaddr[ETHER_ADDR_LEN];
+ struct ether_addr eaddr;
struct rge_softc *sc;
struct rge_queues *q;
uint32_t hwrev, reg;
@@ -196,6 +199,8 @@
mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
MTX_DEF);
+ callout_init_mtx(&sc->sc_timeout, &sc->sc_mtx, 0);
+
/* Enable bus mastering */
pci_enable_busmaster(dev);
@@ -465,9 +470,15 @@
goto fail;
}
- rge_get_macaddr(sc, eaddr);
+ rge_get_macaddr(sc, eaddr.octet);
RGE_UNLOCK(sc);
+ if (!ETHER_IS_VALID(eaddr)) {
+ device_printf(dev,
+ "No MAC address found. Using ether_gen_addr().\n");
+ ether_gen_addr_byname(device_get_nameunit(dev), &eaddr);
+ }
+
if (rge_allocmem(sc))
goto fail;
if (rge_alloc_stats_mem(sc))
@@ -481,7 +492,7 @@
ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO);
sc->sc_media.ifm_media = sc->sc_media.ifm_cur->ifm_media;
- rge_attach_if(sc, eaddr);
+ rge_attach_if(sc, eaddr.octet);
/*
* TODO: technically should be per txq but we only support
@@ -501,8 +512,6 @@
TASK_INIT(&sc->sc_tx_task, 0, rge_tx_task, sc);
- callout_init_mtx(&sc->sc_timeout, &sc->sc_mtx, 0);
-
return (0);
fail:
rge_detach(dev);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jun 23, 12:20 AM (4 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34220805
Default Alt Text
D55419.diff (1 KB)
Attached To
Mode
D55419: rge: fix callout setup/teardown; handle invalid ethernet address
Attached
Detach File
Event Timeline
Log In to Comment