From 3929b790ffa5d9dc6f772c0b8aa93519bfd2d61a Mon Sep 17 00:00:00 2001 From: jmallett Date: Wed, 16 Mar 2011 22:51:34 +0000 Subject: 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) --- sys/mips/cavium/octe/ethernet-common.c | 19 ++----------------- sys/mips/cavium/octe/ethernet-common.h | 2 ++ sys/mips/cavium/octe/ethernet.c | 23 +++++++++++++++++++++++ 3 files changed, 27 insertions(+), 17 deletions(-) (limited to 'sys/mips/cavium/octe') 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); -- cgit v1.1