From owner-svn-src-user@FreeBSD.ORG Thu Apr 22 02:54:51 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C35D5106566B; Thu, 22 Apr 2010 02:54:51 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B13E48FC1B; Thu, 22 Apr 2010 02:54:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M2sp3J047130; Thu, 22 Apr 2010 02:54:51 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M2spwW047118; Thu, 22 Apr 2010 02:54:51 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201004220254.o3M2spwW047118@svn.freebsd.org> From: Juli Mallett Date: Thu, 22 Apr 2010 02:54:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207051 - user/jmallett/octeon/sys/mips/cavium/octe X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2010 02:54:51 -0000 Author: jmallett Date: Thu Apr 22 02:54:51 2010 New Revision: 207051 URL: http://svn.freebsd.org/changeset/base/207051 Log: Do some trivial substitutions and comment out a few pieces of optional code sufficient to get a few files to compile. Modified: user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.h user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mem.c user/jmallett/octeon/sys/mips/cavium/octe/ethernet-proc.c user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rgmii.c user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.h user/jmallett/octeon/sys/mips/cavium/octe/ethernet-sgmii.c user/jmallett/octeon/sys/mips/cavium/octe/ethernet-spi.c user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.h user/jmallett/octeon/sys/mips/cavium/octe/ethernet-util.h user/jmallett/octeon/sys/mips/cavium/octe/ethernet-xaui.c user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c user/jmallett/octeon/sys/mips/cavium/octe/wrapper-cvmx-includes.h Modified: user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h Thu Apr 22 02:53:49 2010 (r207050) +++ user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h Thu Apr 22 02:54:51 2010 (r207051) @@ -49,18 +49,18 @@ typedef enum { callback didn't exist */ CVM_OCT_DROP, /**< The ethernet driver will drop the packet, cleaning of the work queue entry and the - skbuff */ + mbuf */ CVM_OCT_TAKE_OWNERSHIP_WORK,/**< The intercept callback takes over ownership of the work queue entry. It is the responsibility of the callback to free the work queue entry and all associated packet buffers. The ethernet driver will - dispose of the skbuff without affecting the + dispose of the mbuf without affecting the work queue entry */ CVM_OCT_TAKE_OWNERSHIP_SKB /**< The intercept callback takes over - ownership of the skbuff. The work queue + ownership of the mbuf. The work queue entry and packet buffer will be disposed of - in a way keeping the skbuff valid */ + in a way keeping the mbuf valid */ } cvm_oct_callback_result_t; @@ -74,26 +74,35 @@ typedef enum { * The second parameter is the raw work queue entry from the * hardware. * Th third parameter is the packet converted into a Linux - * skbuff. + * mbuf. */ -typedef cvm_oct_callback_result_t (*cvm_oct_callback_t)(struct net_device *dev, void *work_queue_entry, struct sk_buff *skb); +typedef cvm_oct_callback_result_t (*cvm_oct_callback_t)(struct ifnet *ifp, void *work_queue_entry, struct mbuf *m); /** * This is the definition of the Ethernet driver's private - * driver state stored in netdev_priv(dev). + * driver state stored in ifp->if_softc. */ typedef struct { int port; /* PKO hardware output port */ int queue; /* PKO hardware queue for the port */ int fau; /* Hardware fetch and add to count outstanding tx buffers */ int imode; /* Type of port. This is one of the enums in cvmx_helper_interface_mode_t */ - struct sk_buff_head tx_free_list[16];/* List of outstanding tx buffers per queue */ + struct mbuf *tx_free_list[16];/* List of outstanding tx buffers per queue */ /* Keeping intercept_cb close the the part of stats that is most often modified helps throughput. */ cvm_oct_callback_t intercept_cb; /* Optional intecept callback defined above */ - struct net_device_stats stats; /* Device statistics */ +#if 0 + struct ifnet_stats stats; /* Device statistics */ struct mii_if_info mii_info; /* Generic MII info structure */ +#endif uint64_t link_info; /* Last negotiated link state */ - void (*poll)(struct net_device *dev); /* Called periodically to check link status */ + void (*poll)(struct ifnet *ifp); /* Called periodically to check link status */ + + /* + * XXX/juli + * I think we'll need to wrap these with the normal ifnet glue. + */ + int (*open)(struct ifnet *ifp); + int (*stop)(struct ifnet *ifp); } cvm_oct_private_t; @@ -111,7 +120,7 @@ typedef struct { * @param callback Intercept callback to set. * @return Device structure for the ethernet port or NULL on failure. */ -struct net_device *cvm_oct_register_callback(const char *device_name, cvm_oct_callback_t callback); +struct ifnet *cvm_oct_register_callback(const char *device_name, cvm_oct_callback_t callback); /** @@ -142,7 +151,7 @@ int cvm_oct_free_work(void *work_queue_e * * @return Zero on success, negative on failure. */ -int cvm_oct_transmit_qos(struct net_device *dev, void *work_queue_entry, int do_free, int qos); +int cvm_oct_transmit_qos(struct ifnet *ifp, void *work_queue_entry, int do_free, int qos); /** @@ -159,9 +168,9 @@ int cvm_oct_transmit_qos(struct net_devi * * @return Zero on success, negative on failure. */ -static inline int cvm_oct_transmit(struct net_device *dev, void *work_queue_entry, int do_free) +static inline int cvm_oct_transmit(struct ifnet *ifp, void *work_queue_entry, int do_free) { - return cvm_oct_transmit_qos(dev, work_queue_entry, do_free, 0); + return cvm_oct_transmit_qos(ifp, work_queue_entry, do_free, 0); } #endif Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c Thu Apr 22 02:53:49 2010 (r207050) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c Thu Apr 22 02:54:51 2010 (r207051) @@ -26,9 +26,17 @@ TO THE MAXIMUM EXTENT PERMITTED BY LAW, AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU. *************************************************************************/ -#include -#include -#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include #include "wrapper-cvmx-includes.h" #include "ethernet-headers.h" @@ -46,11 +54,12 @@ extern char pow_send_list[]; * @param dev Device to get the statistics from * @return Pointer to the statistics */ -static struct net_device_stats *cvm_oct_common_get_stats(struct net_device *dev) +#if 0 +static struct ifnet_stats *cvm_oct_common_get_stats(struct ifnet *ifp) { cvmx_pip_port_status_t rx_status; cvmx_pko_port_status_t tx_status; - cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev); + cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; if (priv->port < CVMX_PIP_NUM_INPUT_PORTS) { if (octeon_is_simulation()) { @@ -81,6 +90,7 @@ static struct net_device_stats *cvm_oct_ return &priv->stats; } +#endif /** @@ -88,10 +98,11 @@ static struct net_device_stats *cvm_oct_ * * @param dev Device to work on */ -static void cvm_oct_common_set_multicast_list(struct net_device *dev) +static void cvm_oct_common_set_multicast_list(struct ifnet *ifp) { +#if 0 cvmx_gmxx_prtx_cfg_t gmx_cfg; - cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev); + cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; int interface = INTERFACE(priv->port); int index = INDEX(priv->port); @@ -100,13 +111,13 @@ static void cvm_oct_common_set_multicast control.u64 = 0; control.s.bcst = 1; /* Allow broadcast MAC addresses */ - if (dev->mc_list || (dev->flags&IFF_ALLMULTI) || - (dev->flags & IFF_PROMISC)) + if (ifp->mc_list || (ifp->flags&IFF_ALLMULTI) || + (ifp->flags & IFF_PROMISC)) control.s.mcst = 2; /* Force accept multicast packets */ else control.s.mcst = 1; /* Force reject multicat packets */ - if (dev->flags & IFF_PROMISC) + if (ifp->flags & IFF_PROMISC) control.s.cam_mode = 0; /* Reject matches if promisc. Since CAM is shut off, should accept everything */ else control.s.cam_mode = 1; /* Filter packets based on the CAM */ @@ -115,13 +126,14 @@ static void cvm_oct_common_set_multicast cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64 & ~1ull); cvmx_write_csr(CVMX_GMXX_RXX_ADR_CTL(index, interface), control.u64); - if (dev->flags&IFF_PROMISC) + if (ifp->flags&IFF_PROMISC) cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM_EN(index, interface), 0); else cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM_EN(index, interface), 1); cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64); } +#endif } @@ -132,15 +144,13 @@ static void cvm_oct_common_set_multicast * @param addr Address structure to change it too. MAC address is addr + 2. * @return Zero on success */ -static int cvm_oct_common_set_mac_address(struct net_device *dev, void *addr) +static int cvm_oct_common_set_mac_address(struct ifnet *ifp, void *addr) { - cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev); + cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; cvmx_gmxx_prtx_cfg_t gmx_cfg; int interface = INTERFACE(priv->port); int index = INDEX(priv->port); - memcpy(dev->dev_addr, addr + 2, 6); - if ((interface < 2) && (cvmx_helper_interface_get_mode(interface) != CVMX_HELPER_INTERFACE_MODE_SPI)) { int i; uint8_t *ptr = addr; @@ -158,7 +168,7 @@ static int cvm_oct_common_set_mac_addres cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM3(index, interface), ptr[5]); cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM4(index, interface), ptr[6]); cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM5(index, interface), ptr[7]); - cvm_oct_common_set_multicast_list(dev); + cvm_oct_common_set_multicast_list(ifp); cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64); } return 0; @@ -172,9 +182,9 @@ static int cvm_oct_common_set_mac_addres * @param new_mtu The new MTU * @return Zero on success */ -static int cvm_oct_common_change_mtu(struct net_device *dev, int new_mtu) +static int cvm_oct_common_change_mtu(struct ifnet *ifp, int new_mtu) { - cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev); + cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; int interface = INTERFACE(priv->port); int index = INDEX(priv->port); #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) @@ -186,10 +196,10 @@ static int cvm_oct_common_change_mtu(str /* Limit the MTU to make sure the ethernet packets are between 64 bytes and 65535 bytes */ if ((new_mtu + 14 + 4 + vlan_bytes < 64) || (new_mtu + 14 + 4 + vlan_bytes > 65392)) { - printk("MTU must be between %d and %d.\n", 64-14-4-vlan_bytes, 65392-14-4-vlan_bytes); + printf("MTU must be between %d and %d.\n", 64-14-4-vlan_bytes, 65392-14-4-vlan_bytes); return -EINVAL; } - dev->mtu = new_mtu; + ifp->if_mtu = new_mtu; if ((interface < 2) && (cvmx_helper_interface_get_mode(interface) != CVMX_HELPER_INTERFACE_MODE_SPI)) { int max_packet = new_mtu + 14 + 4 + vlan_bytes; /* Add ethernet header and FCS, and VLAN if configured. */ @@ -220,7 +230,7 @@ static int cvm_oct_common_change_mtu(str * @param dev Device to initialize * @return Zero on success */ -int cvm_oct_common_init(struct net_device *dev) +int cvm_oct_common_init(struct ifnet *ifp) { static int count; char mac[8] = {0x00, 0x00, @@ -230,45 +240,56 @@ int cvm_oct_common_init(struct net_devic octeon_bootinfo->mac_addr_base[3], octeon_bootinfo->mac_addr_base[4], octeon_bootinfo->mac_addr_base[5] + count}; - cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev); + cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; /* Force the interface to use the POW send if always_use_pow was specified or it is in the pow send list */ - if ((pow_send_group != -1) && (always_use_pow || strstr(pow_send_list, dev->name))) + if ((pow_send_group != -1) && (always_use_pow || strstr(pow_send_list, if_name(ifp)))) priv->queue = -1; + ifp->if_mtu = ETHERMTU; + +#if 0 if (priv->queue != -1) { - dev->hard_start_xmit = cvm_oct_xmit; + ifp->hard_start_xmit = cvm_oct_xmit; if (USE_HW_TCPUDP_CHECKSUM) - dev->features |= NETIF_F_IP_CSUM; + ifp->features |= NETIF_F_IP_CSUM; } else - dev->hard_start_xmit = cvm_oct_xmit_pow; + ifp->hard_start_xmit = cvm_oct_xmit_pow; +#endif count++; - dev->get_stats = cvm_oct_common_get_stats; - dev->set_mac_address = cvm_oct_common_set_mac_address; - dev->set_multicast_list = cvm_oct_common_set_multicast_list; - dev->change_mtu = cvm_oct_common_change_mtu; - dev->do_ioctl = cvm_oct_ioctl; - dev->features |= NETIF_F_LLTX; /* We do our own locking, Linux doesn't need to */ - SET_ETHTOOL_OPS(dev, &cvm_oct_ethtool_ops); +#if 0 + ifp->get_stats = cvm_oct_common_get_stats; + ifp->set_mac_address = cvm_oct_common_set_mac_address; + ifp->set_multicast_list = cvm_oct_common_set_multicast_list; + ifp->change_mtu = cvm_oct_common_change_mtu; + ifp->do_ioctl = cvm_oct_ioctl; + ifp->features |= NETIF_F_LLTX; /* We do our own locking, Linux doesn't need to */ + SET_ETHTOOL_OPS(ifp, &cvm_oct_ethtool_ops); #ifdef CONFIG_NET_POLL_CONTROLLER - dev->poll_controller = cvm_oct_poll_controller; + ifp->poll_controller = cvm_oct_poll_controller; +#endif #endif - cvm_oct_mdio_setup_device(dev); - dev->set_mac_address(dev, mac); - dev->change_mtu(dev, dev->mtu); + cvm_oct_mdio_setup_device(ifp); + + cvm_oct_common_set_mac_address(ifp, mac); + cvm_oct_common_change_mtu(ifp, ifp->if_mtu); +#if 0 /* Zero out stats for port so we won't mistakenly show counters from the bootloader */ - memset(dev->get_stats(dev), 0, sizeof(struct net_device_stats)); + memset(ifp->get_stats(ifp), 0, sizeof(struct ifnet_stats)); +#endif + + ether_ifattach(ifp, mac); return 0; } -void cvm_oct_common_uninit(struct net_device *dev) +void cvm_oct_common_uninit(struct ifnet *ifp) { /* Currently nothing to do */ } Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h Thu Apr 22 02:53:49 2010 (r207050) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h Thu Apr 22 02:54:51 2010 (r207051) @@ -27,6 +27,18 @@ AND WITH ALL FAULTS AND CAVIUM NETWORKS *************************************************************************/ -int cvm_oct_common_init(struct net_device *dev); -void cvm_oct_common_uninit(struct net_device *dev); +int cvm_oct_common_init(struct ifnet *ifp); +void cvm_oct_common_uninit(struct ifnet *ifp); +/* + * XXX/juli + * These belong elsewhere but we can't stomach the nested extern. + */ +int cvm_oct_rgmii_init(struct ifnet *ifp); +void cvm_oct_rgmii_uninit(struct ifnet *ifp); +int cvm_oct_sgmii_init(struct ifnet *ifp); +void cvm_oct_sgmii_uninit(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); +void cvm_oct_xaui_uninit(struct ifnet *ifp); Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h Thu Apr 22 02:53:49 2010 (r207050) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h Thu Apr 22 02:54:51 2010 (r207051) @@ -39,8 +39,8 @@ AND WITH ALL FAULTS AND CAVIUM NETWORKS * This kernel config option allows the user to control the number of * packet and work queue buffers allocated by the driver. If this is zero, * the driver uses the default from below. - * USE_SKBUFFS_IN_HW - * Tells the driver to populate the packet buffers with kernel skbuffs. + * USE_MBUFS_IN_HW + * Tells the driver to populate the packet buffers with kernel mbufs. * This allows the driver to receive packets without copying them. It also * means that 32bit userspace can't access the packet buffers. * USE_32BIT_SHARED @@ -58,8 +58,8 @@ AND WITH ALL FAULTS AND CAVIUM NETWORKS * Use asynchronous IO access to hardware. This uses Octeon's asynchronous * IOBDMAs to issue IO accesses without stalling. Set this to zero * to disable this. Note that IOBDMAs require CVMSEG. - * REUSE_SKBUFFS_WITHOUT_FREE - * Allows the TX path to free an skbuff into the FPA hardware pool. This + * REUSE_MBUFS_WITHOUT_FREE + * Allows the TX path to free an mbuf into the FPA hardware pool. This * can significantly improve performance for forwarding and bridging, but * may be somewhat dangerous. Checks are made, but if any buffer is reused * without the proper Linux cleanup, the networking stack may have very @@ -71,15 +71,15 @@ AND WITH ALL FAULTS AND CAVIUM NETWORKS #if CONFIG_CAVIUM_RESERVE32 #define USE_32BIT_SHARED 1 - #define USE_SKBUFFS_IN_HW 0 - #define REUSE_SKBUFFS_WITHOUT_FREE 0 + #define USE_MBUFS_IN_HW 0 + #define REUSE_MBUFS_WITHOUT_FREE 0 #else #define USE_32BIT_SHARED 0 - #define USE_SKBUFFS_IN_HW 1 + #define USE_MBUFS_IN_HW 1 #ifdef CONFIG_NETFILTER - #define REUSE_SKBUFFS_WITHOUT_FREE 0 + #define REUSE_MBUFS_WITHOUT_FREE 0 #else - #define REUSE_SKBUFFS_WITHOUT_FREE 1 + #define REUSE_MBUFS_WITHOUT_FREE 1 #endif #endif Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c Thu Apr 22 02:53:49 2010 (r207050) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c Thu Apr 22 02:54:51 2010 (r207051) @@ -26,10 +26,18 @@ TO THE MAXIMUM EXTENT PERMITTED BY LAW, AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU. *************************************************************************/ -#include -#include -#include -#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include #include "cvmx-sysinfo.h" #include "wrapper-cvmx-includes.h" @@ -46,7 +54,7 @@ DECLARE_MUTEX(mdio_sem); * @param location Register location to read * @return Result from the read or zero on failure */ -static int cvm_oct_mdio_read(struct net_device *dev, int phy_id, int location) +static int cvm_oct_mdio_read(struct ifnet *ifp, int phy_id, int location) { cvmx_smi_cmd_t smi_cmd; cvmx_smi_rd_dat_t smi_rd; @@ -69,7 +77,7 @@ static int cvm_oct_mdio_read(struct net_ return 0; } -static int cvm_oct_mdio_dummy_read(struct net_device *dev, int phy_id, int location) +static int cvm_oct_mdio_dummy_read(struct ifnet *ifp, int phy_id, int location) { return 0xffff; } @@ -83,7 +91,7 @@ static int cvm_oct_mdio_dummy_read(struc * @param location Register location to write * @param val Value to write */ -static void cvm_oct_mdio_write(struct net_device *dev, int phy_id, int location, int val) +static void cvm_oct_mdio_write(struct ifnet *ifp, int phy_id, int location, int val) { cvmx_smi_cmd_t smi_cmd; cvmx_smi_wr_dat_t smi_wr; @@ -105,12 +113,12 @@ static void cvm_oct_mdio_write(struct ne } while (smi_wr.s.pending); } -static void cvm_oct_mdio_dummy_write(struct net_device *dev, int phy_id, int location, int val) +static void cvm_oct_mdio_dummy_write(struct ifnet *ifp, int phy_id, int location, int val) { } -static void cvm_oct_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) +static void cvm_oct_get_drvinfo(struct ifnet *ifp, struct ethtool_drvinfo *info) { strcpy(info->driver, "cavium-ethernet"); strcpy(info->version, OCTEON_SDK_VERSION_STRING); @@ -118,9 +126,9 @@ static void cvm_oct_get_drvinfo(struct n } -static int cvm_oct_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) +static int cvm_oct_get_settings(struct ifnet *ifp, struct ethtool_cmd *cmd) { - cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev); + cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; int ret; down(&mdio_sem); @@ -131,9 +139,9 @@ static int cvm_oct_get_settings(struct n } -static int cvm_oct_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) +static int cvm_oct_set_settings(struct ifnet *ifp, struct ethtool_cmd *cmd) { - cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev); + cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; int ret; down(&mdio_sem); @@ -144,9 +152,9 @@ static int cvm_oct_set_settings(struct n } -static int cvm_oct_nway_reset(struct net_device *dev) +static int cvm_oct_nway_reset(struct ifnet *ifp) { - cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev); + cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; int ret; down(&mdio_sem); @@ -157,9 +165,9 @@ static int cvm_oct_nway_reset(struct net } -static u32 cvm_oct_get_link(struct net_device *dev) +static u32 cvm_oct_get_link(struct ifnet *ifp) { - cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev); + cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; u32 ret; down(&mdio_sem); @@ -189,9 +197,9 @@ struct ethtool_ops cvm_oct_ethtool_ops = * @param cmd the command * @return Zero on success */ -int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) +int cvm_oct_ioctl(struct ifnet *ifp, struct ifreq *rq, int cmd) { - cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev); + cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; struct mii_ioctl_data *data = if_mii(rq); unsigned int duplex_chg; int ret; @@ -211,9 +219,9 @@ int cvm_oct_ioctl(struct net_device *dev * * @return Zero on success, negative on failure */ -int cvm_oct_mdio_setup_device(struct net_device *dev) +int cvm_oct_mdio_setup_device(struct ifnet *ifp) { - cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev); + cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; int phy_id = cvmx_helper_board_get_mii_address(priv->port); if (phy_id != -1) { priv->mii_info.dev = dev; Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.h ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.h Thu Apr 22 02:53:49 2010 (r207050) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.h Thu Apr 22 02:54:51 2010 (r207051) @@ -26,6 +26,7 @@ TO THE MAXIMUM EXTENT PERMITTED BY LAW, AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU. *************************************************************************/ +#if 0 #include #include #include @@ -42,8 +43,9 @@ AND WITH ALL FAULTS AND CAVIUM NETWORKS #include #include #endif /* CONFIG_XFRM */ +#endif extern struct ethtool_ops cvm_oct_ethtool_ops; -int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); -int cvm_oct_mdio_setup_device(struct net_device *dev); +int cvm_oct_ioctl(struct ifnet *ifp, struct ifreq *rq, int cmd); +int cvm_oct_mdio_setup_device(struct ifnet *ifp); Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mem.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mem.c Thu Apr 22 02:53:49 2010 (r207050) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mem.c Thu Apr 22 02:54:51 2010 (r207051) @@ -35,26 +35,26 @@ AND WITH ALL FAULTS AND CAVIUM NETWORKS #include "ethernet-headers.h" /** - * Fill the supplied hardware pool with skbuffs + * Fill the supplied hardware pool with mbufs * - * @param pool Pool to allocate an skbuff for + * @param pool Pool to allocate an mbuf for * @param size Size of the buffer needed for the pool * @param elements Number of buffers to allocate */ -static int cvm_oct_fill_hw_skbuff(int pool, int size, int elements) +static int cvm_oct_fill_hw_mbuf(int pool, int size, int elements) { int freed = elements; while (freed) { - struct sk_buff *skb = dev_alloc_skb(size + 128); - if (unlikely(skb == NULL)) { - pr_warning("Failed to allocate skb for hardware pool %d\n", pool); + struct mbuf *m = dev_alloc_m(size + 128); + if (unlikely(m == NULL)) { + pr_warning("Failed to allocate m for hardware pool %d\n", pool); break; } - skb_reserve(skb, 128 - (((unsigned long)skb->data) & 0x7f)); - *(struct sk_buff **)(skb->data - sizeof(void *)) = skb; - cvmx_fpa_free(skb->data, pool, DONT_WRITEBACK(size/128)); + m_reserve(m, 128 - (((unsigned long)m->data) & 0x7f)); + *(struct mbuf **)(m->data - sizeof(void *)) = m; + cvmx_fpa_free(m->data, pool, DONT_WRITEBACK(size/128)); freed--; } return (elements - freed); @@ -62,29 +62,29 @@ static int cvm_oct_fill_hw_skbuff(int po /** - * Free the supplied hardware pool of skbuffs + * Free the supplied hardware pool of mbufs * - * @param pool Pool to allocate an skbuff for + * @param pool Pool to allocate an mbuf for * @param size Size of the buffer needed for the pool * @param elements Number of buffers to allocate */ -static void cvm_oct_free_hw_skbuff(int pool, int size, int elements) +static void cvm_oct_free_hw_mbuf(int pool, int size, int elements) { char *memory; do { memory = cvmx_fpa_alloc(pool); if (memory) { - struct sk_buff *skb = *(struct sk_buff **)(memory - sizeof(void *)); + struct mbuf *m = *(struct mbuf **)(memory - sizeof(void *)); elements--; - dev_kfree_skb(skb); + dev_kfree_m(m); } } while (memory); if (elements < 0) - printk("Warning: Freeing of pool %u had too many skbuffs (%d)\n", pool, elements); + printf("Warning: Freeing of pool %u had too many mbufs (%d)\n", pool, elements); else if (elements > 0) - printk("Warning: Freeing of pool %u is missing %d skbuffs\n", pool, elements); + printf("Warning: Freeing of pool %u is missing %d mbufs\n", pool, elements); } @@ -111,7 +111,7 @@ static int cvm_oct_fill_hw_memory(int po if (memory == NULL) panic("Unable to allocate %u bytes for FPA pool %d\n", elements*size, pool); - printk("Memory range %p - %p reserved for hardware\n", memory, memory + elements*size - 1); + printf("Memory range %p - %p reserved for hardware\n", memory, memory + elements*size - 1); while (freed) { cvmx_fpa_free(memory, pool, 0); @@ -145,7 +145,7 @@ static int cvm_oct_fill_hw_memory(int po static void cvm_oct_free_hw_memory(int pool, int size, int elements) { if (USE_32BIT_SHARED) { - printk("Warning: 32 shared memory is not freeable\n"); + printf("Warning: 32 shared memory is not freeable\n"); } else { char *memory; do { @@ -157,9 +157,9 @@ static void cvm_oct_free_hw_memory(int p } while (memory); if (elements < 0) - printk("Freeing of pool %u had too many buffers (%d)\n", pool, elements); + printf("Freeing of pool %u had too many buffers (%d)\n", pool, elements); else if (elements > 0) - printk("Warning: Freeing of pool %u is missing %d buffers\n", pool, elements); + printf("Warning: Freeing of pool %u is missing %d buffers\n", pool, elements); } } @@ -167,8 +167,8 @@ static void cvm_oct_free_hw_memory(int p int cvm_oct_mem_fill_fpa(int pool, int size, int elements) { int freed; - if (USE_SKBUFFS_IN_HW) - freed = cvm_oct_fill_hw_skbuff(pool, size, elements); + if (USE_MBUFS_IN_HW) + freed = cvm_oct_fill_hw_mbuf(pool, size, elements); else freed = cvm_oct_fill_hw_memory(pool, size, elements); return (freed); @@ -176,8 +176,8 @@ int cvm_oct_mem_fill_fpa(int pool, int s void cvm_oct_mem_empty_fpa(int pool, int size, int elements) { - if (USE_SKBUFFS_IN_HW) - cvm_oct_free_hw_skbuff(pool, size, elements); + if (USE_MBUFS_IN_HW) + cvm_oct_free_hw_mbuf(pool, size, elements); else cvm_oct_free_hw_memory(pool, size, elements); } Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-proc.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-proc.c Thu Apr 22 02:53:49 2010 (r207050) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-proc.c Thu Apr 22 02:54:51 2010 (r207051) @@ -35,99 +35,99 @@ AND WITH ALL FAULTS AND CAVIUM NETWORKS #include "wrapper-cvmx-includes.h" #include "ethernet-headers.h" -extern struct net_device *cvm_oct_device[]; +extern struct ifnet *cvm_oct_device[]; -static unsigned long long cvm_oct_stats_read_switch(struct net_device *dev, int phy_id, int offset) +static unsigned long long cvm_oct_stats_read_switch(struct ifnet *ifp, int phy_id, int offset) { - cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev); - priv->mii_info.mdio_write(dev, phy_id, 0x1d, 0xcc00 | offset); - return ((uint64_t)priv->mii_info.mdio_read(dev, phy_id, 0x1e)<<16) | (uint64_t)priv->mii_info.mdio_read(dev, phy_id, 0x1f); + cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; + priv->mii_info.mdio_write(ifp, phy_id, 0x1d, 0xcc00 | offset); + return ((uint64_t)priv->mii_info.mdio_read(ifp, phy_id, 0x1e)<<16) | (uint64_t)priv->mii_info.mdio_read(ifp, phy_id, 0x1f); } static int cvm_oct_stats_switch_show(struct seq_file *m, void *v) { static const int ports[] = {0, 1, 2, 3, 9, -1}; - struct net_device *dev = cvm_oct_device[0]; + struct ifnet *ifp = cvm_oct_device[0]; int index = 0; while (ports[index] != -1) { /* Latch port */ - cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev); - priv->mii_info.mdio_write(dev, 0x1b, 0x1d, 0xdc00 | ports[index]); + cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; + priv->mii_info.mdio_write(ifp, 0x1b, 0x1d, 0xdc00 | ports[index]); seq_printf(m, "\nSwitch Port %d\n", ports[index]); seq_printf(m, "InGoodOctets: %12llu\t" "OutOctets: %12llu\t" "64 Octets: %12llu\n", - cvm_oct_stats_read_switch(dev, 0x1b, 0x00) | (cvm_oct_stats_read_switch(dev, 0x1b, 0x01)<<32), - cvm_oct_stats_read_switch(dev, 0x1b, 0x0E) | (cvm_oct_stats_read_switch(dev, 0x1b, 0x0F)<<32), - cvm_oct_stats_read_switch(dev, 0x1b, 0x08)); + cvm_oct_stats_read_switch(ifp, 0x1b, 0x00) | (cvm_oct_stats_read_switch(ifp, 0x1b, 0x01)<<32), + cvm_oct_stats_read_switch(ifp, 0x1b, 0x0E) | (cvm_oct_stats_read_switch(ifp, 0x1b, 0x0F)<<32), + cvm_oct_stats_read_switch(ifp, 0x1b, 0x08)); seq_printf(m, "InBadOctets: %12llu\t" "OutUnicast: %12llu\t" "65-127 Octets: %12llu\n", - cvm_oct_stats_read_switch(dev, 0x1b, 0x02), - cvm_oct_stats_read_switch(dev, 0x1b, 0x10), - cvm_oct_stats_read_switch(dev, 0x1b, 0x09)); + cvm_oct_stats_read_switch(ifp, 0x1b, 0x02), + cvm_oct_stats_read_switch(ifp, 0x1b, 0x10), + cvm_oct_stats_read_switch(ifp, 0x1b, 0x09)); seq_printf(m, "InUnicast: %12llu\t" "OutBroadcasts: %12llu\t" "128-255 Octets: %12llu\n", - cvm_oct_stats_read_switch(dev, 0x1b, 0x04), - cvm_oct_stats_read_switch(dev, 0x1b, 0x13), - cvm_oct_stats_read_switch(dev, 0x1b, 0x0A)); + cvm_oct_stats_read_switch(ifp, 0x1b, 0x04), + cvm_oct_stats_read_switch(ifp, 0x1b, 0x13), + cvm_oct_stats_read_switch(ifp, 0x1b, 0x0A)); seq_printf(m, "InBroadcasts: %12llu\t" "OutMulticasts: %12llu\t" "256-511 Octets: %12llu\n", - cvm_oct_stats_read_switch(dev, 0x1b, 0x06), - cvm_oct_stats_read_switch(dev, 0x1b, 0x12), - cvm_oct_stats_read_switch(dev, 0x1b, 0x0B)); + cvm_oct_stats_read_switch(ifp, 0x1b, 0x06), + cvm_oct_stats_read_switch(ifp, 0x1b, 0x12), + cvm_oct_stats_read_switch(ifp, 0x1b, 0x0B)); seq_printf(m, "InMulticasts: %12llu\t" "OutPause: %12llu\t" "512-1023 Octets:%12llu\n", - cvm_oct_stats_read_switch(dev, 0x1b, 0x07), - cvm_oct_stats_read_switch(dev, 0x1b, 0x15), - cvm_oct_stats_read_switch(dev, 0x1b, 0x0C)); + cvm_oct_stats_read_switch(ifp, 0x1b, 0x07), + cvm_oct_stats_read_switch(ifp, 0x1b, 0x15), + cvm_oct_stats_read_switch(ifp, 0x1b, 0x0C)); seq_printf(m, "InPause: %12llu\t" "Excessive: %12llu\t" "1024-Max Octets:%12llu\n", - cvm_oct_stats_read_switch(dev, 0x1b, 0x16), - cvm_oct_stats_read_switch(dev, 0x1b, 0x11), - cvm_oct_stats_read_switch(dev, 0x1b, 0x0D)); + cvm_oct_stats_read_switch(ifp, 0x1b, 0x16), + cvm_oct_stats_read_switch(ifp, 0x1b, 0x11), + cvm_oct_stats_read_switch(ifp, 0x1b, 0x0D)); seq_printf(m, "InUndersize: %12llu\t" "Collisions: %12llu\n", - cvm_oct_stats_read_switch(dev, 0x1b, 0x18), - cvm_oct_stats_read_switch(dev, 0x1b, 0x1E)); + cvm_oct_stats_read_switch(ifp, 0x1b, 0x18), + cvm_oct_stats_read_switch(ifp, 0x1b, 0x1E)); seq_printf(m, "InFragments: %12llu\t" "Deferred: %12llu\n", - cvm_oct_stats_read_switch(dev, 0x1b, 0x19), - cvm_oct_stats_read_switch(dev, 0x1b, 0x05)); + cvm_oct_stats_read_switch(ifp, 0x1b, 0x19), + cvm_oct_stats_read_switch(ifp, 0x1b, 0x05)); seq_printf(m, "InOversize: %12llu\t" "Single: %12llu\n", - cvm_oct_stats_read_switch(dev, 0x1b, 0x1A), - cvm_oct_stats_read_switch(dev, 0x1b, 0x14)); + cvm_oct_stats_read_switch(ifp, 0x1b, 0x1A), + cvm_oct_stats_read_switch(ifp, 0x1b, 0x14)); seq_printf(m, "InJabber: %12llu\t" "Multiple: %12llu\n", - cvm_oct_stats_read_switch(dev, 0x1b, 0x1B), - cvm_oct_stats_read_switch(dev, 0x1b, 0x17)); + cvm_oct_stats_read_switch(ifp, 0x1b, 0x1B), + cvm_oct_stats_read_switch(ifp, 0x1b, 0x17)); seq_printf(m, "In RxErr: %12llu\t" "OutFCSErr: %12llu\n", - cvm_oct_stats_read_switch(dev, 0x1b, 0x1C), - cvm_oct_stats_read_switch(dev, 0x1b, 0x03)); + cvm_oct_stats_read_switch(ifp, 0x1b, 0x1C), + cvm_oct_stats_read_switch(ifp, 0x1b, 0x03)); seq_printf(m, "InFCSErr: %12llu\t" "Late: %12llu\n", - cvm_oct_stats_read_switch(dev, 0x1b, 0x1D), - cvm_oct_stats_read_switch(dev, 0x1b, 0x1F)); + cvm_oct_stats_read_switch(ifp, 0x1b, 0x1D), + cvm_oct_stats_read_switch(ifp, 0x1b, 0x1F)); index++; } return 0; Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rgmii.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rgmii.c Thu Apr 22 02:53:49 2010 (r207050) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rgmii.c Thu Apr 22 02:54:51 2010 (r207051) @@ -35,15 +35,15 @@ AND WITH ALL FAULTS AND CAVIUM NETWORKS #include "ethernet-headers.h" extern int octeon_is_simulation(void); -extern struct net_device *cvm_oct_device[]; +extern struct ifnet *cvm_oct_device[]; DEFINE_SPINLOCK(global_register_lock); static int number_rgmii_ports; -static void cvm_oct_rgmii_poll(struct net_device *dev) +static void cvm_oct_rgmii_poll(struct ifnet *ifp) { - cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev); + cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; unsigned long flags; cvmx_helper_link_info_t link_info; @@ -86,7 +86,7 @@ static void cvm_oct_rgmii_poll(struct ne /* Clear any error bits */ cvmx_write_csr(CVMX_GMXX_RXX_INT_REG(index, interface), gmxx_rxx_int_reg.u64); - DEBUGPRINT("%s: Using 10Mbps with software preamble removal\n", dev->name); + DEBUGPRINT("%s: Using 10Mbps with software preamble removal\n", if_name(ifp)); } } spin_unlock_irqrestore(&global_register_lock, flags); @@ -125,32 +125,32 @@ static void cvm_oct_rgmii_poll(struct ne /* Tell Linux */ if (link_info.s.link_up) { - if (!netif_carrier_ok(dev)) - netif_carrier_on(dev); + if (!netif_carrier_ok(ifp)) + netif_carrier_on(ifp); if (priv->queue != -1) DEBUGPRINT("%s: %u Mbps %s duplex, port %2d, queue %2d\n", - dev->name, link_info.s.speed, + if_name(ifp), link_info.s.speed, (link_info.s.full_duplex) ? "Full" : "Half", priv->port, priv->queue); else DEBUGPRINT("%s: %u Mbps %s duplex, port %2d, POW\n", - dev->name, link_info.s.speed, + if_name(ifp), link_info.s.speed, (link_info.s.full_duplex) ? "Full" : "Half", priv->port); } else { - if (netif_carrier_ok(dev)) - netif_carrier_off(dev); - DEBUGPRINT("%s: Link down\n", dev->name); + if (netif_carrier_ok(ifp)) + netif_carrier_off(ifp); + DEBUGPRINT("%s: Link down\n", if_name(ifp)); } } -static irqreturn_t cvm_oct_rgmii_rml_interrupt(int cpl, void *dev_id) +static int cvm_oct_rgmii_rml_interrupt(int cpl, void *dev_id) { cvmx_npi_rsl_int_blocks_t rsl_int_blocks; int index; - irqreturn_t return_status = IRQ_NONE; + int return_status = IRQ_NONE; rsl_int_blocks.u64 = cvmx_read_csr(CVMX_NPI_RSL_INT_BLOCKS); @@ -168,9 +168,9 @@ static irqreturn_t cvm_oct_rgmii_rml_int /* Poll the port if inband status changed */ if (gmx_rx_int_reg.s.phy_dupx || gmx_rx_int_reg.s.phy_link || gmx_rx_int_reg.s.phy_spd) { - struct net_device *dev = cvm_oct_device[cvmx_helper_get_ipd_port(interface, index)]; - if (dev) - cvm_oct_rgmii_poll(dev); + struct ifnet *ifp = cvm_oct_device[cvmx_helper_get_ipd_port(interface, index)]; + if (ifp) + cvm_oct_rgmii_poll(ifp); gmx_rx_int_reg.u64 = 0; gmx_rx_int_reg.s.phy_dupx = 1; gmx_rx_int_reg.s.phy_link = 1; @@ -195,9 +195,9 @@ static irqreturn_t cvm_oct_rgmii_rml_int /* Poll the port if inband status changed */ if (gmx_rx_int_reg.s.phy_dupx || gmx_rx_int_reg.s.phy_link || gmx_rx_int_reg.s.phy_spd) { - struct net_device *dev = cvm_oct_device[cvmx_helper_get_ipd_port(interface, index)]; - if (dev) - cvm_oct_rgmii_poll(dev); + struct ifnet *ifp = cvm_oct_device[cvmx_helper_get_ipd_port(interface, index)]; + if (ifp) + cvm_oct_rgmii_poll(ifp); gmx_rx_int_reg.u64 = 0; gmx_rx_int_reg.s.phy_dupx = 1; gmx_rx_int_reg.s.phy_link = 1; @@ -211,10 +211,10 @@ static irqreturn_t cvm_oct_rgmii_rml_int } -static int cvm_oct_rgmii_open(struct net_device *dev) +static int cvm_oct_rgmii_open(struct ifnet *ifp) { cvmx_gmxx_prtx_cfg_t gmx_cfg; - cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev); + cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; int interface = INTERFACE(priv->port); int index = INDEX(priv->port); cvmx_helper_link_info_t link_info; @@ -226,16 +226,16 @@ static int cvm_oct_rgmii_open(struct net if (!octeon_is_simulation()) { link_info = cvmx_helper_link_get(priv->port); if (!link_info.s.link_up) - netif_carrier_off(dev); + netif_carrier_off(ifp); } return 0; } -static int cvm_oct_rgmii_stop(struct net_device *dev) +static int cvm_oct_rgmii_stop(struct ifnet *ifp) { cvmx_gmxx_prtx_cfg_t gmx_cfg; - cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev); + cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; int interface = INTERFACE(priv->port); int index = INDEX(priv->port); @@ -245,15 +245,15 @@ static int cvm_oct_rgmii_stop(struct net return 0; } -int cvm_oct_rgmii_init(struct net_device *dev) +int cvm_oct_rgmii_init(struct ifnet *ifp) { - cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev); + cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; int r; - cvm_oct_common_init(dev); - dev->open = cvm_oct_rgmii_open; - dev->stop = cvm_oct_rgmii_stop; - dev->stop(dev); + cvm_oct_common_init(ifp); + ifp->open = cvm_oct_rgmii_open; + ifp->stop = cvm_oct_rgmii_stop; + ifp->stop(ifp); /* Due to GMX errata in CN3XXX series chips, it is necessary to take the link down immediately whne the PHY changes state. In order to do this @@ -289,10 +289,10 @@ int cvm_oct_rgmii_init(struct net_device return 0; } -void cvm_oct_rgmii_uninit(struct net_device *dev) +void cvm_oct_rgmii_uninit(struct ifnet *ifp) { - cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev); - cvm_oct_common_uninit(dev); + cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; + cvm_oct_common_uninit(ifp); /* Only true RGMII ports need to be polled. In GMII mode, port 0 is really a RGMII port */ Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c Thu Apr 22 02:53:49 2010 (r207050) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c Thu Apr 22 02:54:51 2010 (r207051) @@ -49,7 +49,7 @@ AND WITH ALL FAULTS AND CAVIUM NETWORKS #include "ethernet-headers.h" extern int pow_receive_group; -extern struct net_device *cvm_oct_device[]; +extern struct ifnet *cvm_oct_device[]; struct cvm_tasklet_wrapper { struct tasklet_struct t; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***