diff options
Diffstat (limited to 'drivers/staging/octeon')
-rw-r--r-- | drivers/staging/octeon/Makefile | 2 | ||||
-rw-r--r-- | drivers/staging/octeon/ethernet-defines.h | 5 | ||||
-rw-r--r-- | drivers/staging/octeon/ethernet-rgmii.c | 2 | ||||
-rw-r--r-- | drivers/staging/octeon/ethernet-rx.c | 10 | ||||
-rw-r--r-- | drivers/staging/octeon/ethernet-sgmii.c | 2 | ||||
-rw-r--r-- | drivers/staging/octeon/ethernet-tx.c | 8 | ||||
-rw-r--r-- | drivers/staging/octeon/ethernet-xaui.c | 42 | ||||
-rw-r--r-- | drivers/staging/octeon/ethernet.c | 42 | ||||
-rw-r--r-- | drivers/staging/octeon/octeon-ethernet.h | 6 |
9 files changed, 39 insertions, 80 deletions
diff --git a/drivers/staging/octeon/Makefile b/drivers/staging/octeon/Makefile index 9012dee0c..8ca17210d 100644 --- a/drivers/staging/octeon/Makefile +++ b/drivers/staging/octeon/Makefile @@ -19,5 +19,3 @@ octeon-ethernet-y += ethernet-rx.o octeon-ethernet-y += ethernet-sgmii.o octeon-ethernet-y += ethernet-spi.o octeon-ethernet-y += ethernet-tx.o -octeon-ethernet-y += ethernet-xaui.o - diff --git a/drivers/staging/octeon/ethernet-defines.h b/drivers/staging/octeon/ethernet-defines.h index f92e0c478..13e4cee1f 100644 --- a/drivers/staging/octeon/ethernet-defines.h +++ b/drivers/staging/octeon/ethernet-defines.h @@ -37,10 +37,9 @@ /* Maximum number of SKBs to try to free per xmit packet. */ #define MAX_OUT_QUEUE_DEPTH 1000 -#define FAU_TOTAL_TX_TO_CLEAN (CVMX_FAU_REG_END - sizeof(uint32_t)) -#define FAU_NUM_PACKET_BUFFERS_TO_FREE (FAU_TOTAL_TX_TO_CLEAN - sizeof(uint32_t)) +#define FAU_TOTAL_TX_TO_CLEAN (CVMX_FAU_REG_END - sizeof(u32)) +#define FAU_NUM_PACKET_BUFFERS_TO_FREE (FAU_TOTAL_TX_TO_CLEAN - sizeof(u32)) #define TOTAL_NUMBER_OF_PORTS (CVMX_PIP_NUM_INPUT_PORTS+1) - #endif /* __ETHERNET_DEFINES_H__ */ diff --git a/drivers/staging/octeon/ethernet-rgmii.c b/drivers/staging/octeon/ethernet-rgmii.c index 51dcb6117..613344b88 100644 --- a/drivers/staging/octeon/ethernet-rgmii.c +++ b/drivers/staging/octeon/ethernet-rgmii.c @@ -207,7 +207,7 @@ static irqreturn_t cvm_oct_rgmii_rml_interrupt(int cpl, void *dev_id) int cvm_oct_rgmii_open(struct net_device *dev) { - return cvm_oct_common_open(dev, cvm_oct_rgmii_poll, false); + return cvm_oct_common_open(dev, cvm_oct_rgmii_poll); } static void cvm_oct_rgmii_immediate_poll(struct work_struct *work) diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c index d1a33a927..6aed3cf6c 100644 --- a/drivers/staging/octeon/ethernet-rx.c +++ b/drivers/staging/octeon/ethernet-rx.c @@ -49,6 +49,8 @@ static struct napi_struct cvm_oct_napi; /** * cvm_oct_do_interrupt - interrupt handler. + * @cpl: Interrupt number. Unused + * @dev_id: Cookie to identify the device. Unused * * The interrupt occurs whenever the POW has packets in our group. * @@ -102,7 +104,7 @@ static inline int cvm_oct_check_rcv_error(cvmx_wqe_t *work) cvmx_read_csr(CVMX_GMXX_RXX_FRM_CTL(index, interface)); if (gmxx_rxx_frm_ctl.s.pre_chk == 0) { - uint8_t *ptr = + u8 *ptr = cvmx_phys_to_ptr(work->packet_ptr.s.addr); int i = 0; @@ -163,8 +165,8 @@ static inline int cvm_oct_check_rcv_error(cvmx_wqe_t *work) static int cvm_oct_napi_poll(struct napi_struct *napi, int budget) { const int coreid = cvmx_get_core_num(); - uint64_t old_group_mask; - uint64_t old_scratch; + u64 old_group_mask; + u64 old_scratch; int rx_count = 0; int did_work_request = 0; int packet_not_copied; @@ -284,7 +286,7 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget) * entirely stored in the work entry. */ if (unlikely(work->word2.s.bufs == 0)) { - uint8_t *ptr = work->packet_data; + u8 *ptr = work->packet_data; if (likely(!work->word2.s.not_IP)) { /* diff --git a/drivers/staging/octeon/ethernet-sgmii.c b/drivers/staging/octeon/ethernet-sgmii.c index 8bceb7691..7424dc45a 100644 --- a/drivers/staging/octeon/ethernet-sgmii.c +++ b/drivers/staging/octeon/ethernet-sgmii.c @@ -27,7 +27,7 @@ int cvm_oct_sgmii_open(struct net_device *dev) { - return cvm_oct_common_open(dev, cvm_oct_link_poll, true); + return cvm_oct_common_open(dev, cvm_oct_link_poll); } int cvm_oct_sgmii_init(struct net_device *dev) diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c index 9e2116f4c..c053c4a47 100644 --- a/drivers/staging/octeon/ethernet-tx.c +++ b/drivers/staging/octeon/ethernet-tx.c @@ -143,8 +143,8 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev) { cvmx_pko_command_word0_t pko_command; union cvmx_buf_ptr hw_buffer; - uint64_t old_scratch; - uint64_t old_scratch2; + u64 old_scratch; + u64 old_scratch2; int qos; int i; enum {QUEUE_CORE, QUEUE_HW, QUEUE_DROP} queue_type; @@ -549,7 +549,7 @@ int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev) /* Get a work queue entry */ cvmx_wqe_t *work = cvmx_fpa_alloc(CVMX_FPA_WQE_POOL); - if (unlikely(work == NULL)) { + if (unlikely(!work)) { printk_ratelimited("%s: Failed to allocate a work queue entry\n", dev->name); priv->stats.tx_dropped++; @@ -576,7 +576,7 @@ int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev) * calculation may add a little extra, but that doesn't * hurt. */ - copy_location = packet_buffer + sizeof(uint64_t); + copy_location = packet_buffer + sizeof(u64); copy_location += ((CVMX_HELPER_FIRST_MBUFF_SKIP + 7) & 0xfff8) + 6; /* diff --git a/drivers/staging/octeon/ethernet-xaui.c b/drivers/staging/octeon/ethernet-xaui.c deleted file mode 100644 index 4b47bcfaa..000000000 --- a/drivers/staging/octeon/ethernet-xaui.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * This file is based on code from OCTEON SDK by Cavium Networks. - * - * Copyright (c) 2003-2007 Cavium Networks - * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, Version 2, as - * published by the Free Software Foundation. - */ - -#include <linux/phy.h> -#include <linux/kernel.h> -#include <linux/netdevice.h> -#include <linux/ratelimit.h> -#include <net/dst.h> - -#include <asm/octeon/octeon.h> - -#include "ethernet-defines.h" -#include "octeon-ethernet.h" -#include "ethernet-util.h" -#include "ethernet-mdio.h" - -#include <asm/octeon/cvmx-helper.h> - -#include <asm/octeon/cvmx-gmxx-defs.h> - -int cvm_oct_xaui_open(struct net_device *dev) -{ - return cvm_oct_common_open(dev, cvm_oct_link_poll, true); -} - -int cvm_oct_xaui_init(struct net_device *dev) -{ - struct octeon_ethernet *priv = netdev_priv(dev); - - cvm_oct_common_init(dev); - if (!octeon_is_simulation() && priv->phydev == NULL) - priv->poll = cvm_oct_link_poll; - - return 0; -} diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c index 7274fda0b..f69fb5cc7 100644 --- a/drivers/staging/octeon/ethernet.c +++ b/drivers/staging/octeon/ethernet.c @@ -86,19 +86,19 @@ int rx_napi_weight = 32; module_param(rx_napi_weight, int, 0444); MODULE_PARM_DESC(rx_napi_weight, "The NAPI WEIGHT parameter."); -/** +/* * cvm_oct_poll_queue - Workqueue for polling operations. */ struct workqueue_struct *cvm_oct_poll_queue; -/** +/* * cvm_oct_poll_queue_stopping - flag to indicate polling should stop. * * Set to one right before cvm_oct_poll_queue is destroyed. */ atomic_t cvm_oct_poll_queue_stopping = ATOMIC_INIT(0); -/** +/* * Array of every ethernet device owned by this driver indexed by * the ipd input port number. */ @@ -364,13 +364,6 @@ static void cvm_oct_common_set_multicast_list(struct net_device *dev) } } -/** - * cvm_oct_common_set_mac_address - set the hardware MAC address for a device - * @dev: The device in question. - * @addr: Address structure to change it too. - - * Returns Zero on success - */ static int cvm_oct_set_mac_filter(struct net_device *dev) { struct octeon_ethernet *priv = netdev_priv(dev); @@ -382,11 +375,11 @@ static int cvm_oct_set_mac_filter(struct net_device *dev) && (cvmx_helper_interface_get_mode(interface) != CVMX_HELPER_INTERFACE_MODE_SPI)) { int i; - uint8_t *ptr = dev->dev_addr; - uint64_t mac = 0; + u8 *ptr = dev->dev_addr; + u64 mac = 0; for (i = 0; i < 6; i++) - mac = (mac << 8) | (uint64_t)ptr[i]; + mac = (mac << 8) | (u64)ptr[i]; gmx_cfg.u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface)); @@ -413,6 +406,13 @@ static int cvm_oct_set_mac_filter(struct net_device *dev) return 0; } +/** + * cvm_oct_common_set_mac_address - set the hardware MAC address for a device + * @dev: The device in question. + * @addr: Socket address. + * + * Returns Zero on success + */ static int cvm_oct_common_set_mac_address(struct net_device *dev, void *addr) { int r = eth_mac_addr(dev, addr); @@ -481,7 +481,7 @@ void cvm_oct_common_uninit(struct net_device *dev) } int cvm_oct_common_open(struct net_device *dev, - void (*link_poll)(struct net_device *), bool poll_now) + void (*link_poll)(struct net_device *)) { union cvmx_gmxx_prtx_cfg gmx_cfg; struct octeon_ethernet *priv = netdev_priv(dev); @@ -512,8 +512,7 @@ int cvm_oct_common_open(struct net_device *dev, if (!link_info.s.link_up) netif_carrier_off(dev); priv->poll = link_poll; - if (poll_now) - link_poll(dev); + link_poll(dev); } return 0; @@ -540,6 +539,11 @@ void cvm_oct_link_poll(struct net_device *dev) cvm_oct_note_carrier(priv, link_info); } +static int cvm_oct_xaui_open(struct net_device *dev) +{ + return cvm_oct_common_open(dev, cvm_oct_link_poll); +} + static const struct net_device_ops cvm_oct_npi_netdev_ops = { .ndo_init = cvm_oct_common_init, .ndo_uninit = cvm_oct_common_uninit, @@ -554,7 +558,7 @@ static const struct net_device_ops cvm_oct_npi_netdev_ops = { #endif }; static const struct net_device_ops cvm_oct_xaui_netdev_ops = { - .ndo_init = cvm_oct_xaui_init, + .ndo_init = cvm_oct_common_init, .ndo_uninit = cvm_oct_common_uninit, .ndo_open = cvm_oct_xaui_open, .ndo_stop = cvm_oct_common_stop, @@ -674,7 +678,7 @@ static int cvm_oct_probe(struct platform_device *pdev) } cvm_oct_poll_queue = create_singlethread_workqueue("octeon-ethernet"); - if (cvm_oct_poll_queue == NULL) { + if (!cvm_oct_poll_queue) { pr_err("octeon-ethernet: Cannot create workqueue"); return -ENOMEM; } @@ -835,7 +839,7 @@ static int cvm_oct_probe(struct platform_device *pdev) cvm_oct_device[priv->port] = dev; fau -= cvmx_pko_get_num_queues(priv->port) * - sizeof(uint32_t); + sizeof(u32); queue_delayed_work(cvm_oct_poll_queue, &priv->port_periodic_work, HZ); } diff --git a/drivers/staging/octeon/octeon-ethernet.h b/drivers/staging/octeon/octeon-ethernet.h index a242c700b..fdf24d120 100644 --- a/drivers/staging/octeon/octeon-ethernet.h +++ b/drivers/staging/octeon/octeon-ethernet.h @@ -43,7 +43,7 @@ struct octeon_ethernet { struct phy_device *phydev; unsigned int last_link; /* Last negotiated link state */ - uint64_t link_info; + u64 link_info; /* Called periodically to check link status */ void (*poll)(struct net_device *dev); struct delayed_work port_periodic_work; @@ -62,15 +62,13 @@ int cvm_oct_sgmii_open(struct net_device *dev); int cvm_oct_spi_init(struct net_device *dev); void cvm_oct_spi_uninit(struct net_device *dev); -int cvm_oct_xaui_init(struct net_device *dev); -int cvm_oct_xaui_open(struct net_device *dev); int cvm_oct_common_init(struct net_device *dev); void cvm_oct_common_uninit(struct net_device *dev); void cvm_oct_adjust_link(struct net_device *dev); int cvm_oct_common_stop(struct net_device *dev); int cvm_oct_common_open(struct net_device *dev, - void (*link_poll)(struct net_device *), bool poll_now); + void (*link_poll)(struct net_device *)); void cvm_oct_note_carrier(struct octeon_ethernet *priv, cvmx_helper_link_info_t li); void cvm_oct_link_poll(struct net_device *dev); |