Commit 2638f713 authored by Aaro Koskinen's avatar Aaro Koskinen Committed by Greg Kroah-Hartman

staging: octeon-ethernet: consolidate carrier notifications

Always use cvm_oct_note_carrier() to avoid copy-pasted code.
Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 36a14572
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include "ethernet-mdio.h" #include "ethernet-mdio.h"
#include "ethernet-util.h" #include "ethernet-util.h"
#include <asm/octeon/cvmx-helper-board.h>
#include <asm/octeon/cvmx-gmxx-defs.h> #include <asm/octeon/cvmx-gmxx-defs.h>
#include <asm/octeon/cvmx-smix-defs.h> #include <asm/octeon/cvmx-smix-defs.h>
...@@ -116,7 +115,7 @@ int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -116,7 +115,7 @@ int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
return phy_mii_ioctl(priv->phydev, rq, cmd); return phy_mii_ioctl(priv->phydev, rq, cmd);
} }
static void cvm_oct_note_carrier(struct octeon_ethernet *priv, void cvm_oct_note_carrier(struct octeon_ethernet *priv,
cvmx_helper_link_info_t li) cvmx_helper_link_info_t li)
{ {
if (li.s.link_up) { if (li.s.link_up) {
......
...@@ -176,23 +176,10 @@ static void cvm_oct_rgmii_poll(struct net_device *dev) ...@@ -176,23 +176,10 @@ static void cvm_oct_rgmii_poll(struct net_device *dev)
if (link_info.s.link_up) { if (link_info.s.link_up) {
if (!netif_carrier_ok(dev)) if (!netif_carrier_ok(dev))
netif_carrier_on(dev); netif_carrier_on(dev);
if (priv->queue != -1) } else if (netif_carrier_ok(dev)) {
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
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); netif_carrier_off(dev);
printk_ratelimited("%s: Link down\n", dev->name);
} }
cvm_oct_note_carrier(priv, link_info);
} }
} }
......
...@@ -55,26 +55,12 @@ static void cvm_oct_sgmii_poll(struct net_device *dev) ...@@ -55,26 +55,12 @@ static void cvm_oct_sgmii_poll(struct net_device *dev)
/* Tell Linux */ /* Tell Linux */
if (link_info.s.link_up) { if (link_info.s.link_up) {
if (!netif_carrier_ok(dev)) if (!netif_carrier_ok(dev))
netif_carrier_on(dev); netif_carrier_on(dev);
if (priv->queue != -1) } else if (netif_carrier_ok(dev)) {
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
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); netif_carrier_off(dev);
printk_ratelimited("%s: Link down\n", dev->name);
} }
cvm_oct_note_carrier(priv, link_info);
} }
int cvm_oct_sgmii_open(struct net_device *dev) int cvm_oct_sgmii_open(struct net_device *dev)
......
...@@ -55,26 +55,12 @@ static void cvm_oct_xaui_poll(struct net_device *dev) ...@@ -55,26 +55,12 @@ static void cvm_oct_xaui_poll(struct net_device *dev)
/* Tell Linux */ /* Tell Linux */
if (link_info.s.link_up) { if (link_info.s.link_up) {
if (!netif_carrier_ok(dev)) if (!netif_carrier_ok(dev))
netif_carrier_on(dev); netif_carrier_on(dev);
if (priv->queue != -1) } else if (netif_carrier_ok(dev)) {
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
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); netif_carrier_off(dev);
printk_ratelimited("%s: Link down\n", dev->name);
} }
cvm_oct_note_carrier(priv, link_info);
} }
int cvm_oct_xaui_open(struct net_device *dev) int cvm_oct_xaui_open(struct net_device *dev)
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#include <linux/of.h> #include <linux/of.h>
#include <asm/octeon/cvmx-helper-board.h>
/** /**
* This is the definition of the Ethernet driver's private * This is the definition of the Ethernet driver's private
* driver state stored in netdev_priv(dev). * driver state stored in netdev_priv(dev).
...@@ -86,6 +88,8 @@ void cvm_oct_adjust_link(struct net_device *dev); ...@@ -86,6 +88,8 @@ void cvm_oct_adjust_link(struct net_device *dev);
int cvm_oct_common_stop(struct net_device *dev); int cvm_oct_common_stop(struct net_device *dev);
int cvm_oct_common_open(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 *), bool poll_now);
void cvm_oct_note_carrier(struct octeon_ethernet *priv,
cvmx_helper_link_info_t li);
extern int always_use_pow; extern int always_use_pow;
extern int pow_send_group; extern int pow_send_group;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment