diff options
Diffstat (limited to 'drivers/staging/octeon')
-rw-r--r-- | drivers/staging/octeon/ethernet-mdio.c | 27 | ||||
-rw-r--r-- | drivers/staging/octeon/ethernet-rgmii.c | 34 | ||||
-rw-r--r-- | drivers/staging/octeon/ethernet-rx.c | 29 | ||||
-rw-r--r-- | drivers/staging/octeon/ethernet-sgmii.c | 14 | ||||
-rw-r--r-- | drivers/staging/octeon/ethernet-spi.c | 1 | ||||
-rw-r--r-- | drivers/staging/octeon/ethernet-tx.c | 17 | ||||
-rw-r--r-- | drivers/staging/octeon/ethernet-util.h | 4 | ||||
-rw-r--r-- | drivers/staging/octeon/ethernet-xaui.c | 22 | ||||
-rw-r--r-- | drivers/staging/octeon/ethernet.c | 12 |
9 files changed, 84 insertions, 76 deletions
diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c index 8a11ffc..f18e3e1 100644 --- a/drivers/staging/octeon/ethernet-mdio.c +++ b/drivers/staging/octeon/ethernet-mdio.c @@ -27,6 +27,7 @@ #include <linux/kernel.h> #include <linux/ethtool.h> #include <linux/phy.h> +#include <linux/ratelimit.h> #include <net/dst.h> @@ -129,22 +130,22 @@ static void cvm_oct_adjust_link(struct net_device *dev) if (priv->last_link) { netif_carrier_on(dev); if (priv->queue != -1) - DEBUGPRINT("%s: %u Mbps %s duplex, " - "port %2d, queue %2d\n", - dev->name, priv->phydev->speed, - priv->phydev->duplex ? - "Full" : "Half", - priv->port, priv->queue); + printk_ratelimited("%s: %u Mbps %s duplex, " + "port %2d, queue %2d\n", + dev->name, priv->phydev->speed, + priv->phydev->duplex ? + "Full" : "Half", + priv->port, priv->queue); else - DEBUGPRINT("%s: %u Mbps %s duplex, " - "port %2d, POW\n", - dev->name, priv->phydev->speed, - priv->phydev->duplex ? - "Full" : "Half", - priv->port); + printk_ratelimited("%s: %u Mbps %s duplex, " + "port %2d, POW\n", + dev->name, priv->phydev->speed, + priv->phydev->duplex ? + "Full" : "Half", + priv->port); } else { netif_carrier_off(dev); - DEBUGPRINT("%s: Link down\n", dev->name); + printk_ratelimited("%s: Link down\n", dev->name); } } } diff --git a/drivers/staging/octeon/ethernet-rgmii.c b/drivers/staging/octeon/ethernet-rgmii.c index a0d4d4b..c3d73f8 100644 --- a/drivers/staging/octeon/ethernet-rgmii.c +++ b/drivers/staging/octeon/ethernet-rgmii.c @@ -26,7 +26,9 @@ **********************************************************************/ #include <linux/kernel.h> #include <linux/netdevice.h> +#include <linux/interrupt.h> #include <linux/phy.h> +#include <linux/ratelimit.h> #include <net/dst.h> #include <asm/octeon/octeon.h> @@ -116,9 +118,9 @@ static void cvm_oct_rgmii_poll(struct net_device *dev) 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); + printk_ratelimited("%s: Using 10Mbps with software " + "preamble removal\n", + dev->name); } } @@ -174,23 +176,23 @@ static void cvm_oct_rgmii_poll(struct net_device *dev) if (!netif_carrier_ok(dev)) netif_carrier_on(dev); if (priv->queue != -1) - DEBUGPRINT("%s: %u Mbps %s duplex, " - "port %2d, queue %2d\n", - dev->name, link_info.s.speed, - (link_info.s.full_duplex) ? - "Full" : "Half", - priv->port, priv->queue); + printk_ratelimited("%s: %u Mbps %s duplex, " + "port %2d, queue %2d\n", + dev->name, 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, - (link_info.s.full_duplex) ? - "Full" : "Half", - priv->port); + printk_ratelimited("%s: %u Mbps %s duplex, " + "port %2d, POW\n", + dev->name, 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); + printk_ratelimited("%s: Link down\n", dev->name); } } } diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c index cb38f9e..8b307b4 100644 --- a/drivers/staging/octeon/ethernet-rx.c +++ b/drivers/staging/octeon/ethernet-rx.c @@ -34,6 +34,7 @@ #include <linux/ip.h> #include <linux/string.h> #include <linux/prefetch.h> +#include <linux/ratelimit.h> #include <linux/smp.h> #include <net/dst.h> #ifdef CONFIG_XFRM @@ -41,7 +42,7 @@ #include <net/xfrm.h> #endif /* CONFIG_XFRM */ -#include <asm/atomic.h> +#include <linux/atomic.h> #include <asm/octeon/octeon.h> @@ -186,13 +187,13 @@ static inline int cvm_oct_check_rcv_error(cvmx_wqe_t *work) if (*ptr == 0xd5) { /* - DEBUGPRINT("Port %d received 0xd5 preamble\n", work->ipprt); + printk_ratelimited("Port %d received 0xd5 preamble\n", work->ipprt); */ work->packet_ptr.s.addr += i + 1; work->len -= i + 5; } else if ((*ptr & 0xf) == 0xd) { /* - DEBUGPRINT("Port %d received 0x?d preamble\n", work->ipprt); + printk_ratelimited("Port %d received 0x?d preamble\n", work->ipprt); */ work->packet_ptr.s.addr += i; work->len -= i + 4; @@ -203,9 +204,9 @@ static inline int cvm_oct_check_rcv_error(cvmx_wqe_t *work) ptr++; } } else { - DEBUGPRINT("Port %d unknown preamble, packet " - "dropped\n", - work->ipprt); + printk_ratelimited("Port %d unknown preamble, packet " + "dropped\n", + work->ipprt); /* cvmx_helper_dump_packet(work); */ @@ -214,8 +215,8 @@ static inline int cvm_oct_check_rcv_error(cvmx_wqe_t *work) } } } else { - DEBUGPRINT("Port %d receive error code %d, packet dropped\n", - work->ipprt, work->word2.snoip.err_code); + printk_ratelimited("Port %d receive error code %d, packet dropped\n", + work->ipprt, work->word2.snoip.err_code); cvm_oct_free_work(work); return 1; } @@ -334,8 +335,9 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget) */ skb = dev_alloc_skb(work->len); if (!skb) { - DEBUGPRINT("Port %d failed to allocate skbuff, packet dropped\n", - work->ipprt); + printk_ratelimited("Port %d failed to allocate " + "skbuff, packet dropped\n", + work->ipprt); cvm_oct_free_work(work); continue; } @@ -409,7 +411,8 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget) skb->protocol = eth_type_trans(skb, dev); skb->dev = dev; - if (unlikely(work->word2.s.not_IP || work->word2.s.IP_exc || work->word2.s.L4_error)) + if (unlikely(work->word2.s.not_IP || work->word2.s.IP_exc || + work->word2.s.L4_error || !work->word2.s.tcp_or_udp)) skb->ip_summed = CHECKSUM_NONE; else skb->ip_summed = CHECKSUM_UNNECESSARY; @@ -429,7 +432,7 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget) } else { /* Drop any packet received for a device that isn't up */ /* - DEBUGPRINT("%s: Device not up, packet dropped\n", + printk_ratelimited("%s: Device not up, packet dropped\n", dev->name); */ #ifdef CONFIG_64BIT @@ -444,7 +447,7 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget) * Drop any packet received for a device that * doesn't exist. */ - DEBUGPRINT("Port %d not controlled by Linux, packet dropped\n", + printk_ratelimited("Port %d not controlled by Linux, packet dropped\n", work->ipprt); dev_kfree_skb_irq(skb); } diff --git a/drivers/staging/octeon/ethernet-sgmii.c b/drivers/staging/octeon/ethernet-sgmii.c index 2d8589e..5e148b5 100644 --- a/drivers/staging/octeon/ethernet-sgmii.c +++ b/drivers/staging/octeon/ethernet-sgmii.c @@ -26,6 +26,7 @@ **********************************************************************/ #include <linux/kernel.h> #include <linux/netdevice.h> +#include <linux/ratelimit.h> #include <net/dst.h> #include <asm/octeon/octeon.h> @@ -90,20 +91,21 @@ static void cvm_oct_sgmii_poll(struct net_device *dev) if (!netif_carrier_ok(dev)) netif_carrier_on(dev); if (priv->queue != -1) - DEBUGPRINT + printk_ratelimited ("%s: %u Mbps %s duplex, port %2d, queue %2d\n", dev->name, 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, - (link_info.s.full_duplex) ? "Full" : "Half", - priv->port); + printk_ratelimited + ("%s: %u Mbps %s duplex, port %2d, POW\n", + dev->name, 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); + printk_ratelimited("%s: Link down\n", dev->name); } } diff --git a/drivers/staging/octeon/ethernet-spi.c b/drivers/staging/octeon/ethernet-spi.c index 9708254..d0e2d51 100644 --- a/drivers/staging/octeon/ethernet-spi.c +++ b/drivers/staging/octeon/ethernet-spi.c @@ -26,6 +26,7 @@ **********************************************************************/ #include <linux/kernel.h> #include <linux/netdevice.h> +#include <linux/interrupt.h> #include <net/dst.h> #include <asm/octeon/octeon.h> diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c index afc2b73..c5da0d2 100644 --- a/drivers/staging/octeon/ethernet-tx.c +++ b/drivers/staging/octeon/ethernet-tx.c @@ -30,6 +30,7 @@ #include <linux/init.h> #include <linux/etherdevice.h> #include <linux/ip.h> +#include <linux/ratelimit.h> #include <linux/string.h> #include <net/dst.h> #ifdef CONFIG_XFRM @@ -37,7 +38,7 @@ #include <net/xfrm.h> #endif /* CONFIG_XFRM */ -#include <asm/atomic.h> +#include <linux/atomic.h> #include <asm/octeon/octeon.h> @@ -274,7 +275,7 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev) CVM_OCT_SKB_CB(skb)[0] = hw_buffer.u64; for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { struct skb_frag_struct *fs = skb_shinfo(skb)->frags + i; - hw_buffer.s.addr = XKPHYS_TO_PHYS((u64)(page_address(fs->page) + fs->page_offset)); + hw_buffer.s.addr = XKPHYS_TO_PHYS((u64)(page_address(fs->page.p) + fs->page_offset)); hw_buffer.s.size = fs->size; CVM_OCT_SKB_CB(skb)[i + 1] = hw_buffer.u64; } @@ -343,7 +344,7 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev) } if (unlikely (skb->truesize != - sizeof(*skb) + skb_end_pointer(skb) - skb->head)) { + sizeof(*skb) + skb_end_offset(skb))) { /* printk("TX buffer truesize has been changed\n"); */ @@ -446,7 +447,7 @@ dont_put_skbuff_in_hw: priv->queue + qos, pko_command, hw_buffer, CVMX_PKO_LOCK_NONE))) { - DEBUGPRINT("%s: Failed to send the packet\n", dev->name); + printk_ratelimited("%s: Failed to send the packet\n", dev->name); queue_type = QUEUE_DROP; } skip_xmit: @@ -525,8 +526,8 @@ 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)) { - DEBUGPRINT("%s: Failed to allocate a work queue entry\n", - dev->name); + printk_ratelimited("%s: Failed to allocate a work " + "queue entry\n", dev->name); priv->stats.tx_dropped++; dev_kfree_skb(skb); return 0; @@ -535,8 +536,8 @@ int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev) /* Get a packet buffer */ packet_buffer = cvmx_fpa_alloc(CVMX_FPA_PACKET_POOL); if (unlikely(packet_buffer == NULL)) { - DEBUGPRINT("%s: Failed to allocate a packet buffer\n", - dev->name); + printk_ratelimited("%s: Failed to allocate a packet buffer\n", + dev->name); cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, DONT_WRITEBACK(1)); priv->stats.tx_dropped++; dev_kfree_skb(skb); diff --git a/drivers/staging/octeon/ethernet-util.h b/drivers/staging/octeon/ethernet-util.h index c745a72..144fb99 100644 --- a/drivers/staging/octeon/ethernet-util.h +++ b/drivers/staging/octeon/ethernet-util.h @@ -25,10 +25,6 @@ * Contact Cavium Networks for more information *********************************************************************/ -#define DEBUGPRINT(format, ...) do { if (printk_ratelimit()) \ - printk(format, ##__VA_ARGS__); \ - } while (0) - /** * cvm_oct_get_buffer_ptr - convert packet data address to pointer * @packet_ptr: Packet data hardware address diff --git a/drivers/staging/octeon/ethernet-xaui.c b/drivers/staging/octeon/ethernet-xaui.c index 3fca1cc..861a4b3 100644 --- a/drivers/staging/octeon/ethernet-xaui.c +++ b/drivers/staging/octeon/ethernet-xaui.c @@ -26,6 +26,7 @@ **********************************************************************/ #include <linux/kernel.h> #include <linux/netdevice.h> +#include <linux/ratelimit.h> #include <net/dst.h> #include <asm/octeon/octeon.h> @@ -89,20 +90,21 @@ static void cvm_oct_xaui_poll(struct net_device *dev) if (!netif_carrier_ok(dev)) netif_carrier_on(dev); if (priv->queue != -1) - DEBUGPRINT - ("%s: %u Mbps %s duplex, port %2d, queue %2d\n", - dev->name, link_info.s.speed, - (link_info.s.full_duplex) ? "Full" : "Half", - priv->port, priv->queue); + printk_ratelimited + ("%s: %u Mbps %s duplex, port %2d, queue %2d\n", + dev->name, 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, - (link_info.s.full_duplex) ? "Full" : "Half", - priv->port); + printk_ratelimited + ("%s: %u Mbps %s duplex, port %2d, POW\n", + dev->name, 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); + printk_ratelimited("%s: Link down\n", dev->name); } } diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c index a8f780e..076f866 100644 --- a/drivers/staging/octeon/ethernet.c +++ b/drivers/staging/octeon/ethernet.c @@ -512,7 +512,7 @@ static const struct net_device_ops cvm_oct_npi_netdev_ops = { .ndo_init = cvm_oct_common_init, .ndo_uninit = cvm_oct_common_uninit, .ndo_start_xmit = cvm_oct_xmit, - .ndo_set_multicast_list = cvm_oct_common_set_multicast_list, + .ndo_set_rx_mode = cvm_oct_common_set_multicast_list, .ndo_set_mac_address = cvm_oct_common_set_mac_address, .ndo_do_ioctl = cvm_oct_ioctl, .ndo_change_mtu = cvm_oct_common_change_mtu, @@ -527,7 +527,7 @@ static const struct net_device_ops cvm_oct_xaui_netdev_ops = { .ndo_open = cvm_oct_xaui_open, .ndo_stop = cvm_oct_xaui_stop, .ndo_start_xmit = cvm_oct_xmit, - .ndo_set_multicast_list = cvm_oct_common_set_multicast_list, + .ndo_set_rx_mode = cvm_oct_common_set_multicast_list, .ndo_set_mac_address = cvm_oct_common_set_mac_address, .ndo_do_ioctl = cvm_oct_ioctl, .ndo_change_mtu = cvm_oct_common_change_mtu, @@ -542,7 +542,7 @@ static const struct net_device_ops cvm_oct_sgmii_netdev_ops = { .ndo_open = cvm_oct_sgmii_open, .ndo_stop = cvm_oct_sgmii_stop, .ndo_start_xmit = cvm_oct_xmit, - .ndo_set_multicast_list = cvm_oct_common_set_multicast_list, + .ndo_set_rx_mode = cvm_oct_common_set_multicast_list, .ndo_set_mac_address = cvm_oct_common_set_mac_address, .ndo_do_ioctl = cvm_oct_ioctl, .ndo_change_mtu = cvm_oct_common_change_mtu, @@ -555,7 +555,7 @@ static const struct net_device_ops cvm_oct_spi_netdev_ops = { .ndo_init = cvm_oct_spi_init, .ndo_uninit = cvm_oct_spi_uninit, .ndo_start_xmit = cvm_oct_xmit, - .ndo_set_multicast_list = cvm_oct_common_set_multicast_list, + .ndo_set_rx_mode = cvm_oct_common_set_multicast_list, .ndo_set_mac_address = cvm_oct_common_set_mac_address, .ndo_do_ioctl = cvm_oct_ioctl, .ndo_change_mtu = cvm_oct_common_change_mtu, @@ -570,7 +570,7 @@ static const struct net_device_ops cvm_oct_rgmii_netdev_ops = { .ndo_open = cvm_oct_rgmii_open, .ndo_stop = cvm_oct_rgmii_stop, .ndo_start_xmit = cvm_oct_xmit, - .ndo_set_multicast_list = cvm_oct_common_set_multicast_list, + .ndo_set_rx_mode = cvm_oct_common_set_multicast_list, .ndo_set_mac_address = cvm_oct_common_set_mac_address, .ndo_do_ioctl = cvm_oct_ioctl, .ndo_change_mtu = cvm_oct_common_change_mtu, @@ -582,7 +582,7 @@ static const struct net_device_ops cvm_oct_rgmii_netdev_ops = { static const struct net_device_ops cvm_oct_pow_netdev_ops = { .ndo_init = cvm_oct_common_init, .ndo_start_xmit = cvm_oct_xmit_pow, - .ndo_set_multicast_list = cvm_oct_common_set_multicast_list, + .ndo_set_rx_mode = cvm_oct_common_set_multicast_list, .ndo_set_mac_address = cvm_oct_common_set_mac_address, .ndo_do_ioctl = cvm_oct_ioctl, .ndo_change_mtu = cvm_oct_common_change_mtu, |