mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-17 10:26:15 +00:00
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)
This commit is contained in:
parent
b00a71345c
commit
e22b8a5a3b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=219706
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user