diff options
author | jmallett <jmallett@FreeBSD.org> | 2011-03-16 22:51:34 +0000 |
---|---|---|
committer | jmallett <jmallett@FreeBSD.org> | 2011-03-16 22:51:34 +0000 |
commit | 3929b790ffa5d9dc6f772c0b8aa93519bfd2d61a (patch) | |
tree | 2265742959d9b5fce206372d69b59f42b58143b6 /sys/mips | |
parent | f98b43bbe5e48585724551290991349b7097e273 (diff) | |
download | FreeBSD-src-3929b790ffa5d9dc6f772c0b8aa93519bfd2d61a.zip FreeBSD-src-3929b790ffa5d9dc6f772c0b8aa93519bfd2d61a.tar.gz |
o) Set MAC addresses starting at the MAC base for all management ports, not
just the MR-730.
o) Start MAC addresses for the non-management ports after the management ports.
Submitted by: Bhanu Prakash (with modifications)
Diffstat (limited to 'sys/mips')
-rw-r--r-- | sys/mips/cavium/if_octm.c | 29 | ||||
-rw-r--r-- | sys/mips/cavium/octe/ethernet-common.c | 19 | ||||
-rw-r--r-- | sys/mips/cavium/octe/ethernet-common.h | 2 | ||||
-rw-r--r-- | sys/mips/cavium/octe/ethernet.c | 23 |
4 files changed, 34 insertions, 39 deletions
diff --git a/sys/mips/cavium/if_octm.c b/sys/mips/cavium/if_octm.c index 68969ee..a753d66 100644 --- a/sys/mips/cavium/if_octm.c +++ b/sys/mips/cavium/if_octm.c @@ -175,28 +175,13 @@ octm_attach(device_t dev) return (ENXIO); } - switch (cvmx_sysinfo_get()->board_type) { -#if defined(OCTEON_VENDOR_LANNER) - case CVMX_BOARD_TYPE_CUST_LANNER_MR730: - /* - * The MR-730 uses its first two MACs for the management - * ports. - */ - mac = 0; - memcpy((u_int8_t *)&mac + 2, octeon_bootinfo->mac_addr_base, - 6); - mac += sc->sc_port; - cvmx_mgmt_port_set_mac(sc->sc_port, mac); - break; -#endif - default: - mac = cvmx_mgmt_port_get_mac(sc->sc_port); - if (mac == CVMX_MGMT_PORT_GET_MAC_ERROR) { - device_printf(dev, "unable to read MAC.\n"); - return (ENXIO); - } - break; - } + /* + * Set MAC address for this management port. + */ + mac = 0; + memcpy((u_int8_t *)&mac + 2, octeon_bootinfo->mac_addr_base, 6); + mac += sc->sc_port; + cvmx_mgmt_port_set_mac(sc->sc_port, mac); /* No watermark for input ring. */ mixx_irhwm.u64 = 0; diff --git a/sys/mips/cavium/octe/ethernet-common.c b/sys/mips/cavium/octe/ethernet-common.c index 415c3d4..73103cc 100644 --- a/sys/mips/cavium/octe/ethernet-common.c +++ b/sys/mips/cavium/octe/ethernet-common.c @@ -269,34 +269,19 @@ void cvm_oct_common_poll(struct ifnet *ifp) */ int cvm_oct_common_init(struct ifnet *ifp) { - static int count; char mac[6] = { octeon_bootinfo->mac_addr_base[0], octeon_bootinfo->mac_addr_base[1], octeon_bootinfo->mac_addr_base[2], octeon_bootinfo->mac_addr_base[3], octeon_bootinfo->mac_addr_base[4], - octeon_bootinfo->mac_addr_base[5] + count}; + octeon_bootinfo->mac_addr_base[5] }; cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; - switch (cvmx_sysinfo_get()->board_type) { -#if defined(OCTEON_VENDOR_LANNER) - case CVMX_BOARD_TYPE_CUST_LANNER_MR730: - /* - * The MR-730 uses its first two MACs for the management - * ports. - */ - mac[5] += 2; - break; -#endif - default: - break; - } + mac[5] += cvm_oct_mac_addr_offset++; ifp->if_mtu = ETHERMTU; - count++; - cvm_oct_mdio_setup_device(ifp); cvm_oct_common_set_mac_address(ifp, mac); diff --git a/sys/mips/cavium/octe/ethernet-common.h b/sys/mips/cavium/octe/ethernet-common.h index f9d4dc3..cf23f5b 100644 --- a/sys/mips/cavium/octe/ethernet-common.h +++ b/sys/mips/cavium/octe/ethernet-common.h @@ -51,3 +51,5 @@ int cvm_oct_sgmii_init(struct ifnet *ifp); int cvm_oct_spi_init(struct ifnet *ifp); void cvm_oct_spi_uninit(struct ifnet *ifp); int cvm_oct_xaui_init(struct ifnet *ifp); + +extern unsigned int cvm_oct_mac_addr_offset; diff --git a/sys/mips/cavium/octe/ethernet.c b/sys/mips/cavium/octe/ethernet.c index 3b035fa..50b91fc 100644 --- a/sys/mips/cavium/octe/ethernet.c +++ b/sys/mips/cavium/octe/ethernet.c @@ -103,6 +103,15 @@ static struct taskqueue *cvm_oct_link_taskq; */ static int cvm_oct_num_output_buffers; +/* + * The offset from mac_addr_base that should be used for the next port + * that is configured. By convention, if any mgmt ports exist on the + * chip, they get the first mac addresses. The ports controlled by + * this driver are numbered sequencially following any mgmt addresses + * that may exist. + */ +unsigned int cvm_oct_mac_addr_offset; + /** * Function to update link status. */ @@ -318,6 +327,20 @@ int cvm_oct_init_module(device_t bus) printf("cavium-ethernet: %s\n", OCTEON_SDK_VERSION_STRING); + /* + * MAC addresses for this driver start after the management + * ports. + * + * XXX Would be nice if __cvmx_mgmt_port_num_ports() were + * not static to cvmx-mgmt-port.c. + */ + if (OCTEON_IS_MODEL(OCTEON_CN56XX)) + cvm_oct_mac_addr_offset = 1; + else if (OCTEON_IS_MODEL(OCTEON_CN52XX) || OCTEON_IS_MODEL(OCTEON_CN63XX)) + cvm_oct_mac_addr_offset = 2; + else + cvm_oct_mac_addr_offset = 0; + cvm_oct_rx_initialize(); cvm_oct_configure_common_hw(bus); |