summaryrefslogtreecommitdiff
path: root/sys/arch/octeon
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2017-11-18 05:53:03 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2017-11-18 05:53:03 +0000
commita47b4ac675b4f2b995123be7693bd7c089a6be2e (patch)
treefcc5cdc96007857f4c04fcbd365658deae16cb9e /sys/arch/octeon
parent04f4fd76477f9bee6e88b2aa82a9c46a51f80f39 (diff)
Rename octeon_eth_* to cnmac_* for consistency with the driver's name.
This also makes the code a bit less noisy to read.
Diffstat (limited to 'sys/arch/octeon')
-rw-r--r--sys/arch/octeon/dev/if_cnmac.c441
-rw-r--r--sys/arch/octeon/dev/if_cnmacvar.h8
2 files changed, 220 insertions, 229 deletions
diff --git a/sys/arch/octeon/dev/if_cnmac.c b/sys/arch/octeon/dev/if_cnmac.c
index 352ccadc2f5..3c940c7a122 100644
--- a/sys/arch/octeon/dev/if_cnmac.c
+++ b/sys/arch/octeon/dev/if_cnmac.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_cnmac.c,v 1.67 2017/11/04 11:01:27 visa Exp $ */
+/* $OpenBSD: if_cnmac.c,v 1.68 2017/11/18 05:53:02 visa Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -106,127 +106,128 @@
CTASSERT(MCLBYTES >= OCTEON_POOL_SIZE_PKT + CACHELINESIZE);
-void octeon_eth_buf_init(struct octeon_eth_softc *);
+void cnmac_buf_init(struct cnmac_softc *);
-int octeon_eth_match(struct device *, void *, void *);
-void octeon_eth_attach(struct device *, struct device *, void *);
-void octeon_eth_pip_init(struct octeon_eth_softc *);
-void octeon_eth_ipd_init(struct octeon_eth_softc *);
-void octeon_eth_pko_init(struct octeon_eth_softc *);
-void octeon_eth_smi_init(struct octeon_eth_softc *);
+int cnmac_match(struct device *, void *, void *);
+void cnmac_attach(struct device *, struct device *, void *);
+void cnmac_pip_init(struct cnmac_softc *);
+void cnmac_ipd_init(struct cnmac_softc *);
+void cnmac_pko_init(struct cnmac_softc *);
+void cnmac_smi_init(struct cnmac_softc *);
-void octeon_eth_board_mac_addr(uint8_t *);
+void cnmac_board_mac_addr(uint8_t *);
-int octeon_eth_mii_readreg(struct device *, int, int);
-void octeon_eth_mii_writereg(struct device *, int, int, int);
-void octeon_eth_mii_statchg(struct device *);
+int cnmac_mii_readreg(struct device *, int, int);
+void cnmac_mii_writereg(struct device *, int, int, int);
+void cnmac_mii_statchg(struct device *);
-int octeon_eth_mediainit(struct octeon_eth_softc *);
-void octeon_eth_mediastatus(struct ifnet *, struct ifmediareq *);
-int octeon_eth_mediachange(struct ifnet *);
+int cnmac_mediainit(struct cnmac_softc *);
+void cnmac_mediastatus(struct ifnet *, struct ifmediareq *);
+int cnmac_mediachange(struct ifnet *);
-void octeon_eth_send_queue_flush_prefetch(struct octeon_eth_softc *);
-void octeon_eth_send_queue_flush_fetch(struct octeon_eth_softc *);
-void octeon_eth_send_queue_flush(struct octeon_eth_softc *);
-int octeon_eth_send_queue_is_full(struct octeon_eth_softc *);
-void octeon_eth_send_queue_add(struct octeon_eth_softc *,
+void cnmac_send_queue_flush_prefetch(struct cnmac_softc *);
+void cnmac_send_queue_flush_fetch(struct cnmac_softc *);
+void cnmac_send_queue_flush(struct cnmac_softc *);
+int cnmac_send_queue_is_full(struct cnmac_softc *);
+void cnmac_send_queue_add(struct cnmac_softc *,
struct mbuf *, uint64_t *);
-void octeon_eth_send_queue_del(struct octeon_eth_softc *,
+void cnmac_send_queue_del(struct cnmac_softc *,
struct mbuf **, uint64_t **);
-int octeon_eth_buf_free_work(struct octeon_eth_softc *, uint64_t *);
-void octeon_eth_buf_ext_free(caddr_t, u_int, void *);
-
-int octeon_eth_ioctl(struct ifnet *, u_long, caddr_t);
-void octeon_eth_watchdog(struct ifnet *);
-int octeon_eth_init(struct ifnet *);
-int octeon_eth_stop(struct ifnet *, int);
-void octeon_eth_start(struct ifqueue *);
-
-int octeon_eth_send_cmd(struct octeon_eth_softc *, uint64_t, uint64_t);
-uint64_t octeon_eth_send_makecmd_w1(int, paddr_t);
-uint64_t octeon_eth_send_makecmd_w0(uint64_t, uint64_t, size_t, int, int);
-int octeon_eth_send_makecmd_gbuf(struct octeon_eth_softc *,
+int cnmac_buf_free_work(struct cnmac_softc *, uint64_t *);
+void cnmac_buf_ext_free(caddr_t, u_int, void *);
+
+int cnmac_ioctl(struct ifnet *, u_long, caddr_t);
+void cnmac_watchdog(struct ifnet *);
+int cnmac_init(struct ifnet *);
+int cnmac_stop(struct ifnet *, int);
+void cnmac_start(struct ifqueue *);
+
+int cnmac_send_cmd(struct cnmac_softc *, uint64_t, uint64_t);
+uint64_t cnmac_send_makecmd_w1(int, paddr_t);
+uint64_t cnmac_send_makecmd_w0(uint64_t, uint64_t, size_t, int, int);
+int cnmac_send_makecmd_gbuf(struct cnmac_softc *,
struct mbuf *, uint64_t *, int *);
-int octeon_eth_send_makecmd(struct octeon_eth_softc *,
+int cnmac_send_makecmd(struct cnmac_softc *,
struct mbuf *, uint64_t *, uint64_t *, uint64_t *);
-int octeon_eth_send_buf(struct octeon_eth_softc *,
+int cnmac_send_buf(struct cnmac_softc *,
struct mbuf *, uint64_t *);
-int octeon_eth_send(struct octeon_eth_softc *, struct mbuf *);
+int cnmac_send(struct cnmac_softc *, struct mbuf *);
-int octeon_eth_reset(struct octeon_eth_softc *);
-int octeon_eth_configure(struct octeon_eth_softc *);
-int octeon_eth_configure_common(struct octeon_eth_softc *);
+int cnmac_reset(struct cnmac_softc *);
+int cnmac_configure(struct cnmac_softc *);
+int cnmac_configure_common(struct cnmac_softc *);
-void octeon_eth_free_task(void *);
-void octeon_eth_tick_free(void *arg);
-void octeon_eth_tick_misc(void *);
+void cnmac_free_task(void *);
+void cnmac_tick_free(void *arg);
+void cnmac_tick_misc(void *);
-int octeon_eth_recv_mbuf(struct octeon_eth_softc *,
+int cnmac_recv_mbuf(struct cnmac_softc *,
uint64_t *, struct mbuf **, int *);
-int octeon_eth_recv_check(struct octeon_eth_softc *, uint64_t);
-int octeon_eth_recv(struct octeon_eth_softc *, uint64_t *);
-void octeon_eth_recv_intr(void *, uint64_t *);
+int cnmac_recv_check(struct cnmac_softc *, uint64_t);
+int cnmac_recv(struct cnmac_softc *, uint64_t *);
+void cnmac_recv_intr(void *, uint64_t *);
-int octeon_eth_mbuf_alloc(int);
+int cnmac_mbuf_alloc(int);
/* device driver context */
-struct octeon_eth_softc *octeon_eth_gsc[GMX_PORT_NUNITS];
+struct cnmac_softc *cnmac_gsc[GMX_PORT_NUNITS];
/* device parameters */
-int octeon_eth_param_pko_cmd_w0_n2 = 1;
+int cnmac_param_pko_cmd_w0_n2 = 1;
-const struct cfattach cnmac_ca =
- { sizeof(struct octeon_eth_softc), octeon_eth_match, octeon_eth_attach };
+const struct cfattach cnmac_ca = {
+ sizeof(struct cnmac_softc), cnmac_match, cnmac_attach
+};
struct cfdriver cnmac_cd = { NULL, "cnmac", DV_IFNET };
/* ---- buffer management */
-const struct octeon_eth_pool_param {
+const struct cnmac_pool_param {
int poolno;
size_t size;
size_t nelems;
-} octeon_eth_pool_params[] = {
+} cnmac_pool_params[] = {
#define _ENTRY(x) { OCTEON_POOL_NO_##x, OCTEON_POOL_SIZE_##x, OCTEON_POOL_NELEMS_##x }
_ENTRY(WQE),
_ENTRY(CMD),
_ENTRY(SG)
#undef _ENTRY
};
-struct cn30xxfpa_buf *octeon_eth_pools[8/* XXX */];
-#define octeon_eth_fb_wqe octeon_eth_pools[OCTEON_POOL_NO_WQE]
-#define octeon_eth_fb_cmd octeon_eth_pools[OCTEON_POOL_NO_CMD]
-#define octeon_eth_fb_sg octeon_eth_pools[OCTEON_POOL_NO_SG]
+struct cn30xxfpa_buf *cnmac_pools[8];
+#define cnmac_fb_wqe cnmac_pools[OCTEON_POOL_NO_WQE]
+#define cnmac_fb_cmd cnmac_pools[OCTEON_POOL_NO_CMD]
+#define cnmac_fb_sg cnmac_pools[OCTEON_POOL_NO_SG]
-uint64_t octeon_eth_mac_addr = 0;
-uint32_t octeon_eth_mac_addr_offset = 0;
+uint64_t cnmac_mac_addr = 0;
+uint32_t cnmac_mac_addr_offset = 0;
-int octeon_eth_mbufs_to_alloc;
-int octeon_eth_npowgroups = 0;
+int cnmac_mbufs_to_alloc;
+int cnmac_npowgroups = 0;
void
-octeon_eth_buf_init(struct octeon_eth_softc *sc)
+cnmac_buf_init(struct cnmac_softc *sc)
{
static int once;
int i;
- const struct octeon_eth_pool_param *pp;
+ const struct cnmac_pool_param *pp;
struct cn30xxfpa_buf *fb;
if (once == 1)
return;
once = 1;
- for (i = 0; i < (int)nitems(octeon_eth_pool_params); i++) {
- pp = &octeon_eth_pool_params[i];
+ for (i = 0; i < (int)nitems(cnmac_pool_params); i++) {
+ pp = &cnmac_pool_params[i];
cn30xxfpa_buf_init(pp->poolno, pp->size, pp->nelems, &fb);
- octeon_eth_pools[pp->poolno] = fb;
+ cnmac_pools[pp->poolno] = fb;
}
}
/* ---- autoconf */
int
-octeon_eth_match(struct device *parent, void *match, void *aux)
+cnmac_match(struct device *parent, void *match, void *aux)
{
struct cfdata *cf = (struct cfdata *)match;
struct cn30xxgmx_attach_args *ga = aux;
@@ -238,20 +239,20 @@ octeon_eth_match(struct device *parent, void *match, void *aux)
}
void
-octeon_eth_attach(struct device *parent, struct device *self, void *aux)
+cnmac_attach(struct device *parent, struct device *self, void *aux)
{
- struct octeon_eth_softc *sc = (void *)self;
+ struct cnmac_softc *sc = (void *)self;
struct cn30xxgmx_attach_args *ga = aux;
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
uint8_t enaddr[ETHER_ADDR_LEN];
- if (octeon_eth_npowgroups >= OCTEON_POW_GROUP_MAX) {
+ if (cnmac_npowgroups >= OCTEON_POW_GROUP_MAX) {
printf(": out of POW groups\n");
return;
}
- atomic_add_int(&octeon_eth_mbufs_to_alloc,
- octeon_eth_mbuf_alloc(OCTEON_ETH_MBUFS_PER_PORT));
+ atomic_add_int(&cnmac_mbufs_to_alloc,
+ cnmac_mbuf_alloc(CNMAC_MBUFS_PER_PORT));
sc->sc_regt = ga->ga_regt;
sc->sc_dmat = ga->ga_dmat;
@@ -261,7 +262,7 @@ octeon_eth_attach(struct device *parent, struct device *self, void *aux)
sc->sc_gmx_port = ga->ga_gmx_port;
sc->sc_smi = ga->ga_smi;
sc->sc_phy_addr = ga->ga_phy_addr;
- sc->sc_powgroup = octeon_eth_npowgroups++;
+ sc->sc_powgroup = cnmac_npowgroups++;
sc->sc_init_flag = 0;
@@ -271,10 +272,10 @@ octeon_eth_attach(struct device *parent, struct device *self, void *aux)
*/
sc->sc_ip_offset = 0/* XXX */;
- octeon_eth_board_mac_addr(enaddr);
+ cnmac_board_mac_addr(enaddr);
printf(", address %s\n", ether_sprintf(enaddr));
- octeon_eth_gsc[sc->sc_port] = sc;
+ cnmac_gsc[sc->sc_port] = sc;
ml_init(&sc->sc_sendq);
sc->sc_soft_req_thresh = 15/* XXX */;
@@ -282,18 +283,18 @@ octeon_eth_attach(struct device *parent, struct device *self, void *aux)
cn30xxgmx_stats_init(sc->sc_gmx_port);
- task_set(&sc->sc_free_task, octeon_eth_free_task, sc);
- timeout_set(&sc->sc_tick_misc_ch, octeon_eth_tick_misc, sc);
- timeout_set(&sc->sc_tick_free_ch, octeon_eth_tick_free, sc);
+ task_set(&sc->sc_free_task, cnmac_free_task, sc);
+ timeout_set(&sc->sc_tick_misc_ch, cnmac_tick_misc, sc);
+ timeout_set(&sc->sc_tick_free_ch, cnmac_tick_free, sc);
cn30xxfau_op_init(&sc->sc_fau_done,
OCTEON_CVMSEG_ETHER_OFFSET(sc->sc_dev.dv_unit, csm_ether_fau_done),
OCT_FAU_REG_ADDR_END - (8 * (sc->sc_dev.dv_unit + 1))/* XXX */);
cn30xxfau_op_set_8(&sc->sc_fau_done, 0);
- octeon_eth_pip_init(sc);
- octeon_eth_ipd_init(sc);
- octeon_eth_pko_init(sc);
+ cnmac_pip_init(sc);
+ cnmac_ipd_init(sc);
+ cnmac_pko_init(sc);
sc->sc_gmx_port->sc_ipd = sc->sc_ipd;
sc->sc_gmx_port->sc_port_mii = &sc->sc_mii;
@@ -302,16 +303,16 @@ octeon_eth_attach(struct device *parent, struct device *self, void *aux)
/* XXX */
sc->sc_pow = &cn30xxpow_softc;
- octeon_eth_mediainit(sc);
+ cnmac_mediainit(sc);
strncpy(ifp->if_xname, sc->sc_dev.dv_xname, sizeof(ifp->if_xname));
ifp->if_softc = sc;
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_xflags = IFXF_MPSAFE;
- ifp->if_ioctl = octeon_eth_ioctl;
- ifp->if_qstart = octeon_eth_start;
- ifp->if_watchdog = octeon_eth_watchdog;
- ifp->if_hardmtu = OCTEON_ETH_MAX_MTU;
+ ifp->if_ioctl = cnmac_ioctl;
+ ifp->if_qstart = cnmac_start;
+ ifp->if_watchdog = cnmac_watchdog;
+ ifp->if_hardmtu = CNMAC_MAX_MTU;
IFQ_SET_MAXLEN(&ifp->if_snd, max(GATHER_QUEUE_SIZE, IFQ_MAXLEN));
ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_CSUM_TCPv4 |
@@ -325,22 +326,19 @@ octeon_eth_attach(struct device *parent, struct device *self, void *aux)
memcpy(sc->sc_arpcom.ac_enaddr, enaddr, ETHER_ADDR_LEN);
ether_ifattach(ifp);
-#if 1
- octeon_eth_buf_init(sc);
-#endif
+ cnmac_buf_init(sc);
sc->sc_ih = cn30xxpow_intr_establish(
sc->sc_powgroup, IPL_NET | IPL_MPSAFE,
- octeon_eth_recv_intr, NULL, NULL, sc->sc_dev.dv_xname);
+ cnmac_recv_intr, NULL, NULL, sc->sc_dev.dv_xname);
if (sc->sc_ih == NULL)
panic("%s: could not set up interrupt", sc->sc_dev.dv_xname);
}
/* ---- submodules */
-/* XXX */
void
-octeon_eth_pip_init(struct octeon_eth_softc *sc)
+cnmac_pip_init(struct cnmac_softc *sc)
{
struct cn30xxpip_attach_args pip_aa;
@@ -352,9 +350,8 @@ octeon_eth_pip_init(struct octeon_eth_softc *sc)
cn30xxpip_init(&pip_aa, &sc->sc_pip);
}
-/* XXX */
void
-octeon_eth_ipd_init(struct octeon_eth_softc *sc)
+cnmac_ipd_init(struct cnmac_softc *sc)
{
struct cn30xxipd_attach_args ipd_aa;
@@ -365,9 +362,8 @@ octeon_eth_ipd_init(struct octeon_eth_softc *sc)
cn30xxipd_init(&ipd_aa, &sc->sc_ipd);
}
-/* XXX */
void
-octeon_eth_pko_init(struct octeon_eth_softc *sc)
+cnmac_pko_init(struct cnmac_softc *sc)
{
struct cn30xxpko_attach_args pko_aa;
@@ -382,20 +378,20 @@ octeon_eth_pko_init(struct octeon_eth_softc *sc)
/* ---- XXX */
void
-octeon_eth_board_mac_addr(uint8_t *enaddr)
+cnmac_board_mac_addr(uint8_t *enaddr)
{
int id;
/* Initialize MAC addresses from the global address base. */
- if (octeon_eth_mac_addr == 0) {
- memcpy((uint8_t *)&octeon_eth_mac_addr + 2,
+ if (cnmac_mac_addr == 0) {
+ memcpy((uint8_t *)&cnmac_mac_addr + 2,
octeon_boot_info->mac_addr_base, 6);
/*
* Should be allowed to fail hard if couldn't read the
* mac_addr_base address...
*/
- if (octeon_eth_mac_addr == 0)
+ if (cnmac_mac_addr == 0)
return;
/*
@@ -406,59 +402,59 @@ octeon_eth_board_mac_addr(uint8_t *enaddr)
switch (octeon_model_family(id)) {
case OCTEON_MODEL_FAMILY_CN56XX:
- octeon_eth_mac_addr_offset = 1;
+ cnmac_mac_addr_offset = 1;
break;
/*
case OCTEON_MODEL_FAMILY_CN52XX:
case OCTEON_MODEL_FAMILY_CN63XX:
- octeon_eth_mac_addr_offset = 2;
+ cnmac_mac_addr_offset = 2;
break;
*/
default:
- octeon_eth_mac_addr_offset = 0;
+ cnmac_mac_addr_offset = 0;
break;
}
- enaddr += octeon_eth_mac_addr_offset;
+ enaddr += cnmac_mac_addr_offset;
}
/* No more MAC addresses to assign. */
- if (octeon_eth_mac_addr_offset >= octeon_boot_info->mac_addr_count)
+ if (cnmac_mac_addr_offset >= octeon_boot_info->mac_addr_count)
return;
if (enaddr)
- memcpy(enaddr, (uint8_t *)&octeon_eth_mac_addr + 2, 6);
+ memcpy(enaddr, (uint8_t *)&cnmac_mac_addr + 2, 6);
- octeon_eth_mac_addr++;
- octeon_eth_mac_addr_offset++;
+ cnmac_mac_addr++;
+ cnmac_mac_addr_offset++;
}
/* ---- media */
int
-octeon_eth_mii_readreg(struct device *self, int phy_no, int reg)
+cnmac_mii_readreg(struct device *self, int phy_no, int reg)
{
- struct octeon_eth_softc *sc = (struct octeon_eth_softc *)self;
+ struct cnmac_softc *sc = (struct cnmac_softc *)self;
return cn30xxsmi_read(sc->sc_smi, phy_no, reg);
}
void
-octeon_eth_mii_writereg(struct device *self, int phy_no, int reg, int value)
+cnmac_mii_writereg(struct device *self, int phy_no, int reg, int value)
{
- struct octeon_eth_softc *sc = (struct octeon_eth_softc *)self;
+ struct cnmac_softc *sc = (struct cnmac_softc *)self;
cn30xxsmi_write(sc->sc_smi, phy_no, reg, value);
}
void
-octeon_eth_mii_statchg(struct device *self)
+cnmac_mii_statchg(struct device *self)
{
- struct octeon_eth_softc *sc = (struct octeon_eth_softc *)self;
+ struct cnmac_softc *sc = (struct cnmac_softc *)self;
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
cn30xxpko_port_enable(sc->sc_pko, 0);
cn30xxgmx_port_enable(sc->sc_gmx_port, 0);
- octeon_eth_reset(sc);
+ cnmac_reset(sc);
if (ISSET(ifp->if_flags, IFF_RUNNING))
cn30xxgmx_set_filter(sc->sc_gmx_port);
@@ -468,17 +464,17 @@ octeon_eth_mii_statchg(struct device *self)
}
int
-octeon_eth_mediainit(struct octeon_eth_softc *sc)
+cnmac_mediainit(struct cnmac_softc *sc)
{
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
struct mii_softc *child;
sc->sc_mii.mii_ifp = ifp;
- sc->sc_mii.mii_readreg = octeon_eth_mii_readreg;
- sc->sc_mii.mii_writereg = octeon_eth_mii_writereg;
- sc->sc_mii.mii_statchg = octeon_eth_mii_statchg;
- ifmedia_init(&sc->sc_mii.mii_media, 0, octeon_eth_mediachange,
- octeon_eth_mediastatus);
+ sc->sc_mii.mii_readreg = cnmac_mii_readreg;
+ sc->sc_mii.mii_writereg = cnmac_mii_writereg;
+ sc->sc_mii.mii_statchg = cnmac_mii_statchg;
+ ifmedia_init(&sc->sc_mii.mii_media, 0, cnmac_mediachange,
+ cnmac_mediastatus);
mii_attach(&sc->sc_dev, &sc->sc_mii,
0xffffffff, sc->sc_phy_addr, MII_OFFSET_ANY, MIIF_DOPAUSE);
@@ -497,9 +493,9 @@ octeon_eth_mediainit(struct octeon_eth_softc *sc)
}
void
-octeon_eth_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
+cnmac_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
{
- struct octeon_eth_softc *sc = ifp->if_softc;
+ struct cnmac_softc *sc = ifp->if_softc;
mii_pollstat(&sc->sc_mii);
ifmr->ifm_status = sc->sc_mii.mii_media_status;
@@ -509,9 +505,9 @@ octeon_eth_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
}
int
-octeon_eth_mediachange(struct ifnet *ifp)
+cnmac_mediachange(struct ifnet *ifp)
{
- struct octeon_eth_softc *sc = ifp->if_softc;
+ struct cnmac_softc *sc = ifp->if_softc;
if ((ifp->if_flags & IFF_UP) == 0)
return 0;
@@ -522,7 +518,7 @@ octeon_eth_mediachange(struct ifnet *ifp)
/* ---- send buffer garbage collection */
void
-octeon_eth_send_queue_flush_prefetch(struct octeon_eth_softc *sc)
+cnmac_send_queue_flush_prefetch(struct cnmac_softc *sc)
{
OCTEON_ETH_KASSERT(sc->sc_prefetch == 0);
cn30xxfau_op_inc_fetch_8(&sc->sc_fau_done, 0);
@@ -530,7 +526,7 @@ octeon_eth_send_queue_flush_prefetch(struct octeon_eth_softc *sc)
}
void
-octeon_eth_send_queue_flush_fetch(struct octeon_eth_softc *sc)
+cnmac_send_queue_flush_fetch(struct cnmac_softc *sc)
{
#ifndef OCTEON_ETH_DEBUG
if (!sc->sc_prefetch)
@@ -543,7 +539,7 @@ octeon_eth_send_queue_flush_fetch(struct octeon_eth_softc *sc)
}
void
-octeon_eth_send_queue_flush(struct octeon_eth_softc *sc)
+cnmac_send_queue_flush(struct cnmac_softc *sc)
{
const int64_t sent_count = sc->sc_hard_done_cnt;
int i;
@@ -554,9 +550,9 @@ octeon_eth_send_queue_flush(struct octeon_eth_softc *sc)
struct mbuf *m;
uint64_t *gbuf;
- octeon_eth_send_queue_del(sc, &m, &gbuf);
+ cnmac_send_queue_del(sc, &m, &gbuf);
- cn30xxfpa_buf_put_paddr(octeon_eth_fb_sg, XKPHYS_TO_PHYS(gbuf));
+ cn30xxfpa_buf_put_paddr(cnmac_fb_sg, XKPHYS_TO_PHYS(gbuf));
m_freem(m);
}
@@ -565,7 +561,7 @@ octeon_eth_send_queue_flush(struct octeon_eth_softc *sc)
}
int
-octeon_eth_send_queue_is_full(struct octeon_eth_softc *sc)
+cnmac_send_queue_is_full(struct cnmac_softc *sc)
{
#ifdef OCTEON_ETH_SEND_QUEUE_CHECK
int64_t nofree_cnt;
@@ -573,7 +569,7 @@ octeon_eth_send_queue_is_full(struct octeon_eth_softc *sc)
nofree_cnt = ml_len(&sc->sc_sendq) + sc->sc_hard_done_cnt;
if (__predict_false(nofree_cnt == GATHER_QUEUE_SIZE - 1)) {
- octeon_eth_send_queue_flush(sc);
+ cnmac_send_queue_flush(sc);
return 1;
}
@@ -582,7 +578,7 @@ octeon_eth_send_queue_is_full(struct octeon_eth_softc *sc)
}
void
-octeon_eth_send_queue_add(struct octeon_eth_softc *sc, struct mbuf *m,
+cnmac_send_queue_add(struct cnmac_softc *sc, struct mbuf *m,
uint64_t *gbuf)
{
OCTEON_ETH_KASSERT(m->m_flags & M_PKTHDR);
@@ -595,7 +591,7 @@ octeon_eth_send_queue_add(struct octeon_eth_softc *sc, struct mbuf *m,
}
void
-octeon_eth_send_queue_del(struct octeon_eth_softc *sc, struct mbuf **rm,
+cnmac_send_queue_del(struct cnmac_softc *sc, struct mbuf **rm,
uint64_t **rgbuf)
{
struct mbuf *m;
@@ -612,7 +608,7 @@ octeon_eth_send_queue_del(struct octeon_eth_softc *sc, struct mbuf **rm,
}
int
-octeon_eth_buf_free_work(struct octeon_eth_softc *sc, uint64_t *work)
+cnmac_buf_free_work(struct cnmac_softc *sc, uint64_t *work)
{
paddr_t addr, pktbuf;
uint64_t word3;
@@ -635,7 +631,7 @@ octeon_eth_buf_free_work(struct octeon_eth_softc *sc, uint64_t *work)
sizeof(word3), CCA_CACHED), sizeof(word3));
}
- cn30xxfpa_buf_put_paddr(octeon_eth_fb_wqe, XKPHYS_TO_PHYS(work));
+ cn30xxfpa_buf_put_paddr(cnmac_fb_wqe, XKPHYS_TO_PHYS(work));
return 0;
}
@@ -643,9 +639,9 @@ octeon_eth_buf_free_work(struct octeon_eth_softc *sc, uint64_t *work)
/* ---- ifnet interfaces */
int
-octeon_eth_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
+cnmac_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
{
- struct octeon_eth_softc *sc = ifp->if_softc;
+ struct cnmac_softc *sc = ifp->if_softc;
struct ifreq *ifr = (struct ifreq *)data;
int s, error = 0;
@@ -655,7 +651,7 @@ octeon_eth_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
case SIOCSIFADDR:
ifp->if_flags |= IFF_UP;
if (!(ifp->if_flags & IFF_RUNNING))
- octeon_eth_init(ifp);
+ cnmac_init(ifp);
break;
case SIOCSIFFLAGS:
@@ -663,10 +659,10 @@ octeon_eth_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
if (ifp->if_flags & IFF_RUNNING)
error = ENETRESET;
else
- octeon_eth_init(ifp);
+ cnmac_init(ifp);
} else {
if (ifp->if_flags & IFF_RUNNING)
- octeon_eth_stop(ifp, 0);
+ cnmac_stop(ifp, 0);
}
break;
@@ -706,7 +702,7 @@ octeon_eth_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
/* ---- send (output) */
uint64_t
-octeon_eth_send_makecmd_w0(uint64_t fau0, uint64_t fau1, size_t len, int segs,
+cnmac_send_makecmd_w0(uint64_t fau0, uint64_t fau1, size_t len, int segs,
int ipoffp1)
{
return cn30xxpko_cmd_word0(
@@ -714,7 +710,7 @@ octeon_eth_send_makecmd_w0(uint64_t fau0, uint64_t fau1, size_t len, int segs,
OCT_FAU_OP_SIZE_64, /* sz0 */
1, fau1, 1, fau0, /* s1, reg1, s0, reg0 */
0, /* le */
- octeon_eth_param_pko_cmd_w0_n2, /* n2 */
+ cnmac_param_pko_cmd_w0_n2, /* n2 */
1, 0, /* q, r */
(segs == 1) ? 0 : 1, /* g */
ipoffp1, 0, 1, /* ipoffp1, ii, df */
@@ -722,7 +718,7 @@ octeon_eth_send_makecmd_w0(uint64_t fau0, uint64_t fau1, size_t len, int segs,
}
uint64_t
-octeon_eth_send_makecmd_w1(int size, paddr_t addr)
+cnmac_send_makecmd_w1(int size, paddr_t addr)
{
return cn30xxpko_cmd_word1(
0, 0, /* i, back */
@@ -730,11 +726,11 @@ octeon_eth_send_makecmd_w1(int size, paddr_t addr)
size, addr); /* size, addr */
}
-#define KVTOPHYS(addr) if_cnmac_kvtophys((vaddr_t)(addr))
-paddr_t if_cnmac_kvtophys(vaddr_t);
+#define KVTOPHYS(addr) cnmac_kvtophys((vaddr_t)(addr))
+paddr_t cnmac_kvtophys(vaddr_t);
paddr_t
-if_cnmac_kvtophys(vaddr_t kva)
+cnmac_kvtophys(vaddr_t kva)
{
if (IS_XKPHYS(kva))
return XKPHYS_TO_PHYS(kva);
@@ -747,7 +743,7 @@ if_cnmac_kvtophys(vaddr_t kva)
}
int
-octeon_eth_send_makecmd_gbuf(struct octeon_eth_softc *sc, struct mbuf *m0,
+cnmac_send_makecmd_gbuf(struct cnmac_softc *sc, struct mbuf *m0,
uint64_t *gbuf, int *rsegs)
{
struct mbuf *m;
@@ -759,7 +755,7 @@ octeon_eth_send_makecmd_gbuf(struct octeon_eth_softc *sc, struct mbuf *m0,
if (segs >= OCTEON_POOL_SIZE_SG / sizeof(uint64_t))
goto defrag;
- gbuf[segs] = octeon_eth_send_makecmd_w1(m->m_len,
+ gbuf[segs] = cnmac_send_makecmd_w1(m->m_len,
KVTOPHYS(m->m_data));
segs++;
}
@@ -771,13 +767,13 @@ octeon_eth_send_makecmd_gbuf(struct octeon_eth_softc *sc, struct mbuf *m0,
defrag:
if (m_defrag(m0, M_DONTWAIT) != 0)
return 1;
- gbuf[0] = octeon_eth_send_makecmd_w1(m0->m_len, KVTOPHYS(m0->m_data));
+ gbuf[0] = cnmac_send_makecmd_w1(m0->m_len, KVTOPHYS(m0->m_data));
*rsegs = 1;
return 0;
}
int
-octeon_eth_send_makecmd(struct octeon_eth_softc *sc, struct mbuf *m,
+cnmac_send_makecmd(struct cnmac_softc *sc, struct mbuf *m,
uint64_t *gbuf, uint64_t *rpko_cmd_w0, uint64_t *rpko_cmd_w1)
{
uint64_t pko_cmd_w0, pko_cmd_w1;
@@ -785,7 +781,7 @@ octeon_eth_send_makecmd(struct octeon_eth_softc *sc, struct mbuf *m,
int segs;
int result = 0;
- if (octeon_eth_send_makecmd_gbuf(sc, m, gbuf, &segs)) {
+ if (cnmac_send_makecmd_gbuf(sc, m, gbuf, &segs)) {
log(LOG_WARNING, "%s: large number of transmission"
" data segments", sc->sc_dev.dv_xname);
result = 1;
@@ -803,9 +799,9 @@ octeon_eth_send_makecmd(struct octeon_eth_softc *sc, struct mbuf *m,
* segs > 1 -> gather mode (scatter-gather buffer)
* WORD1[size] is number of segments
*/
- pko_cmd_w0 = octeon_eth_send_makecmd_w0(sc->sc_fau_done.fd_regno,
+ pko_cmd_w0 = cnmac_send_makecmd_w0(sc->sc_fau_done.fd_regno,
0, m->m_pkthdr.len, segs, ipoffp1);
- pko_cmd_w1 = octeon_eth_send_makecmd_w1(
+ pko_cmd_w1 = cnmac_send_makecmd_w1(
(segs == 1) ? m->m_pkthdr.len : segs,
(segs == 1) ?
KVTOPHYS(m->m_data) :
@@ -819,7 +815,7 @@ done:
}
int
-octeon_eth_send_cmd(struct octeon_eth_softc *sc, uint64_t pko_cmd_w0,
+cnmac_send_cmd(struct cnmac_softc *sc, uint64_t pko_cmd_w0,
uint64_t pko_cmd_w1)
{
uint64_t *cmdptr;
@@ -838,7 +834,7 @@ octeon_eth_send_cmd(struct octeon_eth_softc *sc, uint64_t pko_cmd_w0,
if (sc->sc_cmdptr.cmdptr_idx + 2 == FPA_COMMAND_BUFFER_POOL_NWORDS - 1) {
paddr_t buf;
- buf = cn30xxfpa_buf_get_paddr(octeon_eth_fb_cmd);
+ buf = cn30xxfpa_buf_get_paddr(cnmac_fb_cmd);
if (buf == 0) {
log(LOG_WARNING,
"%s: cannot allocate command buffer from free pool allocator\n",
@@ -860,20 +856,19 @@ done:
}
int
-octeon_eth_send_buf(struct octeon_eth_softc *sc, struct mbuf *m,
- uint64_t *gbuf)
+cnmac_send_buf(struct cnmac_softc *sc, struct mbuf *m, uint64_t *gbuf)
{
int result = 0, error;
uint64_t pko_cmd_w0, pko_cmd_w1;
- error = octeon_eth_send_makecmd(sc, m, gbuf, &pko_cmd_w0, &pko_cmd_w1);
+ error = cnmac_send_makecmd(sc, m, gbuf, &pko_cmd_w0, &pko_cmd_w1);
if (error != 0) {
/* already logging */
result = error;
goto done;
}
- error = octeon_eth_send_cmd(sc, pko_cmd_w0, pko_cmd_w1);
+ error = cnmac_send_cmd(sc, pko_cmd_w0, pko_cmd_w1);
if (error != 0) {
/* already logging */
result = error;
@@ -884,13 +879,13 @@ done:
}
int
-octeon_eth_send(struct octeon_eth_softc *sc, struct mbuf *m)
+cnmac_send(struct cnmac_softc *sc, struct mbuf *m)
{
paddr_t gaddr = 0;
uint64_t *gbuf = NULL;
int result = 0, error;
- gaddr = cn30xxfpa_buf_get_paddr(octeon_eth_fb_sg);
+ gaddr = cn30xxfpa_buf_get_paddr(cnmac_fb_sg);
if (gaddr == 0) {
log(LOG_WARNING,
"%s: cannot allocate gather buffer from free pool allocator\n",
@@ -901,25 +896,25 @@ octeon_eth_send(struct octeon_eth_softc *sc, struct mbuf *m)
gbuf = (uint64_t *)(uintptr_t)PHYS_TO_XKPHYS(gaddr, CCA_CACHED);
- error = octeon_eth_send_buf(sc, m, gbuf);
+ error = cnmac_send_buf(sc, m, gbuf);
if (error != 0) {
/* already logging */
- cn30xxfpa_buf_put_paddr(octeon_eth_fb_sg, gaddr);
+ cn30xxfpa_buf_put_paddr(cnmac_fb_sg, gaddr);
result = error;
goto done;
}
- octeon_eth_send_queue_add(sc, m, gbuf);
+ cnmac_send_queue_add(sc, m, gbuf);
done:
return result;
}
void
-octeon_eth_start(struct ifqueue *ifq)
+cnmac_start(struct ifqueue *ifq)
{
struct ifnet *ifp = ifq->ifq_if;
- struct octeon_eth_softc *sc = ifp->if_softc;
+ struct cnmac_softc *sc = ifp->if_softc;
struct mbuf *m;
if (__predict_false(!cn30xxgmx_link_status(sc->sc_gmx_port))) {
@@ -931,17 +926,17 @@ octeon_eth_start(struct ifqueue *ifq)
* performance tuning
* presend iobdma request
*/
- octeon_eth_send_queue_flush_prefetch(sc);
+ cnmac_send_queue_flush_prefetch(sc);
for (;;) {
- octeon_eth_send_queue_flush_fetch(sc); /* XXX */
+ cnmac_send_queue_flush_fetch(sc); /* XXX */
/*
* XXXSEIL
* If no free send buffer is available, free all the sent buffer
* and bail out.
*/
- if (octeon_eth_send_queue_is_full(sc)) {
+ if (cnmac_send_queue_is_full(sc)) {
ifq_set_oactive(ifq);
timeout_add(&sc->sc_tick_free_ch, 1);
return;
@@ -958,8 +953,8 @@ octeon_eth_start(struct ifqueue *ifq)
/* XXX */
if (ml_len(&sc->sc_sendq) > sc->sc_soft_req_thresh)
- octeon_eth_send_queue_flush(sc);
- if (octeon_eth_send(sc, m)) {
+ cnmac_send_queue_flush(sc);
+ if (cnmac_send(sc, m)) {
ifp->if_oerrors++;
m_freem(m);
log(LOG_WARNING,
@@ -971,22 +966,22 @@ octeon_eth_start(struct ifqueue *ifq)
/*
* send next iobdma request
*/
- octeon_eth_send_queue_flush_prefetch(sc);
+ cnmac_send_queue_flush_prefetch(sc);
}
- octeon_eth_send_queue_flush_fetch(sc);
+ cnmac_send_queue_flush_fetch(sc);
}
void
-octeon_eth_watchdog(struct ifnet *ifp)
+cnmac_watchdog(struct ifnet *ifp)
{
- struct octeon_eth_softc *sc = ifp->if_softc;
+ struct cnmac_softc *sc = ifp->if_softc;
printf("%s: device timeout\n", sc->sc_dev.dv_xname);
- octeon_eth_stop(ifp, 0);
+ cnmac_stop(ifp, 0);
- octeon_eth_configure(sc);
+ cnmac_configure(sc);
SET(ifp->if_flags, IFF_RUNNING);
ifp->if_timer = 0;
@@ -995,17 +990,17 @@ octeon_eth_watchdog(struct ifnet *ifp)
}
int
-octeon_eth_init(struct ifnet *ifp)
+cnmac_init(struct ifnet *ifp)
{
- struct octeon_eth_softc *sc = ifp->if_softc;
+ struct cnmac_softc *sc = ifp->if_softc;
/* XXX don't disable commonly used parts!!! XXX */
if (sc->sc_init_flag == 0) {
/* Cancel any pending I/O. */
- octeon_eth_stop(ifp, 0);
+ cnmac_stop(ifp, 0);
/* Initialize the device */
- octeon_eth_configure(sc);
+ cnmac_configure(sc);
cn30xxpko_enable(sc->sc_pko);
cn30xxipd_enable(sc->sc_ipd);
@@ -1014,7 +1009,7 @@ octeon_eth_init(struct ifnet *ifp)
} else {
cn30xxgmx_port_enable(sc->sc_gmx_port, 1);
}
- octeon_eth_mediachange(ifp);
+ cnmac_mediachange(ifp);
cn30xxgmx_set_mac_addr(sc->sc_gmx_port, sc->sc_arpcom.ac_enaddr);
cn30xxgmx_set_filter(sc->sc_gmx_port);
@@ -1029,9 +1024,9 @@ octeon_eth_init(struct ifnet *ifp)
}
int
-octeon_eth_stop(struct ifnet *ifp, int disable)
+cnmac_stop(struct ifnet *ifp, int disable)
{
- struct octeon_eth_softc *sc = ifp->if_softc;
+ struct cnmac_softc *sc = ifp->if_softc;
CLR(ifp->if_flags, IFF_RUNNING);
@@ -1056,7 +1051,7 @@ octeon_eth_stop(struct ifnet *ifp, int disable)
#define PKO_INDEX_MASK ((1ULL << 12/* XXX */) - 1)
int
-octeon_eth_reset(struct octeon_eth_softc *sc)
+cnmac_reset(struct cnmac_softc *sc)
{
cn30xxgmx_reset_speed(sc->sc_gmx_port);
cn30xxgmx_reset_flowctl(sc->sc_gmx_port);
@@ -1067,13 +1062,13 @@ octeon_eth_reset(struct octeon_eth_softc *sc)
}
int
-octeon_eth_configure(struct octeon_eth_softc *sc)
+cnmac_configure(struct cnmac_softc *sc)
{
cn30xxgmx_port_enable(sc->sc_gmx_port, 0);
- octeon_eth_reset(sc);
+ cnmac_reset(sc);
- octeon_eth_configure_common(sc);
+ cnmac_configure_common(sc);
cn30xxpko_port_config(sc->sc_pko);
cn30xxpko_port_enable(sc->sc_pko, 1);
@@ -1089,7 +1084,7 @@ octeon_eth_configure(struct octeon_eth_softc *sc)
}
int
-octeon_eth_configure_common(struct octeon_eth_softc *sc)
+cnmac_configure_common(struct cnmac_softc *sc)
{
static int once;
@@ -1099,10 +1094,6 @@ octeon_eth_configure_common(struct octeon_eth_softc *sc)
return 0;
once = 1;
-#if 0
- octeon_eth_buf_init(sc);
-#endif
-
cn30xxipd_config(sc->sc_ipd);
cn30xxpko_config(sc->sc_pko);
@@ -1116,7 +1107,7 @@ octeon_eth_configure_common(struct octeon_eth_softc *sc)
}
int
-octeon_eth_mbuf_alloc(int n)
+cnmac_mbuf_alloc(int n)
{
struct mbuf *m;
paddr_t pktbuf;
@@ -1144,7 +1135,7 @@ octeon_eth_mbuf_alloc(int n)
}
int
-octeon_eth_recv_mbuf(struct octeon_eth_softc *sc, uint64_t *work,
+cnmac_recv_mbuf(struct cnmac_softc *sc, uint64_t *work,
struct mbuf **rm, int *nmbuf)
{
struct mbuf *m, *m0, *mprev, **pm;
@@ -1155,7 +1146,7 @@ octeon_eth_recv_mbuf(struct octeon_eth_softc *sc, uint64_t *work,
unsigned int back, i, nbufs;
unsigned int left, total, size;
- cn30xxfpa_buf_put_paddr(octeon_eth_fb_wqe, XKPHYS_TO_PHYS(work));
+ cn30xxfpa_buf_put_paddr(cnmac_fb_wqe, XKPHYS_TO_PHYS(work));
nbufs = (word2 & PIP_WQE_WORD2_IP_BUFS) >> PIP_WQE_WORD2_IP_BUFS_SHIFT;
if (nbufs == 0)
@@ -1212,7 +1203,7 @@ octeon_eth_recv_mbuf(struct octeon_eth_softc *sc, uint64_t *work,
}
int
-octeon_eth_recv_check(struct octeon_eth_softc *sc, uint64_t word2)
+cnmac_recv_check(struct cnmac_softc *sc, uint64_t word2)
{
static struct timeval rxerr_log_interval = { 0, 250000 };
uint64_t opecode;
@@ -1234,7 +1225,7 @@ octeon_eth_recv_check(struct octeon_eth_softc *sc, uint64_t word2)
}
int
-octeon_eth_recv(struct octeon_eth_softc *sc, uint64_t *work)
+cnmac_recv(struct cnmac_softc *sc, uint64_t *work)
{
struct ifnet *ifp;
struct mbuf_list ml = MBUF_LIST_INITIALIZER();
@@ -1253,12 +1244,12 @@ octeon_eth_recv(struct octeon_eth_softc *sc, uint64_t *work)
if (!(ifp->if_flags & IFF_RUNNING))
goto drop;
- if (__predict_false(octeon_eth_recv_check(sc, word2) != 0)) {
+ if (__predict_false(cnmac_recv_check(sc, word2) != 0)) {
ifp->if_ierrors++;
goto drop;
}
- if (__predict_false(octeon_eth_recv_mbuf(sc, work, &m, &nmbuf) != 0)) {
+ if (__predict_false(cnmac_recv_mbuf(sc, work, &m, &nmbuf) != 0)) {
ifp->if_ierrors++;
goto drop;
}
@@ -1272,21 +1263,21 @@ octeon_eth_recv(struct octeon_eth_softc *sc, uint64_t *work)
ml_enqueue(&ml, m);
if_input(ifp, &ml);
- nmbuf = octeon_eth_mbuf_alloc(nmbuf);
+ nmbuf = cnmac_mbuf_alloc(nmbuf);
if (nmbuf != 0)
- atomic_add_int(&octeon_eth_mbufs_to_alloc, nmbuf);
+ atomic_add_int(&cnmac_mbufs_to_alloc, nmbuf);
return 0;
drop:
- octeon_eth_buf_free_work(sc, work);
+ cnmac_buf_free_work(sc, work);
return 1;
}
void
-octeon_eth_recv_intr(void *data, uint64_t *work)
+cnmac_recv_intr(void *data, uint64_t *work)
{
- struct octeon_eth_softc *sc;
+ struct cnmac_softc *sc;
int port;
OCTEON_ETH_KASSERT(work != NULL);
@@ -1295,36 +1286,36 @@ octeon_eth_recv_intr(void *data, uint64_t *work)
OCTEON_ETH_KASSERT(port < GMX_PORT_NUNITS);
- sc = octeon_eth_gsc[port];
+ sc = cnmac_gsc[port];
OCTEON_ETH_KASSERT(sc != NULL);
OCTEON_ETH_KASSERT(port == sc->sc_port);
/* XXX process all work queue entries anyway */
- (void)octeon_eth_recv(sc, work);
+ (void)cnmac_recv(sc, work);
}
/* ---- tick */
void
-octeon_eth_free_task(void *arg)
+cnmac_free_task(void *arg)
{
- struct octeon_eth_softc *sc = arg;
+ struct cnmac_softc *sc = arg;
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
struct ifqueue *ifq = &ifp->if_snd;
int resched = 1;
int timeout;
if (ml_len(&sc->sc_sendq) > 0) {
- octeon_eth_send_queue_flush_prefetch(sc);
- octeon_eth_send_queue_flush_fetch(sc);
- octeon_eth_send_queue_flush(sc);
+ cnmac_send_queue_flush_prefetch(sc);
+ cnmac_send_queue_flush_fetch(sc);
+ cnmac_send_queue_flush(sc);
}
if (ifq_is_oactive(ifq)) {
ifq_clr_oactive(ifq);
- octeon_eth_start(ifq);
+ cnmac_start(ifq);
if (ifq_is_oactive(ifq)) {
/* The start routine did rescheduling already. */
@@ -1339,39 +1330,39 @@ octeon_eth_free_task(void *arg)
}
/*
- * octeon_eth_tick_free
+ * cnmac_tick_free
*
* => garbage collect send gather buffer / mbuf
* => called at softclock
*/
void
-octeon_eth_tick_free(void *arg)
+cnmac_tick_free(void *arg)
{
- struct octeon_eth_softc *sc = arg;
+ struct cnmac_softc *sc = arg;
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
int to_alloc;
ifq_serialize(&ifp->if_snd, &sc->sc_free_task);
- if (octeon_eth_mbufs_to_alloc != 0) {
- to_alloc = atomic_swap_uint(&octeon_eth_mbufs_to_alloc, 0);
- to_alloc = octeon_eth_mbuf_alloc(to_alloc);
+ if (cnmac_mbufs_to_alloc != 0) {
+ to_alloc = atomic_swap_uint(&cnmac_mbufs_to_alloc, 0);
+ to_alloc = cnmac_mbuf_alloc(to_alloc);
if (to_alloc != 0)
- atomic_add_int(&octeon_eth_mbufs_to_alloc, to_alloc);
+ atomic_add_int(&cnmac_mbufs_to_alloc, to_alloc);
}
}
/*
- * octeon_eth_tick_misc
+ * cnmac_tick_misc
*
* => collect statistics
* => check link status
* => called at softclock
*/
void
-octeon_eth_tick_misc(void *arg)
+cnmac_tick_misc(void *arg)
{
- struct octeon_eth_softc *sc = arg;
+ struct cnmac_softc *sc = arg;
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
int s;
diff --git a/sys/arch/octeon/dev/if_cnmacvar.h b/sys/arch/octeon/dev/if_cnmacvar.h
index 4d287b6e942..c161fa08491 100644
--- a/sys/arch/octeon/dev/if_cnmacvar.h
+++ b/sys/arch/octeon/dev/if_cnmacvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_cnmacvar.h,v 1.17 2017/11/02 17:29:16 visa Exp $ */
+/* $OpenBSD: if_cnmacvar.h,v 1.18 2017/11/18 05:53:02 visa Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -34,10 +34,10 @@
#define FREE_QUEUE_SIZE GATHER_QUEUE_SIZE
#define RECV_QUEUE_SIZE (GATHER_QUEUE_SIZE * 2)
-#define OCTEON_ETH_MAX_MTU 12288
+#define CNMAC_MAX_MTU 12288
/* Number of mbufs per port to keep in the packet pool */
-#define OCTEON_ETH_MBUFS_PER_PORT 256
+#define CNMAC_MBUFS_PER_PORT 256
struct _send_queue_entry;
struct cn30xxpow_softc;
@@ -51,7 +51,7 @@ struct cn30xxpow_softc;
extern struct cn30xxpow_softc cn30xxpow_softc;
-struct octeon_eth_softc {
+struct cnmac_softc {
struct device sc_dev;
bus_space_tag_t sc_regt;
bus_dma_tag_t sc_dmat;