* [PATCH rfc 1/5] r8169: style cleanups.
From: Francois Romieu @ 2011-04-27 20:36 UTC (permalink / raw)
To: netdev; +Cc: Realtek linux nic maintainers
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
---
drivers/net/r8169.c | 80 +++++++++++++++++++++++---------------------------
1 files changed, 37 insertions(+), 43 deletions(-)
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 025dedd..0bb0c0d 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -346,7 +346,7 @@ enum rtl8168_registers {
#define OCPAR_GPHY_READ_CMD 0x0000f060
RDSAR1 = 0xd0, /* 8168c only. Undocumented on 8168dp */
MISC = 0xf0, /* 8168e only. */
- txpla_rst = (1 << 29)
+#define TXPLA_RST (1 << 29)
};
enum rtl_register_content {
@@ -424,7 +424,7 @@ enum rtl_register_content {
BWF = (1 << 6), /* Accept Broadcast wakeup frame */
MWF = (1 << 5), /* Accept Multicast wakeup frame */
UWF = (1 << 4), /* Accept Unicast wakeup frame */
- spi_en = (1 << 3),
+ Spi_en = (1 << 3),
LanWake = (1 << 1), /* LanWake enable/disable */
PMEStatus = (1 << 0), /* PME status can be reset by PCI RST# */
@@ -731,17 +731,19 @@ static void rtl8168_oob_notify(struct rtl8169_private *tp, u8 cmd)
#define OOB_CMD_DRIVER_START 0x05
#define OOB_CMD_DRIVER_STOP 0x06
+static u16 rtl8168_get_ocp_reg(struct rtl8169_private *tp)
+{
+ return (tp->mac_version == RTL_GIGA_MAC_VER_31) ? 0xb8 : 0x10;
+}
+
static void rtl8168_driver_start(struct rtl8169_private *tp)
{
+ u16 reg;
int i;
- u32 reg;
rtl8168_oob_notify(tp, OOB_CMD_DRIVER_START);
- if (tp->mac_version == RTL_GIGA_MAC_VER_31)
- reg = 0xb8;
- else
- reg = 0x10;
+ reg = rtl8168_get_ocp_reg(tp);
for (i = 0; i < 10; i++) {
msleep(10);
@@ -752,15 +754,12 @@ static void rtl8168_driver_start(struct rtl8169_private *tp)
static void rtl8168_driver_stop(struct rtl8169_private *tp)
{
+ u16 reg;
int i;
- u32 reg;
rtl8168_oob_notify(tp, OOB_CMD_DRIVER_STOP);
- if (tp->mac_version == RTL_GIGA_MAC_VER_31)
- reg = 0xb8;
- else
- reg = 0x10;
+ reg = rtl8168_get_ocp_reg(tp);
for (i = 0; i < 10; i++) {
msleep(10);
@@ -771,17 +770,9 @@ static void rtl8168_driver_stop(struct rtl8169_private *tp)
static int r8168dp_check_dash(struct rtl8169_private *tp)
{
- u32 reg;
-
- if (tp->mac_version == RTL_GIGA_MAC_VER_31)
- reg = 0xb8;
- else
- reg = 0x10;
+ u16 reg = rtl8168_get_ocp_reg(tp);
- if (ocp_read(tp, 0xF, reg) & 0x00008000)
- return 1;
- else
- return 0;
+ return (ocp_read(tp, 0x0f, reg) & 0x00008000) ? 1 : 0;
}
static void r8169_mdio_write(void __iomem *ioaddr, int reg_addr, int value)
@@ -2546,7 +2537,7 @@ static void rtl8168e_hw_phy_config(struct rtl8169_private *tp)
/* For impedance matching */
rtl_writephy(tp, 0x1f, 0x0002);
rtl_w1w0_phy(tp, 0x08, 0x8000, 0x7f00);
- rtl_writephy(tp, 0x1F, 0x0000);
+ rtl_writephy(tp, 0x1f, 0x0000);
/* PHY auto speed down */
rtl_writephy(tp, 0x1f, 0x0007);
@@ -2704,6 +2695,9 @@ static void rtl_hw_phy_config(struct net_device *dev)
case RTL_GIGA_MAC_VER_30:
rtl8105e_hw_phy_config(tp);
break;
+ case RTL_GIGA_MAC_VER_31:
+ /* None. */
+ break;
case RTL_GIGA_MAC_VER_32:
rtl8168e_1_hw_phy_config(tp);
break;
@@ -3134,8 +3128,8 @@ static void r8168_pll_power_down(struct rtl8169_private *tp)
return;
}
- if (tp->mac_version == RTL_GIGA_MAC_VER_32 ||
- tp->mac_version == RTL_GIGA_MAC_VER_33)
+ if ((tp->mac_version == RTL_GIGA_MAC_VER_32) ||
+ (tp->mac_version == RTL_GIGA_MAC_VER_33))
rtl_ephy_write(ioaddr, 0x19, 0xff64);
if (__rtl8169_get_wol(tp) & WAKE_ANY) {
@@ -3652,12 +3646,11 @@ static void rtl8169_hw_reset(struct rtl8169_private *tp)
/* Disable interrupts */
rtl8169_irq_mask_and_ack(ioaddr);
- if (tp->mac_version == RTL_GIGA_MAC_VER_27 ||
- tp->mac_version == RTL_GIGA_MAC_VER_28 ||
- tp->mac_version == RTL_GIGA_MAC_VER_31) {
+ if ((tp->mac_version == RTL_GIGA_MAC_VER_27) ||
+ (tp->mac_version == RTL_GIGA_MAC_VER_28) ||
+ (tp->mac_version == RTL_GIGA_MAC_VER_31)) {
while (RTL_R8(TxPoll) & NPQ)
udelay(20);
-
}
/* Reset the chipset */
@@ -4117,10 +4110,10 @@ static void rtl_hw_start_8168e(void __iomem *ioaddr, struct pci_dev *pdev)
rtl_disable_clock_request(pdev);
/* Reset tx FIFO pointer */
- RTL_W32(MISC, RTL_R32(MISC) | txpla_rst);
- RTL_W32(MISC, RTL_R32(MISC) & ~txpla_rst);
+ RTL_W32(MISC, RTL_R32(MISC) | TXPLA_RST);
+ RTL_W32(MISC, RTL_R32(MISC) & ~TXPLA_RST);
- RTL_W8(Config5, RTL_R8(Config5) & ~spi_en);
+ RTL_W8(Config5, RTL_R8(Config5) & ~Spi_en);
}
static void rtl_hw_start_8168(struct net_device *dev)
@@ -4142,8 +4135,8 @@ static void rtl_hw_start_8168(struct net_device *dev)
RTL_W16(IntrMitigate, 0x5151);
/* Work around for RxFIFO overflow. */
- if (tp->mac_version == RTL_GIGA_MAC_VER_11 ||
- tp->mac_version == RTL_GIGA_MAC_VER_22) {
+ if ((tp->mac_version == RTL_GIGA_MAC_VER_11) ||
+ (tp->mac_version == RTL_GIGA_MAC_VER_22)) {
tp->intr_event |= RxFIFOOver | PCSTimeout;
tp->intr_event &= ~RxOverflow;
}
@@ -4204,6 +4197,7 @@ static void rtl_hw_start_8168(struct net_device *dev)
case RTL_GIGA_MAC_VER_28:
rtl_hw_start_8168d_4(ioaddr, pdev);
break;
+
case RTL_GIGA_MAC_VER_31:
rtl_hw_start_8168dp(ioaddr, pdev);
break;
@@ -5414,15 +5408,15 @@ static int rtl8169_runtime_idle(struct device *device)
}
static const struct dev_pm_ops rtl8169_pm_ops = {
- .suspend = rtl8169_suspend,
- .resume = rtl8169_resume,
- .freeze = rtl8169_suspend,
- .thaw = rtl8169_resume,
- .poweroff = rtl8169_suspend,
- .restore = rtl8169_resume,
- .runtime_suspend = rtl8169_runtime_suspend,
- .runtime_resume = rtl8169_runtime_resume,
- .runtime_idle = rtl8169_runtime_idle,
+ .suspend = rtl8169_suspend,
+ .resume = rtl8169_resume,
+ .freeze = rtl8169_suspend,
+ .thaw = rtl8169_resume,
+ .poweroff = rtl8169_suspend,
+ .restore = rtl8169_resume,
+ .runtime_suspend = rtl8169_runtime_suspend,
+ .runtime_resume = rtl8169_runtime_resume,
+ .runtime_idle = rtl8169_runtime_idle,
};
#define RTL8169_PM_OPS (&rtl8169_pm_ops)
--
1.7.4.4
^ permalink raw reply related
* Re: r8169 : always copying the rx buffer to new skb
From: Francois Romieu @ 2011-04-27 20:35 UTC (permalink / raw)
To: John Lumby; +Cc: netdev, Ben Hutchings, nic_swsd
In-Reply-To: <4DB77D03.9070507@hotmail.com>
John Lumby <johnlumby@hotmail.com> :
> Anyone have any further thoughts on the proposal to avoid
> memcpy'ing? (see earlier post)
The patch mixes different changes. Please avoid it.
Your MUA damaged the patch. Documentation/SubmittingPatches
could help if you have not read it yet.
The patch makes some gratuitous changes which needlessly
increase the differences (dirty_xy rename for instance).
A set_ringparam() method which does nothing until open()
is used does not exactly ring like "least surprize behavior"
to me.
The behavior under memory pressure is still unknown.
I am mildly convinced by the implementation.
--
Ueimor
^ permalink raw reply
* Re: rtl8169 related kernel splat in 2.6.38.4
From: Francois Romieu @ 2011-04-27 20:34 UTC (permalink / raw)
To: Ben Greear; +Cc: netdev
In-Reply-To: <4DB7413A.1020208@candelatech.com>
Ben Greear <greearb@candelatech.com> :
[...]
> WARNING: at /home/greearb/git/linux-2.6.dev.38.y/kernel/timer.c:983 del_timer_sync+0x25/0x37()
[...]
> [<c043094b>] ? warn_slowpath_common+0x65/0x7a
> [<c04398a0>] ? del_timer_sync+0x25/0x37
> [<c043096f>] ? warn_slowpath_null+0xf/0x13
> [<c04398a0>] ? del_timer_sync+0x25/0x37
> [<c06e94f3>] ? linkwatch_schedule_work+0x68/0x83
> [<c06e95b6>] ? linkwatch_fire_event+0xa8/0xad
> [<c06ef193>] ? netif_carrier_on+0x23/0x34
> [<f8af1b32>] ? __rtl8169_check_link_status+0x4f/0xaf [r8169]
linkwatch_schedule_work
-> cancel_delayed_work
-> del_timer_sync
-> *466bd3030973910118ca601da8072be97a1e2209 was here*
At first sight it should happen in -git too. I'll search a fix
back home.
--
Ueimor
^ permalink raw reply
* [PATCH net-next] r8169: fix merge conflict fix.
From: Francois Romieu @ 2011-04-27 20:36 UTC (permalink / raw)
To: David Miller
Cc: sfr, netdev, linux-next, linux-kernel,
Realtek linux nic maintainers
- use adequate MAC_VER id
(see 01dc7fec4025f6bb72b6b98ec88b375346b6dbbb)
- remove duplicate rtl_firmware_info record
- remove duplicate functions
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
---
drivers/net/r8169.c | 25 +++++--------------------
1 files changed, 5 insertions(+), 20 deletions(-)
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 025dedd..6364e0b 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -191,9 +191,8 @@ static const struct rtl_firmware_info {
{ .mac_version = RTL_GIGA_MAC_VER_26, .fw_name = FIRMWARE_8168D_2 },
{ .mac_version = RTL_GIGA_MAC_VER_29, .fw_name = FIRMWARE_8105E_1 },
{ .mac_version = RTL_GIGA_MAC_VER_30, .fw_name = FIRMWARE_8105E_1 },
- { .mac_version = RTL_GIGA_MAC_VER_30, .fw_name = FIRMWARE_8105E_1 },
- { .mac_version = RTL_GIGA_MAC_VER_31, .fw_name = FIRMWARE_8168E_1 },
- { .mac_version = RTL_GIGA_MAC_VER_32, .fw_name = FIRMWARE_8168E_2 }
+ { .mac_version = RTL_GIGA_MAC_VER_32, .fw_name = FIRMWARE_8168E_1 },
+ { .mac_version = RTL_GIGA_MAC_VER_33, .fw_name = FIRMWARE_8168E_2 }
};
enum cfg_version {
@@ -2535,6 +2534,8 @@ static void rtl8168e_hw_phy_config(struct rtl8169_private *tp)
{ 0x1f, 0x0000 }
};
+ rtl_apply_firmware(tp);
+
rtl_writephy_batch(tp, phy_reg_init, ARRAY_SIZE(phy_reg_init));
/* DCO enable for 10M IDLE Power */
@@ -2576,20 +2577,6 @@ static void rtl8168e_hw_phy_config(struct rtl8169_private *tp)
rtl_writephy(tp, 0x0d, 0x0000);
}
-static void rtl8168e_1_hw_phy_config(struct rtl8169_private *tp)
-{
- rtl_apply_firmware(tp);
-
- rtl8168e_hw_phy_config(tp);
-}
-
-static void rtl8168e_2_hw_phy_config(struct rtl8169_private *tp)
-{
- rtl_apply_firmware(tp);
-
- rtl8168e_hw_phy_config(tp);
-}
-
static void rtl8102e_hw_phy_config(struct rtl8169_private *tp)
{
static const struct phy_reg phy_reg_init[] = {
@@ -2705,10 +2692,8 @@ static void rtl_hw_phy_config(struct net_device *dev)
rtl8105e_hw_phy_config(tp);
break;
case RTL_GIGA_MAC_VER_32:
- rtl8168e_1_hw_phy_config(tp);
- break;
case RTL_GIGA_MAC_VER_33:
- rtl8168e_2_hw_phy_config(tp);
+ rtl8168e_hw_phy_config(tp);
break;
default:
--
1.7.4.4
^ permalink raw reply related
* Re: [PATCH net-next-2.6 0/5 v2] SCTP updates for net-next-2.6
From: David Miller @ 2011-04-27 20:20 UTC (permalink / raw)
To: yjwei; +Cc: netdev, linux-sctp
In-Reply-To: <4DB7C73D.3000406@cn.fujitsu.com>
From: Wei Yongjun <yjwei@cn.fujitsu.com>
Date: Wed, 27 Apr 2011 15:35:25 +0800
> Hi David
>
> Here is a set of SCTP patches for net-next-2.6, the last part
> from vlad's lksctp-dev tree, update SCTP IPv6 routing and IPSec
> issues. Please apply.
>
> Changelog:
> - redo the intermediate builds test and function test.
> - remove useless ->dst_saddr member of sctp_pf
> - merge some fix for original patch
Applied, thanks!
^ permalink raw reply
* Re: Linux TCP's Robustness to Multipath Packet Reordering
From: Dominik Kaspar @ 2011-04-27 19:56 UTC (permalink / raw)
To: Yuchung Cheng
Cc: Carsten Wolff, John Heffner, Eric Dumazet, netdev,
Zimmermann Alexander, Lennart Schulte, Arnd Hannemann
In-Reply-To: <BANLkTi=i5ZftuL++ORuy=n_yM_futWYoZw@mail.gmail.com>
Hi Yuchung,
Yes, FACK was enabled (as it is by default), but as Alexander already
pointed out, it should be disabled automatically when TCP detects
reordering.
However, I am not so sure how well this automatic turning off FACK is
done by Linux... I see a tendency that in situations with persistent
packet reordering, TCP with FACK enabled gets a lower performance than
if FACK is disabled right from the beginning of a connection.
Greetings,
Dominik
On Wed, Apr 27, 2011 at 7:39 PM, Yuchung Cheng <ycheng@google.com> wrote:
> Hi Dominik,
>
> On Wed, Apr 27, 2011 at 9:22 AM, Dominik Kaspar <dokaspar.ietf@gmail.com> wrote:
>>
>> Hi Carsten,
>>
>> Thanks for your feedback. I made some new tests with the same setup of
>> packet-based forwarding over two emulated paths (600 KB/s, 10 ms) +
>> (400 KB/s, 100 ms). In the first experiments, which showed a step-wise
>> adaptation to reordering, SACK, DSACK, and Timestamps were all
>> enabled. In the experiments, I individually disabled these three
>> mechanisms and saw the following:
>>
>> - Disabling timestamps causes TCP to never adjust to reordering at all.
>> - Disabling SACK allows TCP to adapt very rapidly ("perfect" aggregation!).
>
> Did you enable tcp_fack when sack is enabled? this may make a (big)
> difference. FACK assumes little network reordering and mark packet
> losses more aggressively.
>
>> - Disabling DSACK has no obvious impact (still a step-wise throughput).
>>
>> Is there an explanation for why turning off SACK can be beneficial in
>> the presence of packet reordering? That sounds pretty
>> counter-intuitive to me... I thought SACK=1 always performs better
>> than SACK=0. The results are also illustrated in the following plot.
>> For each setting, there are three runs, which all exhibit a similar
>> behavior:
>>
>> http://home.simula.no/~kaspar/static/mptcp-emu-wlan-hspa-02-sack.png
>>
>> Greetings,
>> Dominik
>>
>> On Wed, Apr 27, 2011 at 11:57 AM, Carsten Wolff <carsten@wolffcarsten.de> wrote:
>> > Hi all,
>> >
>> > On Tuesday 26 April 2011, John Heffner wrote:
>> >> First, TCP is definitely not designed to work under such conditions.
>> >> For example, assumptions behind RTO calculation and fast retransmit
>> >> heuristics are violated. However, in this particular case my first
>> >> guess is that you are being limited by "cwnd moderation," which was
>> >> the topic of recent discussion here. Under persistent reordering,
>> >> cwnd moderation can inhibit the ability of cwnd to grow.
>> >
>> > it's not just cwnd moderation (of which I'm still in favor, even though I lost
>> > the argument by inactivity ;-)).
>> >
>> > Anyway, there are a lot of things in reordering handling that can be improved.
>> > Our group (Alexander, Lennart, Arnd, myself and others) has worked on the
>> > problem for a long time now. This work resulted in an algorithm that is in
>> > large parts TCP-NCR (RFC4653), but also utilizes information gathered by
>> > reordering detection for determination of a good DupThresh, fixes a few
>> > problems in RFC4653 and improves on the reordering detection in Linux when the
>> > connection has no timestamps option. We implemented "pure" TCP-NCR and our own
>> > variant in Linux using a modular framework similar to the congestion control
>> > modules. A lot of measurements and evaluation have gone into the comparison of
>> > the three algorithms. We are now very close(TM) to a final patch, that is more
>> > suited for publication on this list and integrates our algorithm into tcp*.
>> > [hc] without introducing the overhead of that modular framework.
>> >
>> > Greetings,
>> > Carsten
>> >
>> --
>> To unsubscribe from this list: send the line "unsubscribe netdev" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* [PATCH] usbnet: add support for some Huawei modems with cdc-ether ports
From: Dan Williams @ 2011-04-27 19:54 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: Oliver Neukum, linux-usb-u79uwXL29TY76Z2rM5mHXA
Some newer Huawei devices (T-Mobile Rocket, others) have cdc-ether
compatible ports, so recognize and expose them.
Signed-off-by: Dan Williams <dcbw-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
--- a/drivers/net/usb/cdc_ether.c 2011-04-25 13:49:56.928255316 -0500
+++ b/drivers/net/usb/cdc_ether.c 2011-04-25 13:50:05.487148317 -0500
@@ -458,7 +458,7 @@
.manage_power = cdc_manage_power,
};
-static const struct driver_info mbm_info = {
+static const struct driver_info wwan_info = {
.description = "Mobile Broadband Network Device",
.flags = FLAG_WWAN,
.bind = cdc_bind,
@@ -469,6 +469,7 @@
/*-------------------------------------------------------------------------*/
+#define HUAWEI_VENDOR_ID 0x12D1
static const struct usb_device_id products [] = {
/*
@@ -578,8 +579,17 @@
}, {
USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MDLM,
USB_CDC_PROTO_NONE),
- .driver_info = (unsigned long)&mbm_info,
+ .driver_info = (unsigned long)&wwan_info,
+}, {
+ /* Various Huawei modems with a network port like the UMG1831 */
+ .match_flags = USB_DEVICE_ID_MATCH_VENDOR
+ | USB_DEVICE_ID_MATCH_INT_INFO,
+ .idVendor = HUAWEI_VENDOR_ID,
+ .bInterfaceClass = USB_CLASS_COMM,
+ .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET,
+ .bInterfaceProtocol = 255,
+ .driver_info = (unsigned long)&wwan_info,
},
{ }, // END
};
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCHv2 4/4] ethtool: cosmetic: Use ethtool ethtool_cmd_speed API
From: Ben Hutchings @ 2011-04-27 19:43 UTC (permalink / raw)
To: David Decotigny
Cc: David S. Miller, mirq-linux, Stanislaw Gruszka, Alexander Duyck,
Eilon Greenstein, linux-kernel, netdev
In-Reply-To: <1303929290-21037-5-git-send-email-decot@google.com>
On Wed, 2011-04-27 at 11:34 -0700, David Decotigny wrote:
> This updates the network drivers so that they don't access the
> ethtool_cmd::speed field directly, but use ethtoo_cmd_speed() instead.
>
> For most of the drivers, these changes are purely cosmetic and don't
> fix any problem, such as for those 1GbE/10GbE drivers that indirectly
> call their own ethtool get_settings()/mii_ethtool_gset(). The changes
> are meant to enforce code consistency and provide robustness with
> future larger throughputs, at the expense of a few CPU cycles for each
> ethtool operation.
>
> All the drivers compiled with make allyesconfig ion x86_64 have been
> updated.
>
> Tested: make allyesconfig on x86_64 + e1000e/bnx2x work
> Signed-off-by: David Decotigny <decot@google.com>
[...]
> --- a/drivers/net/mdio.c
> +++ b/drivers/net/mdio.c
> @@ -290,33 +290,36 @@ void mdio45_ethtool_gset_npage(const struct mdio_if_info *mdio,
> if (modes & (ADVERTISED_10000baseT_Full |
> ADVERTISED_10000baseKX4_Full |
> ADVERTISED_10000baseKR_Full)) {
> - ecmd->speed = SPEED_10000;
> + ethtool_cmd_speed_set(ecmd, SPEED_10000);
> ecmd->duplex = DUPLEX_FULL;
> } else if (modes & (ADVERTISED_1000baseT_Full |
> ADVERTISED_1000baseT_Half |
> ADVERTISED_1000baseKX_Full)) {
> - ecmd->speed = SPEED_1000;
> + ethtool_cmd_speed_set(ecmd, SPEED_1000);
> ecmd->duplex = !(modes & ADVERTISED_1000baseT_Half);
> } else if (modes & (ADVERTISED_100baseT_Full |
> ADVERTISED_100baseT_Half)) {
> - ecmd->speed = SPEED_100;
> + ethtool_cmd_speed_set(ecmd, SPEED_100);
> ecmd->duplex = !!(modes & ADVERTISED_100baseT_Full);
> } else {
> - ecmd->speed = SPEED_10;
> + ethtool_cmd_speed_set(ecmd, SPEED_10);
> ecmd->duplex = !!(modes & ADVERTISED_10baseT_Full);
> }
> } else {
> /* Report forced settings */
> + u32 speed;
> reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD,
> MDIO_CTRL1);
> - ecmd->speed = (((reg & MDIO_PMA_CTRL1_SPEED1000) ? 100 : 1) *
> - ((reg & MDIO_PMA_CTRL1_SPEED100) ? 100 : 10));
> + speed = (((reg & MDIO_PMA_CTRL1_SPEED1000) ? 100 : 1)
> + * ((reg & MDIO_PMA_CTRL1_SPEED100) ? 100 : 10));
> ecmd->duplex = (reg & MDIO_CTRL1_FULLDPLX ||
> - ecmd->speed == SPEED_10000);
> + speed == SPEED_10000);
> + ethtool_cmd_speed_set(ecmd, speed);
> }
>
> /* 10GBASE-T MDI/MDI-X */
> - if (ecmd->port == PORT_TP && ecmd->speed == SPEED_10000) {
> + if (ecmd->port == PORT_TP
> + && (ethtool_cmd_speed(ecmd) == SPEED_10000)) {
> switch (mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD,
> MDIO_PMA_10GBT_SWAPPOL)) {
> case MDIO_PMA_10GBT_SWAPPOL_ABNX | MDIO_PMA_10GBT_SWAPPOL_CDNX:
It seems like the scope of speed should be the whole function. Then you
could just have one call to ethtool_cmd_speed_set() after the
'if (ecmd->autoneg) ... else ...' statement, and no need to use
ethtool_cmd_speed().
[...]
> --- a/drivers/net/tulip/de2104x.c
> +++ b/drivers/net/tulip/de2104x.c
> @@ -1518,15 +1518,15 @@ static int __de_get_settings(struct de_private *de, struct ethtool_cmd *ecmd)
> switch (de->media_type) {
> case DE_MEDIA_AUI:
> ecmd->port = PORT_AUI;
> - ecmd->speed = 5;
> + ethtool_cmd_speed_set(ecmd, 5);
> break;
> case DE_MEDIA_BNC:
> ecmd->port = PORT_BNC;
> - ecmd->speed = 2;
> + ethtool_cmd_speed_set(ecmd, 2);
> break;
> default:
> ecmd->port = PORT_TP;
> - ecmd->speed = SPEED_10;
> + ethtool_cmd_speed_set(ecmd, SPEED_10);
> break;
> }
[...]
As I commented on the previous patch, this should always report a speed
of 10.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [PATCHv2 3/4] ethtool: Use the full 32 bit speed range in ethtool's set_settings
From: Ben Hutchings @ 2011-04-27 19:27 UTC (permalink / raw)
To: David Decotigny
Cc: David S. Miller, mirq-linux, Stanislaw Gruszka, Alexander Duyck,
Eilon Greenstein, linux-kernel, netdev
In-Reply-To: <1303929290-21037-4-git-send-email-decot@google.com>
On Wed, 2011-04-27 at 11:34 -0700, David Decotigny wrote:
> This makes sure the ethtool's set_settings() callback of network
> drivers don't ignore the 16 most significant bits when ethtool calls
> their set_settings().
>
> All the driver compiled with make allyesconfig on x86_64 have been
> updated.
>
> Signed-off-by: David Decotigny <decot@google.com>
[...]
> --- a/drivers/net/cxgb4/cxgb4_main.c
> +++ b/drivers/net/cxgb4/cxgb4_main.c
> @@ -1460,6 +1460,7 @@ static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
> unsigned int cap;
> struct port_info *p = netdev_priv(dev);
> struct link_config *lc = &p->link_cfg;
> + u32 speed = ethtool_cmd_speed(cmd);
>
> if (cmd->duplex != DUPLEX_FULL) /* only full-duplex supported */
> return -EINVAL;
> @@ -1470,16 +1471,16 @@ static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
> * being requested.
> */
> if (cmd->autoneg == AUTONEG_DISABLE &&
> - (lc->supported & speed_to_caps(cmd->speed)))
> - return 0;
> + (lc->supported & speed_to_caps(speed)))
> + return 0;
> return -EINVAL;
> }
>
> if (cmd->autoneg == AUTONEG_DISABLE) {
> - cap = speed_to_caps(cmd->speed);
> + cap = speed_to_caps(speed);
>
> - if (!(lc->supported & cap) || cmd->speed == SPEED_1000 ||
> - cmd->speed == SPEED_10000)
> + if (!(lc->supported & cap) || (speed == SPEED_1000) ||
> + (ethtool_cmd_speed(cmd) == SPEED_10000))
This second call to ethtool_cmd_speed() is unnecessary.
[...]
> diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
> index c05db60..ed3cb6a 100644
> --- a/drivers/net/dl2k.c
> +++ b/drivers/net/dl2k.c
> @@ -1219,31 +1219,26 @@ static int rio_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
> } else {
> np->an_enable = 0;
> if (np->speed == 1000) {
> - cmd->speed = SPEED_100;
> + ethtool_cmd_speed_set(cmd, SPEED_100);
> cmd->duplex = DUPLEX_FULL;
> printk("Warning!! Can't disable Auto negotiation in 1000Mbps, change to Manual 100Mbps, Full duplex.\n");
Ugh, this is totally bogus. You don't have to fix it but it should
really be removed.
> }
> - switch(cmd->speed + cmd->duplex) {
> + switch (ethtool_cmd_speed(cmd)) {
>
> - case SPEED_10 + DUPLEX_HALF:
> + case SPEED_10:
> np->speed = 10;
> - np->full_duplex = 0;
> + np->full_duplex = (cmd->duplex == DUPLEX_FULL) ? 1 : 0;
The '==' operator already yields 1 or 0, so don't use ?: as well.
> break;
>
> - case SPEED_10 + DUPLEX_FULL:
> - np->speed = 10;
> - np->full_duplex = 1;
> - break;
> - case SPEED_100 + DUPLEX_HALF:
> + case SPEED_100:
> np->speed = 100;
> - np->full_duplex = 0;
> + np->full_duplex = (cmd->duplex == DUPLEX_FULL) ? 1 : 0;
> break;
> - case SPEED_100 + DUPLEX_FULL:
> - np->speed = 100;
> - np->full_duplex = 1;
> +
> + case SPEED_1000:
> + /* handled above */
No it isn't; you're confusing cmd->speed and np-speed. This should fall
through to the default case (or simply be removed).
[...]
> diff --git a/drivers/net/ksz884x.c b/drivers/net/ksz884x.c
> index 2c37a38..66037b1 100644
> --- a/drivers/net/ksz884x.c
> +++ b/drivers/net/ksz884x.c
> @@ -5998,6 +5998,7 @@ static int netdev_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
> struct dev_priv *priv = netdev_priv(dev);
> struct dev_info *hw_priv = priv->adapter;
> struct ksz_port *port = &priv->port;
> + u32 speed = ethtool_cmd_speed(cmd);
> int rc;
>
> /*
> @@ -6006,11 +6007,11 @@ static int netdev_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
> */
> if (cmd->autoneg && priv->advertising == cmd->advertising) {
> cmd->advertising |= ADVERTISED_ALL;
> - if (10 == cmd->speed)
> + if (SPEED_10 == speed)
> cmd->advertising &=
> ~(ADVERTISED_100baseT_Full |
> ADVERTISED_100baseT_Half);
> - else if (100 == cmd->speed)
> + else if (SPEED_100 == speed)
> cmd->advertising &=
> ~(ADVERTISED_10baseT_Full |
> ADVERTISED_10baseT_Half);
> @@ -6032,8 +6033,8 @@ static int netdev_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
> port->force_link = 0;
> } else {
> port->duplex = cmd->duplex + 1;
> - if (cmd->speed != 1000)
> - port->speed = cmd->speed;
> + if (speed != SPEED_1000)
> + port->speed = speed;
> if (cmd->autoneg)
> port->force_link = 0;
> else
There's no good reason for the SPEED macros, so please don't add uses.
[...]
> diff --git a/drivers/net/pch_gbe/pch_gbe_ethtool.c b/drivers/net/pch_gbe/pch_gbe_ethtool.c
> index c35d105..98587dc 100644
> --- a/drivers/net/pch_gbe/pch_gbe_ethtool.c
> +++ b/drivers/net/pch_gbe/pch_gbe_ethtool.c
> @@ -109,12 +109,13 @@ static int pch_gbe_set_settings(struct net_device *netdev,
> {
> struct pch_gbe_adapter *adapter = netdev_priv(netdev);
> struct pch_gbe_hw *hw = &adapter->hw;
> + u32 speed = ethtool_cmd_speed(ecmd);
> int ret;
>
> pch_gbe_hal_write_phy_reg(hw, MII_BMCR, BMCR_RESET);
>
> - if (ecmd->speed == USHRT_MAX) {
> - ecmd->speed = SPEED_1000;
> + if (speed == USHRT_MAX) {
When the link is down, the driver reports speed = -1 (which is dumb, but
sadly common practice). If the user changes some other setting but not
speed, then the driver will see speed == USHRT_MAX here, and this is
meant to allow for that.
This is fine so far, but your next change is going to break this because
the driver will set the high 16 bits of speed and then it will see speed
== UINT_MAX here.
[...]
> diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
> index b13c6b0..f8d26bf 100644
> --- a/drivers/net/tulip/de2104x.c
> +++ b/drivers/net/tulip/de2104x.c
> @@ -1549,10 +1549,11 @@ static int __de_set_settings(struct de_private *de, struct ethtool_cmd *ecmd)
> {
> u32 new_media;
> unsigned int media_lock;
> + u32 speed = ethtool_cmd_speed(ecmd);
>
> - if (ecmd->speed != SPEED_10 && ecmd->speed != 5 && ecmd->speed != 2)
> + if (speed != SPEED_10 && speed != 5 && speed != 2)
> return -EINVAL;
> - if (de->de21040 && ecmd->speed == 2)
> + if (de->de21040 && speed == 2)
> return -EINVAL;
> if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL)
> return -EINVAL;
[...]
This implementation is absolute crap - it's using speed values as
mnemonics for different physical ports! Please change it to report and
accept only speed = 10. (Both get_settings and set_settings have to be
changed at the same time.)
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [net-next-2.6 00/12][pull request] Intel Wired LAN Driver Update
From: David Miller @ 2011-04-27 19:13 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: netdev, gospo, bphilips
In-Reply-To: <1303896891-16006-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Wed, 27 Apr 2011 02:34:39 -0700
> The following series contains updates to e1000e and ixgbe.
>
> - e1000e: convert to new set_phys_id interface
>
> - ixgbe: several cleanups and fixes, as well as the conversion
> to the new set_phys_id interface and driver version bump.
>
> The following are changes since commit 2bd93d7af1581d40e3c4b25242472661cb7c637a:
> Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
> and are available in the git repository at:
> master.kernel.org:/pub/scm/linux/kernel/git/jkirsher/net-next-2.6 master
Pulled, thanks Jeff.
^ permalink raw reply
* Re: [PATCHv2 2/4] ethtool: Call ethtool's get/set_settings callbacks with cleaned data
From: Ben Hutchings @ 2011-04-27 18:53 UTC (permalink / raw)
To: David Decotigny
Cc: David S. Miller, mirq-linux, Stanislaw Gruszka, Alexander Duyck,
Eilon Greenstein, linux-kernel, netdev
In-Reply-To: <1303929290-21037-3-git-send-email-decot@google.com>
On Wed, 2011-04-27 at 11:34 -0700, David Decotigny wrote:
> This makes sure that when a driver calls the ethtool's
> get/set_settings() callback of another driver, the data passed to it
> is clean. This guarantees that speed_hi will be zeroed correctly if
> the called callback doesn't explicitely set it: we are sure we don't
> get a corrupted speed from the underlying driver. We also take care of
> setting the cmd field appropriately (ETHTOOL_GSET/SSET).
>
> This applies to dev_ethtool_get_settings(), which now makes sure it
> sets up that ethtool command parameter correctly before passing it to
> drivers. This also means that whoever calls dev_ethtool_get_settings()
> does not have to clean the ethtool command parameter. This function
> also becomes an exported symbol instead of an inline.
>
> All drivers visible to make allyesconfig under x86_64 have been
> updated.
>
> Signed-off-by: David Decotigny <decot@google.com>
[...]
> diff --git a/drivers/net/mdio.c b/drivers/net/mdio.c
> index e85bf04..2e717a2 100644
> --- a/drivers/net/mdio.c
> +++ b/drivers/net/mdio.c
> @@ -176,6 +176,9 @@ static u32 mdio45_get_an(const struct mdio_if_info *mdio, u16 addr)
> * @npage_adv: Modes currently advertised on next pages
> * @npage_lpa: Modes advertised by link partner on next pages
> *
> + * The @ecmd parameter is expected to have been cleared before calling
> + * mii_ethtool_gset().
Copy-pasta: should say mdio45_get_an() not mii_ethtool_gset().
[...]
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 3bbb4c2..36e57fb 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -4496,6 +4496,30 @@ void dev_set_rx_mode(struct net_device *dev)
> }
>
> /**
> + * dev_ethtool_get_settings - call device's ethtool::get_settings()
> + * @dev: device
> + * @cmd: memory area for ethtool_cmd::get_settings() result
> + *
> + * The cmd arg is initialized properly (cleared and
> + * ethtoo_cmd::cmd field set to ETHTOOL_GSET).
Typo: 'ethtoo_cmd' should be 'ethtool_cmd'.
> + * Return device's ethtool_cmd::get_settings() result value or
> + * -EOPNOTSUPP when device doesn't expose
> + * ethtool_cmd::get_settings() operation.
[...]
The operation is ethtool_ops::get_settings, not ethtool::get_settings or
ethtool_cmd::get_settings.
Other than that, this looks fine.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* RE: [PATCH] [RFC] davinci_emac: don't WARN_ON cpdma_chan_submit -ENOMEM
From: Nori, Sekhar @ 2011-04-27 18:48 UTC (permalink / raw)
To: Ben Gardiner, netdev@vger.kernel.org
Cc: Govindarajan, Sriramakrishnan,
davinci-linux-open-source@linux.davincidsp.com,
davem@davemloft.net
In-Reply-To: <1303407032-7526-1-git-send-email-bengardiner@nanometrics.ca>
Hi Ben,
[CCing netdev maintainer]
On Thu, Apr 21, 2011 at 23:00:32, Ben Gardiner wrote:
> The current implementation of emac_rx_handler, when the host is
> flooded, will result in a great deal of WARNs on the console; due to
> the return value of cpdma_chan_submit. This function can error with
> EINVAL and ENOMEM; the former when the channel is in an invalid
> state, in which case the caller is in error. The latter when a cpdma
> descriptor cannot be allocated.
>
> When flooded, cpdma_chan_submit will return -ENOMEM;
> treat the inability to allocate a cpdma descriptor as an rx error
> similar in behaviour to when emac_rx_alloc returns NULL.
>
> No Signed-off-by yet; not complete fix (see below).
> CC: Sriramakrishnan A G <srk@ti.com>
>
> ---
> I'm new to network drivers -- and kernel development, really. I'd be
> happy to receive feedback on this approach of resolving the -ENOMEM
> when flooded. Is there a more conventional approach? Shoud these frames
> be recorded as 'dropped'?
Yes, that seems to be the right approach. You can look at
8139too.c as an example. dev.stats.rx_dropped is incremented
in this case.
The same stat needs to be incremented when emac_rx_alloc() fails.
>
> Testing was performed on da850evm both with and without "net:
> davinci_emac: fix spinlock bug with dma channel cleanup" from
> Sriramakrishnan A G applied. The behaviour was the same: the emac is
> not able to receive any frames after being flooded -- but it can still
> send. I would appreciate any insight into the potential causes of the
> lockup.
This is most likely due to the Rx channel hitting an
"End-of-Queue (EOQ)" and the driver failing to restart the
DMA on the channel by reprogramming the "Head Descriptor
Pointer (HDP)". You can verify that the HDP is indeed
NULL for Rx channel 0 (the channel used for Rx in the
driver).
I can see that there is logic in place to restart the
DMA when EOQ is hit in __cpdma_chan_submit(), but there
could be some corner case lurking somewhere.
>
> Best Regards,
> Ben Gardiner
>
> Nanometrics Inc.
> http://www.nanometrics.ca
>
> ---
> drivers/net/davinci_emac.c | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
> index 7018bfe..17c48d6 100644
> --- a/drivers/net/davinci_emac.c
> +++ b/drivers/net/davinci_emac.c
> @@ -1037,8 +1037,12 @@ static void emac_rx_handler(void *token, int len, int status)
> recycle:
> ret = cpdma_chan_submit(priv->rxchan, skb, skb->data,
> skb_tailroom(skb), GFP_KERNEL);
> - if (WARN_ON(ret < 0))
> + WARN_ON(ret == -EINVAL);
I think we are better off shifting the WARN_ON to cpdma_chan_submit()
itself. Let that function decide which errors to warn on and which
ones to be just silent on.
> + if (ret < 0) {
> + if (netif_msg_rx_err(priv) && net_ratelimit())
> + dev_err(emac_dev, "failed cpdma submit\n");
Or rather drop the WARN_ON() altogether since you are anyway
printing this rate limited error message.
Thanks,
Sekhar
> dev_kfree_skb_any(skb);
> + }
> }
>
> static void emac_tx_handler(void *token, int len, int status)
> --
> 1.7.1
>
> _______________________________________________
> Davinci-linux-open-source mailing list
> Davinci-linux-open-source@linux.davincidsp.com
> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
>
^ permalink raw reply
* Re: [PATCH] tcp: disallow bind() to reuse addr/port
From: George B. @ 2011-04-27 18:45 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev
In-Reply-To: <1303927352.3166.125.camel@edumazet-laptop>
> It causes known regressions for programs that expect to be able to use
> SO_REUSEADDR to shutdown a socket, then successfully rebind another
> socket to the same ID.
>
> Programs such as haproxy and amavisd expect this to work.
>
> This should fix kernel bugzilla 32832.
Thank you very much for the clarification. It just seems on the
surface like it should be a simple problem (don't they all, at
first?). Instead of checking to see if we have more than the number
of ephemeral ports in use globally, see if we have more than that
number in use on the requested IP address. The problem I am having is
if the number of ports in use globally is greater than the number of
configured ephemeral ports, I can't open a socket on a specific source
IP even though that IP has plenty of ports available. It would seem
like a simple bounds checking problem.
Thanks again for taking the time to respond.
George
^ permalink raw reply
* Re: [PATCHv2 1/4] ethtool: cosmetics: enforce const-ness in ethtool_cmd_speed
From: Ben Hutchings @ 2011-04-27 18:41 UTC (permalink / raw)
To: David Decotigny
Cc: David S. Miller, mirq-linux, Stanislaw Gruszka, Alexander Duyck,
Eilon Greenstein, linux-kernel, netdev
In-Reply-To: <1303929290-21037-2-git-send-email-decot@google.com>
On Wed, 2011-04-27 at 11:34 -0700, David Decotigny wrote:
> The 'ep' argument of ethtool_cmd_speed is not altered: advertise it in
> protoype. +Indentation fix. Also add comments to advise using the
> ethtool_cmd_speed API to get/set the link speed.
>
> Signed-off-by: David Decotigny <decot@google.com>
Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* [PATCHv2 4/4] ethtool: cosmetic: Use ethtool ethtool_cmd_speed API
From: David Decotigny @ 2011-04-27 18:34 UTC (permalink / raw)
To: David S. Miller, Ben Hutchings, mirq-linux, Stanislaw Gruszka,
Alexander Duyck <alexander.h.duyc
Cc: David Decotigny
In-Reply-To: <1303001651-4074-1-git-send-email-decot@google.com>
This updates the network drivers so that they don't access the
ethtool_cmd::speed field directly, but use ethtoo_cmd_speed() instead.
For most of the drivers, these changes are purely cosmetic and don't
fix any problem, such as for those 1GbE/10GbE drivers that indirectly
call their own ethtool get_settings()/mii_ethtool_gset(). The changes
are meant to enforce code consistency and provide robustness with
future larger throughputs, at the expense of a few CPU cycles for each
ethtool operation.
All the drivers compiled with make allyesconfig ion x86_64 have been
updated.
Tested: make allyesconfig on x86_64 + e1000e/bnx2x work
Signed-off-by: David Decotigny <decot@google.com>
---
drivers/infiniband/hw/nes/nes_nic.c | 4 ++--
drivers/net/3c509.c | 2 +-
drivers/net/acenic.c | 8 ++++----
drivers/net/arm/etherh.c | 5 +++--
drivers/net/arm/ks8695net.c | 7 ++++---
drivers/net/atl1c/atl1c_ethtool.c | 4 ++--
drivers/net/atl1e/atl1e_ethtool.c | 4 ++--
drivers/net/atlx/atl1.c | 4 ++--
drivers/net/atlx/atl2.c | 4 ++--
drivers/net/b44.c | 6 +++---
drivers/net/bcm63xx_enet.c | 3 ++-
drivers/net/benet/be_ethtool.c | 16 ++++++++--------
drivers/net/bna/bnad_ethtool.c | 4 ++--
drivers/net/bnx2.c | 7 +++----
drivers/net/cassini.c | 25 ++++++++++++-------------
drivers/net/chelsio/cxgb2.c | 4 ++--
drivers/net/cxgb3/cxgb3_main.c | 4 ++--
drivers/net/cxgb4/cxgb4_main.c | 3 ++-
drivers/net/cxgb4vf/cxgb4vf_main.c | 3 ++-
drivers/net/dl2k.c | 4 ++--
drivers/net/e1000/e1000_ethtool.c | 4 ++--
drivers/net/e1000e/ethtool.c | 12 +++++++-----
drivers/net/eepro.c | 2 +-
drivers/net/ehea/ehea_ethtool.c | 23 ++++++++++++++++++-----
drivers/net/enc28j60.c | 2 +-
drivers/net/enic/enic_main.c | 4 ++--
drivers/net/ewrk3.c | 2 +-
drivers/net/forcedeth.c | 14 +++++++++-----
drivers/net/ibmveth.c | 2 +-
drivers/net/igb/igb_ethtool.c | 8 ++++----
drivers/net/igbvf/ethtool.c | 8 ++++----
drivers/net/ixgb/ixgb_ethtool.c | 4 ++--
drivers/net/ixgbe/ixgbe_ethtool.c | 8 ++++----
drivers/net/ixgbevf/ethtool.c | 8 +++++---
drivers/net/mdio.c | 19 +++++++++++--------
drivers/net/mii.c | 15 +++++++++------
drivers/net/mlx4/en_ethtool.c | 4 ++--
drivers/net/mv643xx_eth.c | 6 +++---
drivers/net/myri10ge/myri10ge.c | 2 +-
drivers/net/natsemi.c | 6 +++---
drivers/net/netxen/netxen_nic_ethtool.c | 10 +++++-----
drivers/net/niu.c | 2 +-
drivers/net/ns83820.c | 8 ++++----
drivers/net/pch_gbe/pch_gbe_ethtool.c | 2 +-
drivers/net/pch_gbe/pch_gbe_phy.c | 2 +-
drivers/net/pcmcia/smc91c92_cs.c | 2 +-
drivers/net/phy/phy.c | 2 +-
drivers/net/ps3_gelic_net.c | 8 ++++----
drivers/net/qla3xxx.c | 2 +-
drivers/net/qlcnic/qlcnic_ethtool.c | 8 ++++----
drivers/net/qlge/qlge_ethtool.c | 2 +-
drivers/net/r8169.c | 2 +-
drivers/net/s2io.c | 4 ++--
drivers/net/sc92031.c | 3 ++-
drivers/net/sfc/ethtool.c | 2 +-
drivers/net/sfc/mcdi_phy.c | 2 +-
drivers/net/sfc/tenxpress.c | 2 +-
drivers/net/skge.c | 2 +-
drivers/net/sky2.c | 4 ++--
drivers/net/smc911x.c | 4 ++--
drivers/net/smc91x.c | 4 ++--
drivers/net/spider_net_ethtool.c | 2 +-
drivers/net/sungem.c | 6 +++---
drivers/net/sunhme.c | 13 ++++++-------
drivers/net/tehuti.c | 2 +-
drivers/net/tg3.c | 4 ++--
drivers/net/tulip/de2104x.c | 6 +++---
drivers/net/tulip/uli526x.c | 6 +++---
drivers/net/tun.c | 2 +-
drivers/net/typhoon.c | 2 +-
drivers/net/usb/catc.c | 2 +-
drivers/net/usb/rtl8150.c | 11 ++++++-----
drivers/net/veth.c | 2 +-
drivers/net/via-velocity.c | 11 +++++++----
drivers/net/vmxnet3/vmxnet3_ethtool.c | 4 ++--
drivers/net/vxge/vxge-ethtool.c | 4 ++--
net/batman-adv/soft-interface.c | 2 +-
77 files changed, 232 insertions(+), 198 deletions(-)
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c
index d2e67c4..d3a1c41 100644
--- a/drivers/infiniband/hw/nes/nes_nic.c
+++ b/drivers/infiniband/hw/nes/nes_nic.c
@@ -1493,7 +1493,7 @@ static int nes_netdev_get_settings(struct net_device *netdev, struct ethtool_cmd
et_cmd->maxrxpkt = 511;
if (nesadapter->OneG_Mode) {
- et_cmd->speed = SPEED_1000;
+ ethtool_cmd_speed_set(et_cmd, SPEED_1000);
if (phy_type == NES_PHY_TYPE_PUMA_1G) {
et_cmd->supported = SUPPORTED_1000baseT_Full;
et_cmd->advertising = ADVERTISED_1000baseT_Full;
@@ -1532,7 +1532,7 @@ static int nes_netdev_get_settings(struct net_device *netdev, struct ethtool_cmd
et_cmd->advertising = ADVERTISED_10000baseT_Full;
et_cmd->phy_address = mac_index;
}
- et_cmd->speed = SPEED_10000;
+ ethtool_cmd_speed_set(et_cmd, SPEED_10000);
et_cmd->autoneg = AUTONEG_DISABLE;
return 0;
}
diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c
index cb39ded..5f25889 100644
--- a/drivers/net/3c509.c
+++ b/drivers/net/3c509.c
@@ -1207,7 +1207,7 @@ el3_netdev_get_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
ecmd->duplex = DUPLEX_FULL;
}
- ecmd->speed = SPEED_10;
+ ethtool_cmd_speed_set(ecmd, SPEED_10);
EL3WINDOW(1);
return 0;
}
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c
index 0b4d8d1..a579899 100644
--- a/drivers/net/acenic.c
+++ b/drivers/net/acenic.c
@@ -2658,15 +2658,15 @@ static int ace_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
link = readl(®s->GigLnkState);
if (link & LNK_1000MB)
- ecmd->speed = SPEED_1000;
+ ethtool_cmd_speed_set(ecmd, SPEED_1000);
else {
link = readl(®s->FastLnkState);
if (link & LNK_100MB)
- ecmd->speed = SPEED_100;
+ ethtool_cmd_speed_set(ecmd, SPEED_100);
else if (link & LNK_10MB)
- ecmd->speed = SPEED_10;
+ ethtool_cmd_speed_set(ecmd, SPEED_10);
else
- ecmd->speed = 0;
+ ethtool_cmd_speed_set(ecmd, 0);
}
if (link & LNK_FULL_DUPLEX)
ecmd->duplex = DUPLEX_FULL;
diff --git a/drivers/net/arm/etherh.c b/drivers/net/arm/etherh.c
index 4af235d..e252cd5 100644
--- a/drivers/net/arm/etherh.c
+++ b/drivers/net/arm/etherh.c
@@ -591,10 +591,11 @@ static void etherh_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *i
static int etherh_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
cmd->supported = etherh_priv(dev)->supported;
- cmd->speed = SPEED_10;
+ ethtool_cmd_speed_set(cmd, SPEED_10);
cmd->duplex = DUPLEX_HALF;
cmd->port = dev->if_port == IF_PORT_10BASET ? PORT_TP : PORT_BNC;
- cmd->autoneg = dev->flags & IFF_AUTOMEDIA ? AUTONEG_ENABLE : AUTONEG_DISABLE;
+ cmd->autoneg = (dev->flags & IFF_AUTOMEDIA ?
+ AUTONEG_ENABLE : AUTONEG_DISABLE);
return 0;
}
diff --git a/drivers/net/arm/ks8695net.c b/drivers/net/arm/ks8695net.c
index aa07657..a7b0caa 100644
--- a/drivers/net/arm/ks8695net.c
+++ b/drivers/net/arm/ks8695net.c
@@ -891,15 +891,16 @@ ks8695_wan_get_settings(struct net_device *ndev, struct ethtool_cmd *cmd)
cmd->advertising |= ADVERTISED_Pause;
cmd->autoneg = AUTONEG_ENABLE;
- cmd->speed = (ctrl & WMC_WSS) ? SPEED_100 : SPEED_10;
+ ethtool_cmd_speed_set(cmd,
+ (ctrl & WMC_WSS) ? SPEED_100 : SPEED_10);
cmd->duplex = (ctrl & WMC_WDS) ?
DUPLEX_FULL : DUPLEX_HALF;
} else {
/* auto-negotiation is disabled */
cmd->autoneg = AUTONEG_DISABLE;
- cmd->speed = (ctrl & WMC_WANF100) ?
- SPEED_100 : SPEED_10;
+ ethtool_cmd_speed_set(cmd, ((ctrl & WMC_WANF100) ?
+ SPEED_100 : SPEED_10));
cmd->duplex = (ctrl & WMC_WANFF) ?
DUPLEX_FULL : DUPLEX_HALF;
}
diff --git a/drivers/net/atl1c/atl1c_ethtool.c b/drivers/net/atl1c/atl1c_ethtool.c
index b1eceee..7be884d 100644
--- a/drivers/net/atl1c/atl1c_ethtool.c
+++ b/drivers/net/atl1c/atl1c_ethtool.c
@@ -50,13 +50,13 @@ static int atl1c_get_settings(struct net_device *netdev,
ecmd->transceiver = XCVR_INTERNAL;
if (adapter->link_speed != SPEED_0) {
- ecmd->speed = adapter->link_speed;
+ ethtool_cmd_speed_set(ecmd, adapter->link_speed);
if (adapter->link_duplex == FULL_DUPLEX)
ecmd->duplex = DUPLEX_FULL;
else
ecmd->duplex = DUPLEX_HALF;
} else {
- ecmd->speed = -1;
+ ethtool_cmd_speed_set(ecmd, -1);
ecmd->duplex = -1;
}
diff --git a/drivers/net/atl1e/atl1e_ethtool.c b/drivers/net/atl1e/atl1e_ethtool.c
index 4778374..6269438 100644
--- a/drivers/net/atl1e/atl1e_ethtool.c
+++ b/drivers/net/atl1e/atl1e_ethtool.c
@@ -51,13 +51,13 @@ static int atl1e_get_settings(struct net_device *netdev,
ecmd->transceiver = XCVR_INTERNAL;
if (adapter->link_speed != SPEED_0) {
- ecmd->speed = adapter->link_speed;
+ ethtool_cmd_speed_set(ecmd, adapter->link_speed);
if (adapter->link_duplex == FULL_DUPLEX)
ecmd->duplex = DUPLEX_FULL;
else
ecmd->duplex = DUPLEX_HALF;
} else {
- ecmd->speed = -1;
+ ethtool_cmd_speed_set(ecmd, -1);
ecmd->duplex = -1;
}
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 37a092f..c5298d1 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -3231,13 +3231,13 @@ static int atl1_get_settings(struct net_device *netdev,
if (netif_carrier_ok(adapter->netdev)) {
u16 link_speed, link_duplex;
atl1_get_speed_and_duplex(hw, &link_speed, &link_duplex);
- ecmd->speed = link_speed;
+ ethtool_cmd_speed_set(ecmd, link_speed);
if (link_duplex == FULL_DUPLEX)
ecmd->duplex = DUPLEX_FULL;
else
ecmd->duplex = DUPLEX_HALF;
} else {
- ecmd->speed = -1;
+ ethtool_cmd_speed_set(ecmd, -1);
ecmd->duplex = -1;
}
if (hw->media_type == MEDIA_TYPE_AUTO_SENSOR ||
diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c
index b75aa29..16249e9 100644
--- a/drivers/net/atlx/atl2.c
+++ b/drivers/net/atlx/atl2.c
@@ -1769,13 +1769,13 @@ static int atl2_get_settings(struct net_device *netdev,
ecmd->transceiver = XCVR_INTERNAL;
if (adapter->link_speed != SPEED_0) {
- ecmd->speed = adapter->link_speed;
+ ethtool_cmd_speed_set(ecmd, adapter->link_speed);
if (adapter->link_duplex == FULL_DUPLEX)
ecmd->duplex = DUPLEX_FULL;
else
ecmd->duplex = DUPLEX_HALF;
} else {
- ecmd->speed = -1;
+ ethtool_cmd_speed_set(ecmd, -1);
ecmd->duplex = -1;
}
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 909cc4b..a69331e 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -1807,8 +1807,8 @@ static int b44_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
if (bp->flags & B44_FLAG_ADV_100FULL)
cmd->advertising |= ADVERTISED_100baseT_Full;
cmd->advertising |= ADVERTISED_Pause | ADVERTISED_Asym_Pause;
- cmd->speed = (bp->flags & B44_FLAG_100_BASE_T) ?
- SPEED_100 : SPEED_10;
+ ethtool_cmd_speed_set(cmd, ((bp->flags & B44_FLAG_100_BASE_T) ?
+ SPEED_100 : SPEED_10));
cmd->duplex = (bp->flags & B44_FLAG_FULL_DUPLEX) ?
DUPLEX_FULL : DUPLEX_HALF;
cmd->port = 0;
@@ -1820,7 +1820,7 @@ static int b44_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
if (cmd->autoneg == AUTONEG_ENABLE)
cmd->advertising |= ADVERTISED_Autoneg;
if (!netif_running(dev)){
- cmd->speed = 0;
+ ethtool_cmd_speed_set(cmd, 0);
cmd->duplex = 0xff;
}
cmd->maxtxpkt = 0;
diff --git a/drivers/net/bcm63xx_enet.c b/drivers/net/bcm63xx_enet.c
index e68ffe6..f1573d4 100644
--- a/drivers/net/bcm63xx_enet.c
+++ b/drivers/net/bcm63xx_enet.c
@@ -1346,7 +1346,8 @@ static int bcm_enet_get_settings(struct net_device *dev,
return phy_ethtool_gset(priv->phydev, cmd);
} else {
cmd->autoneg = 0;
- cmd->speed = (priv->force_speed_100) ? SPEED_100 : SPEED_10;
+ ethtool_cmd_speed_set(cmd, ((priv->force_speed_100)
+ ? SPEED_100 : SPEED_10));
cmd->duplex = (priv->force_duplex_full) ?
DUPLEX_FULL : DUPLEX_HALF;
cmd->supported = ADVERTISED_10baseT_Half |
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c
index 6565f3e..8e770e8 100644
--- a/drivers/net/benet/be_ethtool.c
+++ b/drivers/net/benet/be_ethtool.c
@@ -381,23 +381,23 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
be_link_status_update(adapter, link_up);
/* link_speed is in units of 10 Mbps */
if (link_speed) {
- ecmd->speed = link_speed*10;
+ ethtool_cmd_speed_set(ecmd, link_speed*10);
} else {
switch (mac_speed) {
case PHY_LINK_SPEED_10MBPS:
- ecmd->speed = SPEED_10;
+ ethtool_cmd_speed_set(ecmd, SPEED_10);
break;
case PHY_LINK_SPEED_100MBPS:
- ecmd->speed = SPEED_100;
+ ethtool_cmd_speed_set(ecmd, SPEED_100);
break;
case PHY_LINK_SPEED_1GBPS:
- ecmd->speed = SPEED_1000;
+ ethtool_cmd_speed_set(ecmd, SPEED_1000);
break;
case PHY_LINK_SPEED_10GBPS:
- ecmd->speed = SPEED_10000;
+ ethtool_cmd_speed_set(ecmd, SPEED_10000);
break;
case PHY_LINK_SPEED_ZERO:
- ecmd->speed = 0;
+ ethtool_cmd_speed_set(ecmd, 0);
break;
}
}
@@ -440,14 +440,14 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
}
/* Save for future use */
- adapter->link_speed = ecmd->speed;
+ adapter->link_speed = ethtool_cmd_speed(ecmd);
adapter->port_type = ecmd->port;
adapter->transceiver = ecmd->transceiver;
adapter->autoneg = ecmd->autoneg;
dma_free_coherent(&adapter->pdev->dev, phy_cmd.size, phy_cmd.va,
phy_cmd.dma);
} else {
- ecmd->speed = adapter->link_speed;
+ ethtool_cmd_speed_set(ecmd, adapter->link_speed);
ecmd->port = adapter->port_type;
ecmd->transceiver = adapter->transceiver;
ecmd->autoneg = adapter->autoneg;
diff --git a/drivers/net/bna/bnad_ethtool.c b/drivers/net/bna/bnad_ethtool.c
index ae1e118..3330cd7 100644
--- a/drivers/net/bna/bnad_ethtool.c
+++ b/drivers/net/bna/bnad_ethtool.c
@@ -237,10 +237,10 @@ bnad_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd)
cmd->phy_address = 0;
if (netif_carrier_ok(netdev)) {
- cmd->speed = SPEED_10000;
+ ethtool_cmd_speed_set(cmd, SPEED_10000);
cmd->duplex = DUPLEX_FULL;
} else {
- cmd->speed = -1;
+ ethtool_cmd_speed_set(cmd, -1);
cmd->duplex = -1;
}
cmd->transceiver = XCVR_EXTERNAL;
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index e43efd8..1bebdfb 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -6696,17 +6696,16 @@ bnx2_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
if (bp->autoneg & AUTONEG_SPEED) {
cmd->autoneg = AUTONEG_ENABLE;
- }
- else {
+ } else {
cmd->autoneg = AUTONEG_DISABLE;
}
if (netif_carrier_ok(dev)) {
- cmd->speed = bp->line_speed;
+ ethtool_cmd_speed_set(cmd, bp->line_speed);
cmd->duplex = bp->duplex;
}
else {
- cmd->speed = -1;
+ ethtool_cmd_speed_set(cmd, -1);
cmd->duplex = -1;
}
spin_unlock_bh(&bp->phy_lock);
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index a6c3f8c..22ce03e 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -4606,18 +4606,17 @@ static int cas_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
if (bmcr & BMCR_ANENABLE) {
cmd->advertising |= ADVERTISED_Autoneg;
cmd->autoneg = AUTONEG_ENABLE;
- cmd->speed = ((speed == 10) ?
- SPEED_10 :
- ((speed == 1000) ?
- SPEED_1000 : SPEED_100));
+ ethtool_cmd_speed_set(cmd, ((speed == 10) ?
+ SPEED_10 :
+ ((speed == 1000) ?
+ SPEED_1000 : SPEED_100)));
cmd->duplex = full_duplex ? DUPLEX_FULL : DUPLEX_HALF;
} else {
cmd->autoneg = AUTONEG_DISABLE;
- cmd->speed =
- (bmcr & CAS_BMCR_SPEED1000) ?
- SPEED_1000 :
- ((bmcr & BMCR_SPEED100) ? SPEED_100:
- SPEED_10);
+ ethtool_cmd_speed_set(cmd, ((bmcr & CAS_BMCR_SPEED1000) ?
+ SPEED_1000 :
+ ((bmcr & BMCR_SPEED100) ?
+ SPEED_100 : SPEED_10)));
cmd->duplex =
(bmcr & BMCR_FULLDPLX) ?
DUPLEX_FULL : DUPLEX_HALF;
@@ -4634,14 +4633,14 @@ static int cas_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
* settings that we configured.
*/
if (cp->link_cntl & BMCR_ANENABLE) {
- cmd->speed = 0;
+ ethtool_cmd_speed_set(cmd, 0);
cmd->duplex = 0xff;
} else {
- cmd->speed = SPEED_10;
+ ethtool_cmd_speed_set(cmd, SPEED_10);
if (cp->link_cntl & BMCR_SPEED100) {
- cmd->speed = SPEED_100;
+ ethtool_cmd_speed_set(cmd, SPEED_100);
} else if (cp->link_cntl & CAS_BMCR_SPEED1000) {
- cmd->speed = SPEED_1000;
+ ethtool_cmd_speed_set(cmd, SPEED_1000);
}
cmd->duplex = (cp->link_cntl & BMCR_FULLDPLX)?
DUPLEX_FULL : DUPLEX_HALF;
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c
index 8e14d65..b422d83 100644
--- a/drivers/net/chelsio/cxgb2.c
+++ b/drivers/net/chelsio/cxgb2.c
@@ -577,10 +577,10 @@ static int get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
cmd->advertising = p->link_config.advertising;
if (netif_carrier_ok(dev)) {
- cmd->speed = p->link_config.speed;
+ ethtool_cmd_speed_set(cmd, p->link_config.speed);
cmd->duplex = p->link_config.duplex;
} else {
- cmd->speed = -1;
+ ethtool_cmd_speed_set(cmd, -1);
cmd->duplex = -1;
}
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 0526715..9081ce0 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -1759,10 +1759,10 @@ static int get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
cmd->advertising = p->link_config.advertising;
if (netif_carrier_ok(dev)) {
- cmd->speed = p->link_config.speed;
+ ethtool_cmd_speed_set(cmd, p->link_config.speed);
cmd->duplex = p->link_config.duplex;
} else {
- cmd->speed = -1;
+ ethtool_cmd_speed_set(cmd, -1);
cmd->duplex = -1;
}
diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c
index 73565f3..bb24261 100644
--- a/drivers/net/cxgb4/cxgb4_main.c
+++ b/drivers/net/cxgb4/cxgb4_main.c
@@ -1436,7 +1436,8 @@ static int get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
cmd->supported = from_fw_linkcaps(p->port_type, p->link_cfg.supported);
cmd->advertising = from_fw_linkcaps(p->port_type,
p->link_cfg.advertising);
- cmd->speed = netif_carrier_ok(dev) ? p->link_cfg.speed : 0;
+ ethtool_cmd_speed_set(cmd,
+ netif_carrier_ok(dev) ? p->link_cfg.speed : 0);
cmd->duplex = DUPLEX_FULL;
cmd->autoneg = p->link_cfg.autoneg;
cmd->maxtxpkt = 0;
diff --git a/drivers/net/cxgb4vf/cxgb4vf_main.c b/drivers/net/cxgb4vf/cxgb4vf_main.c
index 8cf9890..e71c08e 100644
--- a/drivers/net/cxgb4vf/cxgb4vf_main.c
+++ b/drivers/net/cxgb4vf/cxgb4vf_main.c
@@ -1167,7 +1167,8 @@ static int cxgb4vf_get_settings(struct net_device *dev,
cmd->supported = pi->link_cfg.supported;
cmd->advertising = pi->link_cfg.advertising;
- cmd->speed = netif_carrier_ok(dev) ? pi->link_cfg.speed : -1;
+ ethtool_cmd_speed_set(cmd,
+ netif_carrier_ok(dev) ? pi->link_cfg.speed : -1);
cmd->duplex = DUPLEX_FULL;
cmd->port = (cmd->supported & SUPPORTED_TP) ? PORT_TP : PORT_FIBRE;
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index ed3cb6a..1f61100 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -1189,10 +1189,10 @@ static int rio_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
cmd->transceiver = XCVR_INTERNAL;
}
if ( np->link_status ) {
- cmd->speed = np->speed;
+ ethtool_cmd_speed_set(cmd, np->speed);
cmd->duplex = np->full_duplex ? DUPLEX_FULL : DUPLEX_HALF;
} else {
- cmd->speed = -1;
+ ethtool_cmd_speed_set(cmd, -1);
cmd->duplex = -1;
}
if ( np->an_enable)
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index a53629d..127fef4 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -158,7 +158,7 @@ static int e1000_get_settings(struct net_device *netdev,
e1000_get_speed_and_duplex(hw, &adapter->link_speed,
&adapter->link_duplex);
- ecmd->speed = adapter->link_speed;
+ ethtool_cmd_speed_set(ecmd, adapter->link_speed);
/* unfortunately FULL_DUPLEX != DUPLEX_FULL
* and HALF_DUPLEX != DUPLEX_HALF */
@@ -168,7 +168,7 @@ static int e1000_get_settings(struct net_device *netdev,
else
ecmd->duplex = DUPLEX_HALF;
} else {
- ecmd->speed = -1;
+ ethtool_cmd_speed_set(ecmd, -1);
ecmd->duplex = -1;
}
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index 1dd81b2..2f369ed 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -122,6 +122,7 @@ static int e1000_get_settings(struct net_device *netdev,
{
struct e1000_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw;
+ u32 speed;
if (hw->phy.media_type == e1000_media_type_copper) {
@@ -159,23 +160,23 @@ static int e1000_get_settings(struct net_device *netdev,
ecmd->transceiver = XCVR_EXTERNAL;
}
- ecmd->speed = -1;
+ speed = -1;
ecmd->duplex = -1;
if (netif_running(netdev)) {
if (netif_carrier_ok(netdev)) {
- ecmd->speed = adapter->link_speed;
+ speed = adapter->link_speed;
ecmd->duplex = adapter->link_duplex - 1;
}
} else {
u32 status = er32(STATUS);
if (status & E1000_STATUS_LU) {
if (status & E1000_STATUS_SPEED_1000)
- ecmd->speed = 1000;
+ speed = SPEED_1000;
else if (status & E1000_STATUS_SPEED_100)
- ecmd->speed = 100;
+ speed = SPEED_100;
else
- ecmd->speed = 10;
+ speed = SPEED_10;
if (status & E1000_STATUS_FD)
ecmd->duplex = DUPLEX_FULL;
@@ -184,6 +185,7 @@ static int e1000_get_settings(struct net_device *netdev,
}
}
+ ethtool_cmd_speed_set(ecmd, speed);
ecmd->autoneg = ((hw->phy.media_type == e1000_media_type_fiber) ||
hw->mac.autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE;
diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c
index eb35951..dfeb006 100644
--- a/drivers/net/eepro.c
+++ b/drivers/net/eepro.c
@@ -1703,7 +1703,7 @@ static int eepro_ethtool_get_settings(struct net_device *dev,
cmd->advertising |= ADVERTISED_AUI;
}
- cmd->speed = SPEED_10;
+ ethtool_cmd_speed_set(cmd, SPEED_10);
if (dev->if_port == TPE && lp->word[1] & ee_Duplex) {
cmd->duplex = DUPLEX_FULL;
diff --git a/drivers/net/ehea/ehea_ethtool.c b/drivers/net/ehea/ehea_ethtool.c
index 5f13491..1df5f40 100644
--- a/drivers/net/ehea/ehea_ethtool.c
+++ b/drivers/net/ehea/ehea_ethtool.c
@@ -34,6 +34,7 @@
static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
struct ehea_port *port = netdev_priv(dev);
+ u32 speed;
int ret;
ret = ehea_sense_port_attr(port);
@@ -43,17 +44,29 @@ static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
if (netif_carrier_ok(dev)) {
switch (port->port_speed) {
- case EHEA_SPEED_10M: cmd->speed = SPEED_10; break;
- case EHEA_SPEED_100M: cmd->speed = SPEED_100; break;
- case EHEA_SPEED_1G: cmd->speed = SPEED_1000; break;
- case EHEA_SPEED_10G: cmd->speed = SPEED_10000; break;
+ case EHEA_SPEED_10M:
+ speed = SPEED_10;
+ break;
+ case EHEA_SPEED_100M:
+ speed = SPEED_100;
+ break;
+ case EHEA_SPEED_1G:
+ speed = SPEED_1000;
+ break;
+ case EHEA_SPEED_10G:
+ speed = SPEED_10000;
+ break;
+ default:
+ speed = -1;
+ break; /* BUG */
}
cmd->duplex = port->full_duplex == 1 ?
DUPLEX_FULL : DUPLEX_HALF;
} else {
- cmd->speed = -1;
+ speed = ~0;
cmd->duplex = -1;
}
+ ethtool_cmd_speed_set(cmd, speed);
cmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_1000baseT_Full
| SUPPORTED_100baseT_Full | SUPPORTED_100baseT_Half
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
index 81a7937..2837ce2 100644
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60.c
@@ -1488,7 +1488,7 @@ enc28j60_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
cmd->supported = SUPPORTED_10baseT_Half
| SUPPORTED_10baseT_Full
| SUPPORTED_TP;
- cmd->speed = SPEED_10;
+ ethtool_cmd_speed_set(cmd, SPEED_10);
cmd->duplex = priv->full_duplex ? DUPLEX_FULL : DUPLEX_HALF;
cmd->port = PORT_TP;
cmd->autoneg = AUTONEG_DISABLE;
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index b224551..3d99b0f 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -180,10 +180,10 @@ static int enic_get_settings(struct net_device *netdev,
ecmd->transceiver = XCVR_EXTERNAL;
if (netif_carrier_ok(netdev)) {
- ecmd->speed = vnic_dev_port_speed(enic->vdev);
+ ethtool_cmd_speed_set(ecmd, vnic_dev_port_speed(enic->vdev));
ecmd->duplex = DUPLEX_FULL;
} else {
- ecmd->speed = -1;
+ ethtool_cmd_speed_set(ecmd, -1);
ecmd->duplex = -1;
}
diff --git a/drivers/net/ewrk3.c b/drivers/net/ewrk3.c
index 17b6027..b5f6173 100644
--- a/drivers/net/ewrk3.c
+++ b/drivers/net/ewrk3.c
@@ -1545,7 +1545,7 @@ static int ewrk3_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
}
ecmd->supported |= SUPPORTED_10baseT_Half;
- ecmd->speed = SPEED_10;
+ ethtool_cmd_speed_set(ecmd, SPEED_10);
ecmd->duplex = DUPLEX_HALF;
return 0;
}
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index d24b3f3..d09e8b0 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -3955,6 +3955,7 @@ static int nv_set_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo)
static int nv_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
{
struct fe_priv *np = netdev_priv(dev);
+ u32 speed;
int adv;
spin_lock_irq(&np->lock);
@@ -3974,23 +3975,26 @@ static int nv_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
if (netif_carrier_ok(dev)) {
switch (np->linkspeed & (NVREG_LINKSPEED_MASK)) {
case NVREG_LINKSPEED_10:
- ecmd->speed = SPEED_10;
+ speed = SPEED_10;
break;
case NVREG_LINKSPEED_100:
- ecmd->speed = SPEED_100;
+ speed = SPEED_100;
break;
case NVREG_LINKSPEED_1000:
- ecmd->speed = SPEED_1000;
+ speed = SPEED_1000;
+ break;
+ default:
+ speed = -1;
break;
}
ecmd->duplex = DUPLEX_HALF;
if (np->duplex)
ecmd->duplex = DUPLEX_FULL;
} else {
- ecmd->speed = -1;
+ speed = -1;
ecmd->duplex = -1;
}
-
+ ethtool_cmd_speed_set(ecmd, speed);
ecmd->autoneg = np->autoneg;
ecmd->advertising = ADVERTISED_MII;
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index 4855f1f..52542de 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -710,7 +710,7 @@ static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
SUPPORTED_FIBRE);
cmd->advertising = (ADVERTISED_1000baseT_Full | ADVERTISED_Autoneg |
ADVERTISED_FIBRE);
- cmd->speed = SPEED_1000;
+ ethtool_cmd_speed_set(cmd, SPEED_1000);
cmd->duplex = DUPLEX_FULL;
cmd->port = PORT_FIBRE;
cmd->phy_address = 0;
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c
index 2cc221b..023aa9b 100644
--- a/drivers/net/igb/igb_ethtool.c
+++ b/drivers/net/igb/igb_ethtool.c
@@ -178,11 +178,11 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
if ((status & E1000_STATUS_SPEED_1000) ||
hw->phy.media_type != e1000_media_type_copper)
- ecmd->speed = SPEED_1000;
+ ethtool_cmd_speed_set(ecmd, SPEED_1000);
else if (status & E1000_STATUS_SPEED_100)
- ecmd->speed = SPEED_100;
+ ethtool_cmd_speed_set(ecmd, SPEED_100);
else
- ecmd->speed = SPEED_10;
+ ethtool_cmd_speed_set(ecmd, SPEED_10);
if ((status & E1000_STATUS_FD) ||
hw->phy.media_type != e1000_media_type_copper)
@@ -190,7 +190,7 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
else
ecmd->duplex = DUPLEX_HALF;
} else {
- ecmd->speed = -1;
+ ethtool_cmd_speed_set(ecmd, -1);
ecmd->duplex = -1;
}
diff --git a/drivers/net/igbvf/ethtool.c b/drivers/net/igbvf/ethtool.c
index 1d943aa..112ae15 100644
--- a/drivers/net/igbvf/ethtool.c
+++ b/drivers/net/igbvf/ethtool.c
@@ -90,18 +90,18 @@ static int igbvf_get_settings(struct net_device *netdev,
status = er32(STATUS);
if (status & E1000_STATUS_LU) {
if (status & E1000_STATUS_SPEED_1000)
- ecmd->speed = 1000;
+ ethtool_cmd_speed_set(ecmd, SPEED_1000);
else if (status & E1000_STATUS_SPEED_100)
- ecmd->speed = 100;
+ ethtool_cmd_speed_set(ecmd, SPEED_100);
else
- ecmd->speed = 10;
+ ethtool_cmd_speed_set(ecmd, SPEED_10);
if (status & E1000_STATUS_FD)
ecmd->duplex = DUPLEX_FULL;
else
ecmd->duplex = DUPLEX_HALF;
} else {
- ecmd->speed = -1;
+ ethtool_cmd_speed_set(ecmd, -1);
ecmd->duplex = -1;
}
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index edb3d7e..5f224c3 100644
--- a/drivers/net/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ixgb/ixgb_ethtool.c
@@ -104,10 +104,10 @@ ixgb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
ecmd->transceiver = XCVR_EXTERNAL;
if (netif_carrier_ok(adapter->netdev)) {
- ecmd->speed = SPEED_10000;
+ ethtool_cmd_speed_set(ecmd, SPEED_10000);
ecmd->duplex = DUPLEX_FULL;
} else {
- ecmd->speed = -1;
+ ethtool_cmd_speed_set(ecmd, -1);
ecmd->duplex = -1;
}
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index e1c3576..01ea04c 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -288,20 +288,20 @@ static int ixgbe_get_settings(struct net_device *netdev,
if (link_up) {
switch (link_speed) {
case IXGBE_LINK_SPEED_10GB_FULL:
- ecmd->speed = SPEED_10000;
+ ethtool_cmd_speed_set(ecmd, SPEED_10000);
break;
case IXGBE_LINK_SPEED_1GB_FULL:
- ecmd->speed = SPEED_1000;
+ ethtool_cmd_speed_set(ecmd, SPEED_1000);
break;
case IXGBE_LINK_SPEED_100_FULL:
- ecmd->speed = SPEED_100;
+ ethtool_cmd_speed_set(ecmd, SPEED_100);
break;
default:
break;
}
ecmd->duplex = DUPLEX_FULL;
} else {
- ecmd->speed = -1;
+ ethtool_cmd_speed_set(ecmd, -1);
ecmd->duplex = -1;
}
diff --git a/drivers/net/ixgbevf/ethtool.c b/drivers/net/ixgbevf/ethtool.c
index 0563ab2..deee375 100644
--- a/drivers/net/ixgbevf/ethtool.c
+++ b/drivers/net/ixgbevf/ethtool.c
@@ -104,11 +104,13 @@ static int ixgbevf_get_settings(struct net_device *netdev,
hw->mac.ops.check_link(hw, &link_speed, &link_up, false);
if (link_up) {
- ecmd->speed = (link_speed == IXGBE_LINK_SPEED_10GB_FULL) ?
- SPEED_10000 : SPEED_1000;
+ ethtool_cmd_speed_set(
+ ecmd,
+ (link_speed == IXGBE_LINK_SPEED_10GB_FULL) ?
+ SPEED_10000 : SPEED_1000);
ecmd->duplex = DUPLEX_FULL;
} else {
- ecmd->speed = -1;
+ ethtool_cmd_speed_set(ecmd, -1);
ecmd->duplex = -1;
}
diff --git a/drivers/net/mdio.c b/drivers/net/mdio.c
index 2e717a2..a5039d8 100644
--- a/drivers/net/mdio.c
+++ b/drivers/net/mdio.c
@@ -290,33 +290,36 @@ void mdio45_ethtool_gset_npage(const struct mdio_if_info *mdio,
if (modes & (ADVERTISED_10000baseT_Full |
ADVERTISED_10000baseKX4_Full |
ADVERTISED_10000baseKR_Full)) {
- ecmd->speed = SPEED_10000;
+ ethtool_cmd_speed_set(ecmd, SPEED_10000);
ecmd->duplex = DUPLEX_FULL;
} else if (modes & (ADVERTISED_1000baseT_Full |
ADVERTISED_1000baseT_Half |
ADVERTISED_1000baseKX_Full)) {
- ecmd->speed = SPEED_1000;
+ ethtool_cmd_speed_set(ecmd, SPEED_1000);
ecmd->duplex = !(modes & ADVERTISED_1000baseT_Half);
} else if (modes & (ADVERTISED_100baseT_Full |
ADVERTISED_100baseT_Half)) {
- ecmd->speed = SPEED_100;
+ ethtool_cmd_speed_set(ecmd, SPEED_100);
ecmd->duplex = !!(modes & ADVERTISED_100baseT_Full);
} else {
- ecmd->speed = SPEED_10;
+ ethtool_cmd_speed_set(ecmd, SPEED_10);
ecmd->duplex = !!(modes & ADVERTISED_10baseT_Full);
}
} else {
/* Report forced settings */
+ u32 speed;
reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD,
MDIO_CTRL1);
- ecmd->speed = (((reg & MDIO_PMA_CTRL1_SPEED1000) ? 100 : 1) *
- ((reg & MDIO_PMA_CTRL1_SPEED100) ? 100 : 10));
+ speed = (((reg & MDIO_PMA_CTRL1_SPEED1000) ? 100 : 1)
+ * ((reg & MDIO_PMA_CTRL1_SPEED100) ? 100 : 10));
ecmd->duplex = (reg & MDIO_CTRL1_FULLDPLX ||
- ecmd->speed == SPEED_10000);
+ speed == SPEED_10000);
+ ethtool_cmd_speed_set(ecmd, speed);
}
/* 10GBASE-T MDI/MDI-X */
- if (ecmd->port == PORT_TP && ecmd->speed == SPEED_10000) {
+ if (ecmd->port == PORT_TP
+ && (ethtool_cmd_speed(ecmd) == SPEED_10000)) {
switch (mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD,
MDIO_PMA_10GBT_SWAPPOL)) {
case MDIO_PMA_10GBT_SWAPPOL_ABNX | MDIO_PMA_10GBT_SWAPPOL_CDNX:
diff --git a/drivers/net/mii.c b/drivers/net/mii.c
index e8198ed..4fbc816 100644
--- a/drivers/net/mii.c
+++ b/drivers/net/mii.c
@@ -121,22 +121,25 @@ int mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd)
if (nego & (ADVERTISED_1000baseT_Full |
ADVERTISED_1000baseT_Half)) {
- ecmd->speed = SPEED_1000;
+ ethtool_cmd_speed_set(ecmd, SPEED_1000);
ecmd->duplex = !!(nego & ADVERTISED_1000baseT_Full);
} else if (nego & (ADVERTISED_100baseT_Full |
ADVERTISED_100baseT_Half)) {
- ecmd->speed = SPEED_100;
+ ethtool_cmd_speed_set(ecmd, SPEED_100);
ecmd->duplex = !!(nego & ADVERTISED_100baseT_Full);
} else {
- ecmd->speed = SPEED_10;
+ ethtool_cmd_speed_set(ecmd, SPEED_10);
ecmd->duplex = !!(nego & ADVERTISED_10baseT_Full);
}
} else {
ecmd->autoneg = AUTONEG_DISABLE;
- ecmd->speed = ((bmcr & BMCR_SPEED1000 &&
- (bmcr & BMCR_SPEED100) == 0) ? SPEED_1000 :
- (bmcr & BMCR_SPEED100) ? SPEED_100 : SPEED_10);
+ ethtool_cmd_speed_set(ecmd,
+ ((bmcr & BMCR_SPEED1000 &&
+ (bmcr & BMCR_SPEED100) == 0) ?
+ SPEED_1000 :
+ ((bmcr & BMCR_SPEED100) ?
+ SPEED_100 : SPEED_10)));
ecmd->duplex = (bmcr & BMCR_FULLDPLX) ? DUPLEX_FULL : DUPLEX_HALF;
}
diff --git a/drivers/net/mlx4/en_ethtool.c b/drivers/net/mlx4/en_ethtool.c
index be4a9e0..2e858e4 100644
--- a/drivers/net/mlx4/en_ethtool.c
+++ b/drivers/net/mlx4/en_ethtool.c
@@ -265,10 +265,10 @@ static int mlx4_en_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
trans_type = priv->port_state.transciver;
if (netif_carrier_ok(dev)) {
- cmd->speed = priv->port_state.link_speed;
+ ethtool_cmd_speed_set(cmd, priv->port_state.link_speed);
cmd->duplex = DUPLEX_FULL;
} else {
- cmd->speed = -1;
+ ethtool_cmd_speed_set(cmd, -1);
cmd->duplex = -1;
}
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 57c2ac0..a5d9b1c 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -1444,13 +1444,13 @@ mv643xx_eth_get_settings_phyless(struct mv643xx_eth_private *mp,
cmd->advertising = ADVERTISED_MII;
switch (port_status & PORT_SPEED_MASK) {
case PORT_SPEED_10:
- cmd->speed = SPEED_10;
+ ethtool_cmd_speed_set(cmd, SPEED_10);
break;
case PORT_SPEED_100:
- cmd->speed = SPEED_100;
+ ethtool_cmd_speed_set(cmd, SPEED_100);
break;
case PORT_SPEED_1000:
- cmd->speed = SPEED_1000;
+ ethtool_cmd_speed_set(cmd, SPEED_1000);
break;
default:
cmd->speed = -1;
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index e7f80164..b1358f7 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -1644,7 +1644,7 @@ myri10ge_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd)
int i;
cmd->autoneg = AUTONEG_DISABLE;
- cmd->speed = SPEED_10000;
+ ethtool_cmd_speed_set(cmd, SPEED_10000);
cmd->duplex = DUPLEX_FULL;
/*
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 7633c67..b78be08 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -2820,7 +2820,7 @@ static int netdev_get_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
u32 tmp;
ecmd->port = dev->if_port;
- ecmd->speed = np->speed;
+ ethtool_cmd_speed_set(ecmd, np->speed);
ecmd->duplex = np->duplex;
ecmd->autoneg = np->autoneg;
ecmd->advertising = 0;
@@ -2878,9 +2878,9 @@ static int netdev_get_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
tmp = mii_nway_result(
np->advertising & mdio_read(dev, MII_LPA));
if (tmp == LPA_100FULL || tmp == LPA_100HALF)
- ecmd->speed = SPEED_100;
+ ethtool_cmd_speed_set(ecmd, SPEED_100);
else
- ecmd->speed = SPEED_10;
+ ethtool_cmd_speed_set(ecmd, SPEED_10);
if (tmp == LPA_100FULL || tmp == LPA_10FULL)
ecmd->duplex = DUPLEX_FULL;
else
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index e8d16f6..b34fb74 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -117,7 +117,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
ecmd->port = PORT_TP;
- ecmd->speed = adapter->link_speed;
+ ethtool_cmd_speed_set(ecmd, adapter->link_speed);
ecmd->duplex = adapter->link_duplex;
ecmd->autoneg = adapter->link_autoneg;
@@ -134,7 +134,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
}
if (netif_running(dev) && adapter->has_link_events) {
- ecmd->speed = adapter->link_speed;
+ ethtool_cmd_speed_set(ecmd, adapter->link_speed);
ecmd->autoneg = adapter->link_autoneg;
ecmd->duplex = adapter->link_duplex;
goto skip;
@@ -146,10 +146,10 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
u16 pcifn = adapter->ahw.pci_func;
val = NXRD32(adapter, P3_LINK_SPEED_REG(pcifn));
- ecmd->speed = P3_LINK_SPEED_MHZ *
- P3_LINK_SPEED_VAL(pcifn, val);
+ ethtool_cmd_speed_set(ecmd, P3_LINK_SPEED_MHZ *
+ P3_LINK_SPEED_VAL(pcifn, val));
} else
- ecmd->speed = SPEED_10000;
+ ethtool_cmd_speed_set(ecmd, SPEED_10000);
ecmd->duplex = DUPLEX_FULL;
ecmd->autoneg = AUTONEG_DISABLE;
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 524e800..cc25bff 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -6844,7 +6844,7 @@ static int niu_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
cmd->supported = lp->supported;
cmd->advertising = lp->active_advertising;
cmd->autoneg = lp->active_autoneg;
- cmd->speed = lp->active_speed;
+ ethtool_cmd_speed_set(cmd, lp->active_speed);
cmd->duplex = lp->active_duplex;
cmd->port = (np->flags & NIU_FLAGS_FIBER) ? PORT_FIBRE : PORT_TP;
cmd->transceiver = (np->flags & NIU_FLAGS_XCVR_SERDES) ?
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c
index 6667e06..3e4040f 100644
--- a/drivers/net/ns83820.c
+++ b/drivers/net/ns83820.c
@@ -1251,7 +1251,7 @@ static int ns83820_get_settings(struct net_device *ndev,
/*
* Here's the list of available ethtool commands from other drivers:
* cmd->advertising =
- * cmd->speed =
+ * ethtool_cmd_speed_set(cmd, ...)
* cmd->duplex =
* cmd->port = 0;
* cmd->phy_address =
@@ -1289,13 +1289,13 @@ static int ns83820_get_settings(struct net_device *ndev,
cmd->duplex = fullduplex ? DUPLEX_FULL : DUPLEX_HALF;
switch (cfg / CFG_SPDSTS0 & 3) {
case 2:
- cmd->speed = SPEED_1000;
+ ethtool_cmd_speed_set(cmd, SPEED_1000);
break;
case 1:
- cmd->speed = SPEED_100;
+ ethtool_cmd_speed_set(cmd, SPEED_100);
break;
default:
- cmd->speed = SPEED_10;
+ ethtool_cmd_speed_set(cmd, SPEED_10);
break;
}
cmd->autoneg = (tbicr & TBICR_MR_AN_ENABLE)
diff --git a/drivers/net/pch_gbe/pch_gbe_ethtool.c b/drivers/net/pch_gbe/pch_gbe_ethtool.c
index 98587dc..f3556e2 100644
--- a/drivers/net/pch_gbe/pch_gbe_ethtool.c
+++ b/drivers/net/pch_gbe/pch_gbe_ethtool.c
@@ -92,7 +92,7 @@ static int pch_gbe_get_settings(struct net_device *netdev,
ecmd->advertising &= ~(ADVERTISED_TP | ADVERTISED_1000baseT_Half);
if (!netif_carrier_ok(adapter->netdev))
- ecmd->speed = -1;
+ ethtool_cmd_speed_set(ecmd, -1);
return ret;
}
diff --git a/drivers/net/pch_gbe/pch_gbe_phy.c b/drivers/net/pch_gbe/pch_gbe_phy.c
index 9a8207f..28bb960 100644
--- a/drivers/net/pch_gbe/pch_gbe_phy.c
+++ b/drivers/net/pch_gbe/pch_gbe_phy.c
@@ -256,7 +256,7 @@ void pch_gbe_phy_init_setting(struct pch_gbe_hw *hw)
if (ret)
pr_err("Error: mii_ethtool_gset\n");
- cmd.speed = hw->mac.link_speed;
+ ethtool_cmd_speed_set(&cmd, hw->mac.link_speed);
cmd.duplex = hw->mac.link_duplex;
cmd.advertising = hw->phy.autoneg_advertised;
cmd.autoneg = hw->mac.autoneg;
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index bc71cb2..288e4f1 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -1860,7 +1860,7 @@ static int smc_netdev_get_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
tmp = inw(ioaddr + CONFIG);
ecmd->port = (tmp & CFG_AUI_SELECT) ? PORT_AUI : PORT_TP;
ecmd->transceiver = XCVR_INTERNAL;
- ecmd->speed = SPEED_10;
+ ethtool_cmd_speed_set(ecmd, SPEED_10);
ecmd->phy_address = ioaddr + MGMT;
SMC_SELECT_BANK(0);
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index e3f3501..a475957 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -288,7 +288,7 @@ int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd)
cmd->advertising = phydev->advertising;
- cmd->speed = phydev->speed;
+ ethtool_cmd_speed_set(cmd, phydev->speed);
cmd->duplex = phydev->duplex;
cmd->port = PORT_MII;
cmd->phy_address = phydev->addr;
diff --git a/drivers/net/ps3_gelic_net.c b/drivers/net/ps3_gelic_net.c
index 4383ed2..b1f251d 100644
--- a/drivers/net/ps3_gelic_net.c
+++ b/drivers/net/ps3_gelic_net.c
@@ -1243,17 +1243,17 @@ static int gelic_ether_get_settings(struct net_device *netdev,
switch (card->ether_port_status & GELIC_LV1_ETHER_SPEED_MASK) {
case GELIC_LV1_ETHER_SPEED_10:
- cmd->speed = SPEED_10;
+ ethtool_cmd_speed_set(cmd, SPEED_10);
break;
case GELIC_LV1_ETHER_SPEED_100:
- cmd->speed = SPEED_100;
+ ethtool_cmd_speed_set(cmd, SPEED_100);
break;
case GELIC_LV1_ETHER_SPEED_1000:
- cmd->speed = SPEED_1000;
+ ethtool_cmd_speed_set(cmd, SPEED_1000);
break;
default:
pr_info("%s: speed unknown\n", __func__);
- cmd->speed = SPEED_10;
+ ethtool_cmd_speed_set(cmd, SPEED_10);
break;
}
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index f3f737b..d495a68 100644
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -1725,7 +1725,7 @@ static int ql_get_settings(struct net_device *ndev, struct ethtool_cmd *ecmd)
}
ecmd->advertising = ql_supported_modes(qdev);
ecmd->autoneg = ql_get_auto_cfg_status(qdev);
- ecmd->speed = ql_get_speed(qdev);
+ ethtool_cmd_speed_set(ecmd, ql_get_speed(qdev));
ecmd->duplex = ql_get_full_dup(qdev);
return 0;
}
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c
index 61a4a7a..5a69284 100644
--- a/drivers/net/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/qlcnic/qlcnic_ethtool.c
@@ -166,7 +166,7 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
ADVERTISED_1000baseT_Half |
ADVERTISED_1000baseT_Full);
- ecmd->speed = adapter->link_speed;
+ ethtool_cmd_speed_set(ecmd, adapter->link_speed);
ecmd->duplex = adapter->link_duplex;
ecmd->autoneg = adapter->link_autoneg;
@@ -183,15 +183,15 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
}
if (netif_running(dev) && adapter->has_link_events) {
- ecmd->speed = adapter->link_speed;
+ ethtool_cmd_speed_set(ecmd, adapter->link_speed);
ecmd->autoneg = adapter->link_autoneg;
ecmd->duplex = adapter->link_duplex;
goto skip;
}
val = QLCRD32(adapter, P3P_LINK_SPEED_REG(pcifn));
- ecmd->speed = P3P_LINK_SPEED_MHZ *
- P3P_LINK_SPEED_VAL(pcifn, val);
+ ethtool_cmd_speed_set(ecmd, P3P_LINK_SPEED_MHZ *
+ P3P_LINK_SPEED_VAL(pcifn, val));
ecmd->duplex = DUPLEX_FULL;
ecmd->autoneg = AUTONEG_DISABLE;
} else
diff --git a/drivers/net/qlge/qlge_ethtool.c b/drivers/net/qlge/qlge_ethtool.c
index 78dc40c..19b00fa 100644
--- a/drivers/net/qlge/qlge_ethtool.c
+++ b/drivers/net/qlge/qlge_ethtool.c
@@ -356,7 +356,7 @@ static int ql_get_settings(struct net_device *ndev,
ecmd->port = PORT_FIBRE;
}
- ecmd->speed = SPEED_10000;
+ ethtool_cmd_speed_set(ecmd, SPEED_10000);
ecmd->duplex = DUPLEX_FULL;
return 0;
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 7bfcf95..57e0636 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1423,7 +1423,7 @@ static int rtl8169_gset_tbi(struct net_device *dev, struct ethtool_cmd *cmd)
cmd->advertising = (status & TBINwEnable) ? ADVERTISED_Autoneg : 0;
cmd->autoneg = !!(status & TBINwEnable);
- cmd->speed = SPEED_1000;
+ ethtool_cmd_speed_set(cmd, SPEED_1000);
cmd->duplex = DUPLEX_FULL; /* Always set */
return 0;
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 5443985..89cfee7 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -5414,10 +5414,10 @@ static int s2io_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info)
info->transceiver = XCVR_EXTERNAL;
if (netif_carrier_ok(sp->dev)) {
- info->speed = 10000;
+ ethtool_cmd_speed_set(info, SPEED_10000);
info->duplex = DUPLEX_FULL;
} else {
- info->speed = -1;
+ ethtool_cmd_speed_set(info, -1);
info->duplex = -1;
}
diff --git a/drivers/net/sc92031.c b/drivers/net/sc92031.c
index f3ffc1d..fa74314 100644
--- a/drivers/net/sc92031.c
+++ b/drivers/net/sc92031.c
@@ -1173,7 +1173,8 @@ static int sc92031_ethtool_get_settings(struct net_device *dev,
if (phy_ctrl & PhyCtrlAne)
cmd->advertising |= ADVERTISED_Autoneg;
- cmd->speed = (output_status & 0x2) ? SPEED_100 : SPEED_10;
+ ethtool_cmd_speed_set(cmd,
+ (output_status & 0x2) ? SPEED_100 : SPEED_10);
cmd->duplex = (output_status & 0x4) ? DUPLEX_FULL : DUPLEX_HALF;
cmd->port = PORT_MII;
cmd->phy_address = phy_address;
diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c
index 10b160a..8c5e005 100644
--- a/drivers/net/sfc/ethtool.c
+++ b/drivers/net/sfc/ethtool.c
@@ -219,7 +219,7 @@ static int efx_ethtool_get_settings(struct net_device *net_dev,
ecmd->supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause;
if (LOOPBACK_INTERNAL(efx)) {
- ecmd->speed = link_state->speed;
+ ethtool_cmd_speed_set(ecmd, link_state->speed);
ecmd->duplex = link_state->fd ? DUPLEX_FULL : DUPLEX_HALF;
}
diff --git a/drivers/net/sfc/mcdi_phy.c b/drivers/net/sfc/mcdi_phy.c
index 6c5fccb..6c63ab0 100644
--- a/drivers/net/sfc/mcdi_phy.c
+++ b/drivers/net/sfc/mcdi_phy.c
@@ -513,7 +513,7 @@ static void efx_mcdi_phy_get_settings(struct efx_nic *efx, struct ethtool_cmd *e
ecmd->supported =
mcdi_to_ethtool_cap(phy_cfg->media, phy_cfg->supported_cap);
ecmd->advertising = efx->link_advertising;
- ecmd->speed = efx->link_state.speed;
+ ethtool_cmd_speed_set(ecmd, efx->link_state.speed);
ecmd->duplex = efx->link_state.fd;
ecmd->port = mcdi_to_ethtool_media(phy_cfg->media);
ecmd->phy_address = phy_cfg->port;
diff --git a/drivers/net/sfc/tenxpress.c b/drivers/net/sfc/tenxpress.c
index 204ecda..7b0fd89 100644
--- a/drivers/net/sfc/tenxpress.c
+++ b/drivers/net/sfc/tenxpress.c
@@ -460,7 +460,7 @@ tenxpress_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
/* In loopback, the PHY automatically brings up the correct interface,
* but doesn't advertise the correct speed. So override it */
if (LOOPBACK_EXTERNAL(efx))
- ecmd->speed = SPEED_10000;
+ ethtool_cmd_speed_set(ecmd, SPEED_10000);
}
static int tenxpress_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index b0fa999..56a1899 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -303,7 +303,7 @@ static int skge_get_settings(struct net_device *dev,
ecmd->advertising = skge->advertising;
ecmd->autoneg = skge->autoneg;
- ecmd->speed = skge->speed;
+ ethtool_cmd_speed_set(ecmd, skge->speed);
ecmd->duplex = skge->duplex;
return 0;
}
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 40afe07..66f5db6 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -3413,10 +3413,10 @@ static int sky2_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
ecmd->phy_address = PHY_ADDR_MARV;
if (sky2_is_copper(hw)) {
ecmd->port = PORT_TP;
- ecmd->speed = sky2->speed;
+ ethtool_cmd_speed_set(ecmd, sky2->speed);
ecmd->supported |= SUPPORTED_Autoneg | SUPPORTED_TP;
} else {
- ecmd->speed = SPEED_1000;
+ ethtool_cmd_speed_set(ecmd, SPEED_1000);
ecmd->port = PORT_FIBRE;
ecmd->supported |= SUPPORTED_Autoneg | SUPPORTED_FIBRE;
}
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 66831f3..053863a 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -1488,9 +1488,9 @@ smc911x_ethtool_getsettings(struct net_device *dev, struct ethtool_cmd *cmd)
SUPPORTED_TP | SUPPORTED_AUI;
if (lp->ctl_rspeed == 10)
- cmd->speed = SPEED_10;
+ ethtool_cmd_speed_set(cmd, SPEED_10);
else if (lp->ctl_rspeed == 100)
- cmd->speed = SPEED_100;
+ ethtool_cmd_speed_set(cmd, SPEED_100);
cmd->autoneg = AUTONEG_DISABLE;
if (lp->mii.phy_id==1)
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index 43654a3..dc4805f 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -1565,9 +1565,9 @@ smc_ethtool_getsettings(struct net_device *dev, struct ethtool_cmd *cmd)
SUPPORTED_TP | SUPPORTED_AUI;
if (lp->ctl_rspeed == 10)
- cmd->speed = SPEED_10;
+ ethtool_cmd_speed_set(cmd, SPEED_10);
else if (lp->ctl_rspeed == 100)
- cmd->speed = SPEED_100;
+ ethtool_cmd_speed_set(cmd, SPEED_100);
cmd->autoneg = AUTONEG_DISABLE;
cmd->transceiver = XCVR_INTERNAL;
diff --git a/drivers/net/spider_net_ethtool.c b/drivers/net/spider_net_ethtool.c
index d723fca..9c288cd 100644
--- a/drivers/net/spider_net_ethtool.c
+++ b/drivers/net/spider_net_ethtool.c
@@ -58,7 +58,7 @@ spider_net_ethtool_get_settings(struct net_device *netdev,
cmd->advertising = (ADVERTISED_1000baseT_Full |
ADVERTISED_FIBRE);
cmd->port = PORT_FIBRE;
- cmd->speed = card->phy.speed;
+ ethtool_cmd_speed_set(cmd, card->phy.speed);
cmd->duplex = DUPLEX_FULL;
return 0;
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 40a755d..ab59300 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -2642,7 +2642,7 @@ static int gem_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
/* Return current PHY settings */
spin_lock_irq(&gp->lock);
cmd->autoneg = gp->want_autoneg;
- cmd->speed = gp->phy_mii.speed;
+ ethtool_cmd_speed_set(cmd, gp->phy_mii.speed);
cmd->duplex = gp->phy_mii.duplex;
cmd->advertising = gp->phy_mii.advertising;
@@ -2659,7 +2659,7 @@ static int gem_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full |
SUPPORTED_Autoneg);
cmd->advertising = cmd->supported;
- cmd->speed = 0;
+ ethtool_cmd_speed_set(cmd, 0);
cmd->duplex = cmd->port = cmd->phy_address =
cmd->transceiver = cmd->autoneg = 0;
@@ -2673,7 +2673,7 @@ static int gem_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
cmd->advertising = cmd->supported;
cmd->transceiver = XCVR_INTERNAL;
if (gp->lstate == link_up)
- cmd->speed = SPEED_1000;
+ ethtool_cmd_speed_set(cmd, SPEED_1000);
cmd->duplex = DUPLEX_FULL;
cmd->autoneg = 1;
}
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index 8f3f028..d381a0f 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -2401,6 +2401,7 @@ static void happy_meal_set_multicast(struct net_device *dev)
static int hme_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
struct happy_meal *hp = netdev_priv(dev);
+ u32 speed;
cmd->supported =
(SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full |
@@ -2420,10 +2421,9 @@ static int hme_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
if (hp->sw_bmcr & BMCR_ANENABLE) {
cmd->autoneg = AUTONEG_ENABLE;
- cmd->speed =
- (hp->sw_lpa & (LPA_100HALF | LPA_100FULL)) ?
- SPEED_100 : SPEED_10;
- if (cmd->speed == SPEED_100)
+ speed = ((hp->sw_lpa & (LPA_100HALF | LPA_100FULL)) ?
+ SPEED_100 : SPEED_10);
+ if (speed == SPEED_100)
cmd->duplex =
(hp->sw_lpa & (LPA_100FULL)) ?
DUPLEX_FULL : DUPLEX_HALF;
@@ -2433,13 +2433,12 @@ static int hme_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
DUPLEX_FULL : DUPLEX_HALF;
} else {
cmd->autoneg = AUTONEG_DISABLE;
- cmd->speed =
- (hp->sw_bmcr & BMCR_SPEED100) ?
- SPEED_100 : SPEED_10;
+ speed = (hp->sw_bmcr & BMCR_SPEED100) ? SPEED_100 : SPEED_10;
cmd->duplex =
(hp->sw_bmcr & BMCR_FULLDPLX) ?
DUPLEX_FULL : DUPLEX_HALF;
}
+ ethtool_cmd_speed_set(cmd, speed);
return 0;
}
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
index 8be71de..80fbee0 100644
--- a/drivers/net/tehuti.c
+++ b/drivers/net/tehuti.c
@@ -2151,7 +2151,7 @@ static int bdx_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);
ecmd->advertising = (ADVERTISED_10000baseT_Full | ADVERTISED_FIBRE);
- ecmd->speed = SPEED_10000;
+ ethtool_cmd_speed_set(ecmd, SPEED_10000);
ecmd->duplex = DUPLEX_FULL;
ecmd->port = PORT_FIBRE;
ecmd->transceiver = XCVR_EXTERNAL; /* what does it mean? */
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 84f62af..e8141c4 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -10027,10 +10027,10 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
cmd->advertising = tp->link_config.advertising;
if (netif_running(dev)) {
- cmd->speed = tp->link_config.active_speed;
+ ethtool_cmd_speed_set(cmd, tp->link_config.active_speed);
cmd->duplex = tp->link_config.active_duplex;
} else {
- cmd->speed = SPEED_INVALID;
+ ethtool_cmd_speed_set(cmd, SPEED_INVALID);
cmd->duplex = DUPLEX_INVALID;
}
cmd->phy_address = tp->phy_addr;
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
index f8d26bf..ab78e1d 100644
--- a/drivers/net/tulip/de2104x.c
+++ b/drivers/net/tulip/de2104x.c
@@ -1518,15 +1518,15 @@ static int __de_get_settings(struct de_private *de, struct ethtool_cmd *ecmd)
switch (de->media_type) {
case DE_MEDIA_AUI:
ecmd->port = PORT_AUI;
- ecmd->speed = 5;
+ ethtool_cmd_speed_set(ecmd, 5);
break;
case DE_MEDIA_BNC:
ecmd->port = PORT_BNC;
- ecmd->speed = 2;
+ ethtool_cmd_speed_set(ecmd, 2);
break;
default:
ecmd->port = PORT_TP;
- ecmd->speed = SPEED_10;
+ ethtool_cmd_speed_set(ecmd, SPEED_10);
break;
}
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c
index 74217db..a4375c4 100644
--- a/drivers/net/tulip/uli526x.c
+++ b/drivers/net/tulip/uli526x.c
@@ -945,12 +945,12 @@ ULi_ethtool_gset(struct uli526x_board_info *db, struct ethtool_cmd *ecmd)
ecmd->transceiver = XCVR_EXTERNAL;
- ecmd->speed = 10;
+ ethtool_cmd_speed_set(ecmd, SPEED_10);
ecmd->duplex = DUPLEX_HALF;
if(db->op_mode==ULI526X_100MHF || db->op_mode==ULI526X_100MFD)
{
- ecmd->speed = 100;
+ ethtool_cmd_speed_set(ecmd, SPEED_100);
}
if(db->op_mode==ULI526X_10MFD || db->op_mode==ULI526X_100MFD)
{
@@ -958,7 +958,7 @@ ULi_ethtool_gset(struct uli526x_board_info *db, struct ethtool_cmd *ecmd)
}
if(db->link_failed)
{
- ecmd->speed = -1;
+ ethtool_cmd_speed_set(ecmd, -1);
ecmd->duplex = -1;
}
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index ade3cf9..0636f70 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1553,7 +1553,7 @@ static int tun_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
cmd->supported = 0;
cmd->advertising = 0;
- cmd->speed = SPEED_10;
+ ethtool_cmd_speed_set(cmd, SPEED_10);
cmd->duplex = DUPLEX_FULL;
cmd->port = PORT_TP;
cmd->phy_address = 0;
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index 9f11c11..3de4283 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -1050,7 +1050,7 @@ typhoon_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
/* need to get stats to make these link speed/duplex valid */
typhoon_do_get_stats(tp);
- cmd->speed = tp->speed;
+ ethtool_cmd_speed_set(cmd, tp->speed);
cmd->duplex = tp->duplex;
cmd->phy_address = 0;
cmd->transceiver = XCVR_INTERNAL;
diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c
index 97687d3..d7221c4 100644
--- a/drivers/net/usb/catc.c
+++ b/drivers/net/usb/catc.c
@@ -686,7 +686,7 @@ static int catc_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
cmd->supported = SUPPORTED_10baseT_Half | SUPPORTED_TP;
cmd->advertising = ADVERTISED_10baseT_Half | ADVERTISED_TP;
- cmd->speed = SPEED_10;
+ ethtool_cmd_speed_set(cmd, SPEED_10);
cmd->duplex = DUPLEX_HALF;
cmd->port = PORT_TP;
cmd->phy_address = 0;
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index e85c89c..041fb7d 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -843,10 +843,11 @@ static int rtl8150_get_settings(struct net_device *netdev, struct ethtool_cmd *e
get_registers(dev, BMCR, 2, &bmcr);
get_registers(dev, ANLP, 2, &lpa);
if (bmcr & BMCR_ANENABLE) {
+ u32 speed = ((lpa & (LPA_100HALF | LPA_100FULL)) ?
+ SPEED_100 : SPEED_10);
+ ethtool_cmd_speed_set(ecmd, speed);
ecmd->autoneg = AUTONEG_ENABLE;
- ecmd->speed = (lpa & (LPA_100HALF | LPA_100FULL)) ?
- SPEED_100 : SPEED_10;
- if (ecmd->speed == SPEED_100)
+ if (speed == SPEED_100)
ecmd->duplex = (lpa & LPA_100FULL) ?
DUPLEX_FULL : DUPLEX_HALF;
else
@@ -854,8 +855,8 @@ static int rtl8150_get_settings(struct net_device *netdev, struct ethtool_cmd *e
DUPLEX_FULL : DUPLEX_HALF;
} else {
ecmd->autoneg = AUTONEG_DISABLE;
- ecmd->speed = (bmcr & BMCR_SPEED100) ?
- SPEED_100 : SPEED_10;
+ ethtool_cmd_speed_set(ecmd, ((bmcr & BMCR_SPEED100) ?
+ SPEED_100 : SPEED_10));
ecmd->duplex = (bmcr & BMCR_FULLDPLX) ?
DUPLEX_FULL : DUPLEX_HALF;
}
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 6542288..cbe953a 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -52,7 +52,7 @@ static int veth_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
cmd->supported = 0;
cmd->advertising = 0;
- cmd->speed = SPEED_10000;
+ ethtool_cmd_speed_set(cmd, SPEED_10000);
cmd->duplex = DUPLEX_FULL;
cmd->port = PORT_TP;
cmd->phy_address = 0;
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 9a8f116..06daa9d 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -3182,7 +3182,8 @@ static void velocity_ethtool_down(struct net_device *dev)
pci_set_power_state(vptr->pdev, PCI_D3hot);
}
-static int velocity_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+static int velocity_get_settings(struct net_device *dev,
+ struct ethtool_cmd *cmd)
{
struct velocity_info *vptr = netdev_priv(dev);
struct mac_regs __iomem *regs = vptr->mac_regs;
@@ -3228,12 +3229,14 @@ static int velocity_get_settings(struct net_device *dev, struct ethtool_cmd *cmd
break;
}
}
+
if (status & VELOCITY_SPEED_1000)
- cmd->speed = SPEED_1000;
+ ethtool_cmd_speed_set(cmd, SPEED_1000);
else if (status & VELOCITY_SPEED_100)
- cmd->speed = SPEED_100;
+ ethtool_cmd_speed_set(cmd, SPEED_100);
else
- cmd->speed = SPEED_10;
+ ethtool_cmd_speed_set(cmd, SPEED_10);
+
cmd->autoneg = (status & VELOCITY_AUTONEG_ENABLE) ? AUTONEG_ENABLE : AUTONEG_DISABLE;
cmd->port = PORT_TP;
cmd->transceiver = XCVR_INTERNAL;
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c
index 70c1ab9..64303eb 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethtool.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c
@@ -424,10 +424,10 @@ vmxnet3_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
ecmd->transceiver = XCVR_INTERNAL;
if (adapter->link_speed) {
- ecmd->speed = adapter->link_speed;
+ ethtool_cmd_speed_set(ecmd, adapter->link_speed);
ecmd->duplex = DUPLEX_FULL;
} else {
- ecmd->speed = -1;
+ ethtool_cmd_speed_set(ecmd, -1);
ecmd->duplex = -1;
}
return 0;
diff --git a/drivers/net/vxge/vxge-ethtool.c b/drivers/net/vxge/vxge-ethtool.c
index a70874e..92dd72d 100644
--- a/drivers/net/vxge/vxge-ethtool.c
+++ b/drivers/net/vxge/vxge-ethtool.c
@@ -59,10 +59,10 @@ static int vxge_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info)
info->transceiver = XCVR_EXTERNAL;
if (netif_carrier_ok(dev)) {
- info->speed = SPEED_10000;
+ ethtool_cmd_speed_set(info, SPEED_10000);
info->duplex = DUPLEX_FULL;
} else {
- info->speed = -1;
+ ethtool_cmd_speed_set(info, -1);
info->duplex = -1;
}
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index f4d80ad..eeabbb8 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -697,7 +697,7 @@ static int bat_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
cmd->supported = 0;
cmd->advertising = 0;
- cmd->speed = SPEED_10;
+ ethtool_cmd_speed_set(cmd, SPEED_10);
cmd->duplex = DUPLEX_FULL;
cmd->port = PORT_TP;
cmd->phy_address = 0;
--
1.7.3.1
^ permalink raw reply related
* [PATCHv2 2/4] ethtool: Call ethtool's get/set_settings callbacks with cleaned data
From: David Decotigny @ 2011-04-27 18:34 UTC (permalink / raw)
To: David S. Miller, Ben Hutchings, mirq-linux, Stanislaw Gruszka,
Alexander Duyck <alexander.h.duyc
Cc: David Decotigny
In-Reply-To: <1303001651-4074-1-git-send-email-decot@google.com>
This makes sure that when a driver calls the ethtool's
get/set_settings() callback of another driver, the data passed to it
is clean. This guarantees that speed_hi will be zeroed correctly if
the called callback doesn't explicitely set it: we are sure we don't
get a corrupted speed from the underlying driver. We also take care of
setting the cmd field appropriately (ETHTOOL_GSET/SSET).
This applies to dev_ethtool_get_settings(), which now makes sure it
sets up that ethtool command parameter correctly before passing it to
drivers. This also means that whoever calls dev_ethtool_get_settings()
does not have to clean the ethtool command parameter. This function
also becomes an exported symbol instead of an inline.
All drivers visible to make allyesconfig under x86_64 have been
updated.
Signed-off-by: David Decotigny <decot@google.com>
---
arch/mips/txx9/generic/setup_tx4939.c | 21 ++++++++-------------
drivers/net/e100.c | 2 +-
drivers/net/mdio.c | 3 +++
drivers/net/mii.c | 3 +++
drivers/net/pch_gbe/pch_gbe_main.c | 6 +++---
drivers/net/pch_gbe/pch_gbe_phy.c | 2 +-
drivers/net/pcnet32.c | 16 ++++++++--------
drivers/net/sfc/mdio_10g.c | 4 ++--
drivers/net/stmmac/stmmac_ethtool.c | 5 ++---
drivers/net/usb/asix.c | 28 +++++++++++++++-------------
drivers/net/usb/dm9601.c | 6 +++---
drivers/net/usb/smsc75xx.c | 7 ++++---
drivers/net/usb/smsc95xx.c | 7 ++++---
drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 11 +++++++----
drivers/scsi/fcoe/fcoe.c | 11 +++++++----
include/linux/ethtool.h | 4 +++-
include/linux/netdevice.h | 9 ++-------
include/rdma/ib_addr.h | 13 +++++++------
net/core/dev.c | 24 ++++++++++++++++++++++++
net/core/net-sysfs.c | 24 ++++++++++--------------
20 files changed, 117 insertions(+), 89 deletions(-)
diff --git a/arch/mips/txx9/generic/setup_tx4939.c b/arch/mips/txx9/generic/setup_tx4939.c
index 3dc19f4..e9f95dc 100644
--- a/arch/mips/txx9/generic/setup_tx4939.c
+++ b/arch/mips/txx9/generic/setup_tx4939.c
@@ -318,19 +318,15 @@ void __init tx4939_sio_init(unsigned int sclk, unsigned int cts_mask)
}
#if defined(CONFIG_TC35815) || defined(CONFIG_TC35815_MODULE)
-static int tx4939_get_eth_speed(struct net_device *dev)
+static u32 tx4939_get_eth_speed(struct net_device *dev)
{
- struct ethtool_cmd cmd = { ETHTOOL_GSET };
- int speed = 100; /* default 100Mbps */
- int err;
- if (!dev->ethtool_ops || !dev->ethtool_ops->get_settings)
- return speed;
- err = dev->ethtool_ops->get_settings(dev, &cmd);
- if (err < 0)
- return speed;
- speed = cmd.speed == SPEED_100 ? 100 : 10;
- return speed;
+ struct ethtool_cmd cmd;
+ if (dev_ethtool_get_settings(dev, &cmd))
+ return 100; /* default 100Mbps */
+
+ return ethtool_cmd_speed(&cmd);
}
+
static int tx4939_netdev_event(struct notifier_block *this,
unsigned long event,
void *ptr)
@@ -343,8 +339,7 @@ static int tx4939_netdev_event(struct notifier_block *this,
else if (dev->irq == TXX9_IRQ_BASE + TX4939_IR_ETH(1))
bit = TX4939_PCFG_SPEED1;
if (bit) {
- int speed = tx4939_get_eth_speed(dev);
- if (speed == 100)
+ if (tx4939_get_eth_speed(dev) == 100)
txx9_set64(&tx4939_ccfgptr->pcfg, bit);
else
txx9_clear64(&tx4939_ccfgptr->pcfg, bit);
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index b0aa9e6..66ba596 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -1668,7 +1668,7 @@ static void e100_adjust_adaptive_ifs(struct nic *nic, int speed, int duplex)
static void e100_watchdog(unsigned long data)
{
struct nic *nic = (struct nic *)data;
- struct ethtool_cmd cmd;
+ struct ethtool_cmd cmd = { .cmd = ETHTOOL_GSET };
netif_printk(nic, timer, KERN_DEBUG, nic->netdev,
"right now = %ld\n", jiffies);
diff --git a/drivers/net/mdio.c b/drivers/net/mdio.c
index e85bf04..2e717a2 100644
--- a/drivers/net/mdio.c
+++ b/drivers/net/mdio.c
@@ -176,6 +176,9 @@ static u32 mdio45_get_an(const struct mdio_if_info *mdio, u16 addr)
* @npage_adv: Modes currently advertised on next pages
* @npage_lpa: Modes advertised by link partner on next pages
*
+ * The @ecmd parameter is expected to have been cleared before calling
+ * mii_ethtool_gset().
+ *
* Since the CSRs for auto-negotiation using next pages are not fully
* standardised, this function does not attempt to decode them. The
* caller must pass them in.
diff --git a/drivers/net/mii.c b/drivers/net/mii.c
index 0a6c6a2..05acca7 100644
--- a/drivers/net/mii.c
+++ b/drivers/net/mii.c
@@ -58,6 +58,9 @@ static u32 mii_get_an(struct mii_if_info *mii, u16 addr)
* @mii: MII interface
* @ecmd: requested ethtool_cmd
*
+ * The @ecmd parameter is expected to have been cleared before calling
+ * mii_ethtool_gset().
+ *
* Returns 0 for success, negative on error.
*/
int mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd)
diff --git a/drivers/net/pch_gbe/pch_gbe_main.c b/drivers/net/pch_gbe/pch_gbe_main.c
index 4cc9872..f3e4b0a 100644
--- a/drivers/net/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/pch_gbe/pch_gbe_main.c
@@ -888,12 +888,12 @@ static void pch_gbe_watchdog(unsigned long data)
struct pch_gbe_adapter *adapter = (struct pch_gbe_adapter *)data;
struct net_device *netdev = adapter->netdev;
struct pch_gbe_hw *hw = &adapter->hw;
- struct ethtool_cmd cmd;
pr_debug("right now = %ld\n", jiffies);
pch_gbe_update_stats(adapter);
if ((mii_link_ok(&adapter->mii)) && (!netif_carrier_ok(netdev))) {
+ struct ethtool_cmd cmd = { .cmd = ETHTOOL_GSET };
netdev->tx_queue_len = adapter->tx_queue_len;
/* mii library handles link maintenance tasks */
if (mii_ethtool_gset(&adapter->mii, &cmd)) {
@@ -903,7 +903,7 @@ static void pch_gbe_watchdog(unsigned long data)
PCH_GBE_WATCHDOG_PERIOD));
return;
}
- hw->mac.link_speed = cmd.speed;
+ hw->mac.link_speed = ethtool_cmd_speed(&cmd);
hw->mac.link_duplex = cmd.duplex;
/* Set the RGMII control. */
pch_gbe_set_rgmii_ctrl(adapter, hw->mac.link_speed,
@@ -913,7 +913,7 @@ static void pch_gbe_watchdog(unsigned long data)
hw->mac.link_duplex);
netdev_dbg(netdev,
"Link is Up %d Mbps %s-Duplex\n",
- cmd.speed,
+ hw->mac.link_speed,
cmd.duplex == DUPLEX_FULL ? "Full" : "Half");
netif_carrier_on(netdev);
netif_wake_queue(netdev);
diff --git a/drivers/net/pch_gbe/pch_gbe_phy.c b/drivers/net/pch_gbe/pch_gbe_phy.c
index 923a687..9a8207f 100644
--- a/drivers/net/pch_gbe/pch_gbe_phy.c
+++ b/drivers/net/pch_gbe/pch_gbe_phy.c
@@ -247,7 +247,7 @@ inline void pch_gbe_phy_set_rgmii(struct pch_gbe_hw *hw)
void pch_gbe_phy_init_setting(struct pch_gbe_hw *hw)
{
struct pch_gbe_adapter *adapter;
- struct ethtool_cmd cmd;
+ struct ethtool_cmd cmd = { .cmd = ETHTOOL_GSET };
int ret;
u16 mii_reg;
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index 0a1efba..b48aba9 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -2099,7 +2099,7 @@ static int pcnet32_open(struct net_device *dev)
int first_phy = -1;
u16 bmcr;
u32 bcr9;
- struct ethtool_cmd ecmd;
+ struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET };
/*
* There is really no good other way to handle multiple PHYs
@@ -2115,9 +2115,9 @@ static int pcnet32_open(struct net_device *dev)
ecmd.port = PORT_MII;
ecmd.transceiver = XCVR_INTERNAL;
ecmd.autoneg = AUTONEG_DISABLE;
- ecmd.speed =
- lp->
- options & PCNET32_PORT_100 ? SPEED_100 : SPEED_10;
+ ethtool_cmd_speed_set(&ecmd,
+ (lp->options & PCNET32_PORT_100) ?
+ SPEED_100 : SPEED_10);
bcr9 = lp->a.read_bcr(ioaddr, 9);
if (lp->options & PCNET32_PORT_FD) {
@@ -2763,11 +2763,11 @@ static void pcnet32_check_media(struct net_device *dev, int verbose)
netif_carrier_on(dev);
if (lp->mii) {
if (netif_msg_link(lp)) {
- struct ethtool_cmd ecmd;
+ struct ethtool_cmd ecmd = {
+ .cmd = ETHTOOL_GSET };
mii_ethtool_gset(&lp->mii_if, &ecmd);
- netdev_info(dev, "link up, %sMbps, %s-duplex\n",
- (ecmd.speed == SPEED_100)
- ? "100" : "10",
+ netdev_info(dev, "link up, %uMbps, %s-duplex\n",
+ ethtool_cmd_speed(&ecmd),
(ecmd.duplex == DUPLEX_FULL)
? "full" : "half");
}
diff --git a/drivers/net/sfc/mdio_10g.c b/drivers/net/sfc/mdio_10g.c
index 19e68c2..7115914 100644
--- a/drivers/net/sfc/mdio_10g.c
+++ b/drivers/net/sfc/mdio_10g.c
@@ -232,12 +232,12 @@ void efx_mdio_set_mmds_lpower(struct efx_nic *efx,
*/
int efx_mdio_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
{
- struct ethtool_cmd prev;
+ struct ethtool_cmd prev = { .cmd = ETHTOOL_GSET };
efx->phy_op->get_settings(efx, &prev);
if (ecmd->advertising == prev.advertising &&
- ecmd->speed == prev.speed &&
+ ethtool_cmd_speed(ecmd) == ethtool_cmd_speed(&prev) &&
ecmd->duplex == prev.duplex &&
ecmd->port == prev.port &&
ecmd->autoneg == prev.autoneg)
diff --git a/drivers/net/stmmac/stmmac_ethtool.c b/drivers/net/stmmac/stmmac_ethtool.c
index 0e61ac8..6f5aaeb 100644
--- a/drivers/net/stmmac/stmmac_ethtool.c
+++ b/drivers/net/stmmac/stmmac_ethtool.c
@@ -237,13 +237,12 @@ stmmac_set_pauseparam(struct net_device *netdev,
if (phy->autoneg) {
if (netif_running(netdev)) {
- struct ethtool_cmd cmd;
+ struct ethtool_cmd cmd = { .cmd = ETHTOOL_SSET };
/* auto-negotiation automatically restarted */
- cmd.cmd = ETHTOOL_NWAY_RST;
cmd.supported = phy->supported;
cmd.advertising = phy->advertising;
cmd.autoneg = phy->autoneg;
- cmd.speed = phy->speed;
+ ethtool_cmd_speed_set(&cmd, phy->speed);
cmd.duplex = phy->duplex;
cmd.phy_address = phy->addr;
ret = phy_ethtool_sset(phy, &cmd);
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index 6140b56..6998aa6 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -847,7 +847,7 @@ static void ax88172_set_multicast(struct net_device *net)
static int ax88172_link_reset(struct usbnet *dev)
{
u8 mode;
- struct ethtool_cmd ecmd;
+ struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET };
mii_check_media(&dev->mii, 1, 1);
mii_ethtool_gset(&dev->mii, &ecmd);
@@ -856,8 +856,8 @@ static int ax88172_link_reset(struct usbnet *dev)
if (ecmd.duplex != DUPLEX_FULL)
mode |= ~AX88172_MEDIUM_FD;
- netdev_dbg(dev->net, "ax88172_link_reset() speed: %d duplex: %d setting mode to 0x%04x\n",
- ecmd.speed, ecmd.duplex, mode);
+ netdev_dbg(dev->net, "ax88172_link_reset() speed: %u duplex: %d setting mode to 0x%04x\n",
+ ethtool_cmd_speed(&ecmd), ecmd.duplex, mode);
asix_write_medium_mode(dev, mode);
@@ -947,20 +947,20 @@ static const struct ethtool_ops ax88772_ethtool_ops = {
static int ax88772_link_reset(struct usbnet *dev)
{
u16 mode;
- struct ethtool_cmd ecmd;
+ struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET };
mii_check_media(&dev->mii, 1, 1);
mii_ethtool_gset(&dev->mii, &ecmd);
mode = AX88772_MEDIUM_DEFAULT;
- if (ecmd.speed != SPEED_100)
+ if (ethtool_cmd_speed(&ecmd) != SPEED_100)
mode &= ~AX_MEDIUM_PS;
if (ecmd.duplex != DUPLEX_FULL)
mode &= ~AX_MEDIUM_FD;
- netdev_dbg(dev->net, "ax88772_link_reset() speed: %d duplex: %d setting mode to 0x%04x\n",
- ecmd.speed, ecmd.duplex, mode);
+ netdev_dbg(dev->net, "ax88772_link_reset() speed: %u duplex: %d setting mode to 0x%04x\n",
+ ethtool_cmd_speed(&ecmd), ecmd.duplex, mode);
asix_write_medium_mode(dev, mode);
@@ -1173,18 +1173,20 @@ static int marvell_led_status(struct usbnet *dev, u16 speed)
static int ax88178_link_reset(struct usbnet *dev)
{
u16 mode;
- struct ethtool_cmd ecmd;
+ struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET };
struct asix_data *data = (struct asix_data *)&dev->data;
+ u32 speed;
netdev_dbg(dev->net, "ax88178_link_reset()\n");
mii_check_media(&dev->mii, 1, 1);
mii_ethtool_gset(&dev->mii, &ecmd);
mode = AX88178_MEDIUM_DEFAULT;
+ speed = ethtool_cmd_speed(&ecmd);
- if (ecmd.speed == SPEED_1000)
+ if (speed == SPEED_1000)
mode |= AX_MEDIUM_GM;
- else if (ecmd.speed == SPEED_100)
+ else if (speed == SPEED_100)
mode |= AX_MEDIUM_PS;
else
mode &= ~(AX_MEDIUM_PS | AX_MEDIUM_GM);
@@ -1196,13 +1198,13 @@ static int ax88178_link_reset(struct usbnet *dev)
else
mode &= ~AX_MEDIUM_FD;
- netdev_dbg(dev->net, "ax88178_link_reset() speed: %d duplex: %d setting mode to 0x%04x\n",
- ecmd.speed, ecmd.duplex, mode);
+ netdev_dbg(dev->net, "ax88178_link_reset() speed: %u duplex: %d setting mode to 0x%04x\n",
+ speed, ecmd.duplex, mode);
asix_write_medium_mode(dev, mode);
if (data->phymode == PHY_MODE_MARVELL && data->ledmode)
- marvell_led_status(dev, ecmd.speed);
+ marvell_led_status(dev, speed);
return 0;
}
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
index 5002f5b..1d93133 100644
--- a/drivers/net/usb/dm9601.c
+++ b/drivers/net/usb/dm9601.c
@@ -599,13 +599,13 @@ static void dm9601_status(struct usbnet *dev, struct urb *urb)
static int dm9601_link_reset(struct usbnet *dev)
{
- struct ethtool_cmd ecmd;
+ struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET };
mii_check_media(&dev->mii, 1, 1);
mii_ethtool_gset(&dev->mii, &ecmd);
- netdev_dbg(dev->net, "link_reset() speed: %d duplex: %d\n",
- ecmd.speed, ecmd.duplex);
+ netdev_dbg(dev->net, "link_reset() speed: %u duplex: %d\n",
+ ethtool_cmd_speed(&ecmd), ecmd.duplex);
return 0;
}
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index 860a20c..15b3d68 100644
--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -503,7 +503,7 @@ static int smsc75xx_update_flowcontrol(struct usbnet *dev, u8 duplex,
static int smsc75xx_link_reset(struct usbnet *dev)
{
struct mii_if_info *mii = &dev->mii;
- struct ethtool_cmd ecmd;
+ struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET };
u16 lcladv, rmtadv;
int ret;
@@ -519,8 +519,9 @@ static int smsc75xx_link_reset(struct usbnet *dev)
lcladv = smsc75xx_mdio_read(dev->net, mii->phy_id, MII_ADVERTISE);
rmtadv = smsc75xx_mdio_read(dev->net, mii->phy_id, MII_LPA);
- netif_dbg(dev, link, dev->net, "speed: %d duplex: %d lcladv: %04x"
- " rmtadv: %04x", ecmd.speed, ecmd.duplex, lcladv, rmtadv);
+ netif_dbg(dev, link, dev->net, "speed: %u duplex: %d lcladv: %04x"
+ " rmtadv: %04x", ethtool_cmd_speed(&ecmd),
+ ecmd.duplex, lcladv, rmtadv);
return smsc75xx_update_flowcontrol(dev, ecmd.duplex, lcladv, rmtadv);
}
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 24f4b37..b374a99 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -457,7 +457,7 @@ static int smsc95xx_link_reset(struct usbnet *dev)
{
struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
struct mii_if_info *mii = &dev->mii;
- struct ethtool_cmd ecmd;
+ struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET };
unsigned long flags;
u16 lcladv, rmtadv;
u32 intdata;
@@ -472,8 +472,9 @@ static int smsc95xx_link_reset(struct usbnet *dev)
lcladv = smsc95xx_mdio_read(dev->net, mii->phy_id, MII_ADVERTISE);
rmtadv = smsc95xx_mdio_read(dev->net, mii->phy_id, MII_LPA);
- netif_dbg(dev, link, dev->net, "speed: %d duplex: %d lcladv: %04x rmtadv: %04x\n",
- ecmd.speed, ecmd.duplex, lcladv, rmtadv);
+ netif_dbg(dev, link, dev->net,
+ "speed: %u duplex: %d lcladv: %04x rmtadv: %04x\n",
+ ethtool_cmd_speed(&ecmd), ecmd.duplex, lcladv, rmtadv);
spin_lock_irqsave(&pdata->mac_cr_lock, flags);
if (ecmd.duplex != DUPLEX_FULL) {
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index e2e6475..cd05019 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -664,7 +664,7 @@ static void bnx2fc_link_speed_update(struct fc_lport *lport)
struct fcoe_port *port = lport_priv(lport);
struct bnx2fc_hba *hba = port->priv;
struct net_device *netdev = hba->netdev;
- struct ethtool_cmd ecmd = { ETHTOOL_GSET };
+ struct ethtool_cmd ecmd;
if (!dev_ethtool_get_settings(netdev, &ecmd)) {
lport->link_supported_speeds &=
@@ -675,12 +675,15 @@ static void bnx2fc_link_speed_update(struct fc_lport *lport)
if (ecmd.supported & SUPPORTED_10000baseT_Full)
lport->link_supported_speeds |= FC_PORTSPEED_10GBIT;
- if (ecmd.speed == SPEED_1000)
+ switch (ethtool_cmd_speed(&ecmd)) {
+ case SPEED_1000:
lport->link_speed = FC_PORTSPEED_1GBIT;
- if (ecmd.speed == SPEED_10000)
+ break;
+ case SPEED_10000:
lport->link_speed = FC_PORTSPEED_10GBIT;
+ break;
+ }
}
- return;
}
static int bnx2fc_link_ok(struct fc_lport *lport)
{
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index bde6ee5..04f346b 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -2026,7 +2026,7 @@ out_nodev:
int fcoe_link_speed_update(struct fc_lport *lport)
{
struct net_device *netdev = fcoe_netdev(lport);
- struct ethtool_cmd ecmd = { ETHTOOL_GSET };
+ struct ethtool_cmd ecmd;
if (!dev_ethtool_get_settings(netdev, &ecmd)) {
lport->link_supported_speeds &=
@@ -2037,11 +2037,14 @@ int fcoe_link_speed_update(struct fc_lport *lport)
if (ecmd.supported & SUPPORTED_10000baseT_Full)
lport->link_supported_speeds |=
FC_PORTSPEED_10GBIT;
- if (ecmd.speed == SPEED_1000)
+ switch (ethtool_cmd_speed(&ecmd)) {
+ case SPEED_1000:
lport->link_speed = FC_PORTSPEED_1GBIT;
- if (ecmd.speed == SPEED_10000)
+ break;
+ case SPEED_10000:
lport->link_speed = FC_PORTSPEED_10GBIT;
-
+ break;
+ }
return 0;
}
return -1;
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 7e6e0a8..4194a20 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -744,7 +744,9 @@ bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
/**
* struct ethtool_ops - optional netdev operations
* @get_settings: Get various device settings including Ethernet link
- * settings. Returns a negative error code or zero.
+ * settings. The @cmd parameter is expected to have been cleared
+ * before get_settings is called. Returns a negative error code or
+ * zero.
* @set_settings: Set various device settings including Ethernet link
* settings. Returns a negative error code or zero.
* @get_drvinfo: Report driver/device information. Should only set the
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index cb8178a..3f09a71 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2590,13 +2590,8 @@ static inline int netif_is_bond_slave(struct net_device *dev)
extern struct pernet_operations __net_initdata loopback_net_ops;
-static inline int dev_ethtool_get_settings(struct net_device *dev,
- struct ethtool_cmd *cmd)
-{
- if (!dev->ethtool_ops || !dev->ethtool_ops->get_settings)
- return -EOPNOTSUPP;
- return dev->ethtool_ops->get_settings(dev, cmd);
-}
+int dev_ethtool_get_settings(struct net_device *dev,
+ struct ethtool_cmd *cmd);
static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev)
{
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
index b5fc9f3..ae8c68f 100644
--- a/include/rdma/ib_addr.h
+++ b/include/rdma/ib_addr.h
@@ -217,18 +217,19 @@ static inline enum ib_mtu iboe_get_mtu(int mtu)
static inline int iboe_get_rate(struct net_device *dev)
{
struct ethtool_cmd cmd;
+ u32 speed;
- if (!dev->ethtool_ops || !dev->ethtool_ops->get_settings ||
- dev->ethtool_ops->get_settings(dev, &cmd))
+ if (dev_ethtool_get_settings(dev, &cmd))
return IB_RATE_PORT_CURRENT;
- if (cmd.speed >= 40000)
+ speed = ethtool_cmd_speed(&cmd);
+ if (speed >= 40000)
return IB_RATE_40_GBPS;
- else if (cmd.speed >= 30000)
+ else if (speed >= 30000)
return IB_RATE_30_GBPS;
- else if (cmd.speed >= 20000)
+ else if (speed >= 20000)
return IB_RATE_20_GBPS;
- else if (cmd.speed >= 10000)
+ else if (speed >= 10000)
return IB_RATE_10_GBPS;
else
return IB_RATE_PORT_CURRENT;
diff --git a/net/core/dev.c b/net/core/dev.c
index 3bbb4c2..36e57fb 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4496,6 +4496,30 @@ void dev_set_rx_mode(struct net_device *dev)
}
/**
+ * dev_ethtool_get_settings - call device's ethtool::get_settings()
+ * @dev: device
+ * @cmd: memory area for ethtool_cmd::get_settings() result
+ *
+ * The cmd arg is initialized properly (cleared and
+ * ethtoo_cmd::cmd field set to ETHTOOL_GSET).
+ *
+ * Return device's ethtool_cmd::get_settings() result value or
+ * -EOPNOTSUPP when device doesn't expose
+ * ethtool_cmd::get_settings() operation.
+ */
+int dev_ethtool_get_settings(struct net_device *dev,
+ struct ethtool_cmd *cmd)
+{
+ if (!dev->ethtool_ops || !dev->ethtool_ops->get_settings)
+ return -EOPNOTSUPP;
+
+ memset(cmd, 0, sizeof(struct ethtool_cmd));
+ cmd->cmd = ETHTOOL_GSET;
+ return dev->ethtool_ops->get_settings(dev, cmd);
+}
+EXPORT_SYMBOL(dev_ethtool_get_settings);
+
+/**
* dev_get_flags - get flags reported to userspace
* @dev: device
*
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 5ceb257..381813e 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -28,6 +28,7 @@
static const char fmt_hex[] = "%#x\n";
static const char fmt_long_hex[] = "%#lx\n";
static const char fmt_dec[] = "%d\n";
+static const char fmt_udec[] = "%u\n";
static const char fmt_ulong[] = "%lu\n";
static const char fmt_u64[] = "%llu\n";
@@ -145,13 +146,10 @@ static ssize_t show_speed(struct device *dev,
if (!rtnl_trylock())
return restart_syscall();
- if (netif_running(netdev) &&
- netdev->ethtool_ops &&
- netdev->ethtool_ops->get_settings) {
- struct ethtool_cmd cmd = { ETHTOOL_GSET };
-
- if (!netdev->ethtool_ops->get_settings(netdev, &cmd))
- ret = sprintf(buf, fmt_dec, ethtool_cmd_speed(&cmd));
+ if (netif_running(netdev)) {
+ struct ethtool_cmd cmd;
+ if (!dev_ethtool_get_settings(netdev, &cmd))
+ ret = sprintf(buf, fmt_udec, ethtool_cmd_speed(&cmd));
}
rtnl_unlock();
return ret;
@@ -166,13 +164,11 @@ static ssize_t show_duplex(struct device *dev,
if (!rtnl_trylock())
return restart_syscall();
- if (netif_running(netdev) &&
- netdev->ethtool_ops &&
- netdev->ethtool_ops->get_settings) {
- struct ethtool_cmd cmd = { ETHTOOL_GSET };
-
- if (!netdev->ethtool_ops->get_settings(netdev, &cmd))
- ret = sprintf(buf, "%s\n", cmd.duplex ? "full" : "half");
+ if (netif_running(netdev)) {
+ struct ethtool_cmd cmd;
+ if (!dev_ethtool_get_settings(netdev, &cmd))
+ ret = sprintf(buf, "%s\n",
+ cmd.duplex ? "full" : "half");
}
rtnl_unlock();
return ret;
--
1.7.3.1
^ permalink raw reply related
* [PATCHv2 3/4] ethtool: Use the full 32 bit speed range in ethtool's set_settings
From: David Decotigny @ 2011-04-27 18:34 UTC (permalink / raw)
To: David S. Miller, Ben Hutchings, mirq-linux, Stanislaw Gruszka,
Alexander Duyck <alexander.h.duyc
Cc: David Decotigny
In-Reply-To: <1303001651-4074-1-git-send-email-decot@google.com>
This makes sure the ethtool's set_settings() callback of network
drivers don't ignore the 16 most significant bits when ethtool calls
their set_settings().
All the driver compiled with make allyesconfig on x86_64 have been
updated.
Signed-off-by: David Decotigny <decot@google.com>
---
drivers/net/acenic.c | 2 +-
drivers/net/atl1c/atl1c_ethtool.c | 5 +++--
drivers/net/atlx/atl1.c | 5 +++--
drivers/net/b44.c | 7 ++++---
drivers/net/bna/bnad_ethtool.c | 3 ++-
drivers/net/bnx2.c | 12 ++++++------
drivers/net/cassini.c | 12 +++++++-----
drivers/net/chelsio/cxgb2.c | 7 ++++---
drivers/net/cxgb3/cxgb3_main.c | 10 ++++++----
drivers/net/cxgb4/cxgb4_main.c | 11 ++++++-----
drivers/net/dl2k.c | 25 ++++++++++---------------
drivers/net/e100.c | 8 +++++---
drivers/net/e1000/e1000_ethtool.c | 6 ++++--
drivers/net/e1000e/ethtool.c | 3 ++-
drivers/net/enc28j60.c | 3 ++-
drivers/net/forcedeth.c | 11 ++++++-----
drivers/net/igb/igb_ethtool.c | 3 ++-
drivers/net/ixgb/ixgb_ethtool.c | 3 ++-
drivers/net/ixgbe/ixgbe_ethtool.c | 3 ++-
drivers/net/jme.c | 3 ++-
drivers/net/ksz884x.c | 9 +++++----
drivers/net/mii.c | 13 +++++++------
drivers/net/mlx4/en_ethtool.c | 3 ++-
drivers/net/natsemi.c | 5 +++--
drivers/net/netxen/netxen_nic_ethtool.c | 5 +++--
drivers/net/niu.c | 2 +-
drivers/net/pch_gbe/pch_gbe_ethtool.c | 7 ++++---
drivers/net/pcmcia/smc91c92_cs.c | 4 ++--
drivers/net/phy/phy.c | 10 ++++++----
drivers/net/qlcnic/qlcnic_ethtool.c | 4 ++--
drivers/net/r8169.c | 3 ++-
drivers/net/s2io.c | 2 +-
drivers/net/sc92031.c | 5 +++--
drivers/net/sfc/ethtool.c | 3 ++-
drivers/net/sfc/mcdi_phy.c | 4 ++--
drivers/net/skge.c | 4 ++--
drivers/net/sky2.c | 4 ++--
drivers/net/sungem.c | 9 +++++----
drivers/net/sunhme.c | 6 +++---
drivers/net/tg3.c | 9 +++++----
drivers/net/tulip/de2104x.c | 5 +++--
drivers/net/typhoon.c | 17 +++++++++--------
drivers/net/via-velocity.c | 10 ++++++----
drivers/net/vxge/vxge-ethtool.c | 3 ++-
net/bridge/br_if.c | 4 ++--
45 files changed, 163 insertions(+), 129 deletions(-)
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c
index ee648fe..0b4d8d1 100644
--- a/drivers/net/acenic.c
+++ b/drivers/net/acenic.c
@@ -2718,7 +2718,7 @@ static int ace_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
link |= LNK_TX_FLOW_CTL_Y;
if (ecmd->autoneg == AUTONEG_ENABLE)
link |= LNK_NEGOTIATE;
- if (ecmd->speed != speed) {
+ if (ethtool_cmd_speed(ecmd) != speed) {
link &= ~(LNK_1000MB | LNK_100MB | LNK_10MB);
switch (speed) {
case SPEED_1000:
diff --git a/drivers/net/atl1c/atl1c_ethtool.c b/drivers/net/atl1c/atl1c_ethtool.c
index 3af5a33..b1eceee 100644
--- a/drivers/net/atl1c/atl1c_ethtool.c
+++ b/drivers/net/atl1c/atl1c_ethtool.c
@@ -77,7 +77,8 @@ static int atl1c_set_settings(struct net_device *netdev,
if (ecmd->autoneg == AUTONEG_ENABLE) {
autoneg_advertised = ADVERTISED_Autoneg;
} else {
- if (ecmd->speed == SPEED_1000) {
+ u32 speed = ethtool_cmd_speed(ecmd);
+ if (speed == SPEED_1000) {
if (ecmd->duplex != DUPLEX_FULL) {
if (netif_msg_link(adapter))
dev_warn(&adapter->pdev->dev,
@@ -86,7 +87,7 @@ static int atl1c_set_settings(struct net_device *netdev,
return -EINVAL;
}
autoneg_advertised = ADVERTISED_1000baseT_Full;
- } else if (ecmd->speed == SPEED_100) {
+ } else if (speed == SPEED_100) {
if (ecmd->duplex == DUPLEX_FULL)
autoneg_advertised = ADVERTISED_100baseT_Full;
else
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index dffa691..37a092f 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -3268,7 +3268,8 @@ static int atl1_set_settings(struct net_device *netdev,
if (ecmd->autoneg == AUTONEG_ENABLE)
hw->media_type = MEDIA_TYPE_AUTO_SENSOR;
else {
- if (ecmd->speed == SPEED_1000) {
+ u32 speed = ethtool_cmd_speed(ecmd);
+ if (speed == SPEED_1000) {
if (ecmd->duplex != DUPLEX_FULL) {
if (netif_msg_link(adapter))
dev_warn(&adapter->pdev->dev,
@@ -3277,7 +3278,7 @@ static int atl1_set_settings(struct net_device *netdev,
goto exit_sset;
}
hw->media_type = MEDIA_TYPE_1000M_FULL;
- } else if (ecmd->speed == SPEED_100) {
+ } else if (speed == SPEED_100) {
if (ecmd->duplex == DUPLEX_FULL)
hw->media_type = MEDIA_TYPE_100M_FULL;
else
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 2e2b762..909cc4b 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -1831,6 +1831,7 @@ static int b44_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
static int b44_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
struct b44 *bp = netdev_priv(dev);
+ u32 speed = ethtool_cmd_speed(cmd);
/* We do not support gigabit. */
if (cmd->autoneg == AUTONEG_ENABLE) {
@@ -1838,8 +1839,8 @@ static int b44_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
(ADVERTISED_1000baseT_Half |
ADVERTISED_1000baseT_Full))
return -EINVAL;
- } else if ((cmd->speed != SPEED_100 &&
- cmd->speed != SPEED_10) ||
+ } else if ((speed != SPEED_100 &&
+ speed != SPEED_10) ||
(cmd->duplex != DUPLEX_HALF &&
cmd->duplex != DUPLEX_FULL)) {
return -EINVAL;
@@ -1873,7 +1874,7 @@ static int b44_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
} else {
bp->flags |= B44_FLAG_FORCE_LINK;
bp->flags &= ~(B44_FLAG_100_BASE_T | B44_FLAG_FULL_DUPLEX);
- if (cmd->speed == SPEED_100)
+ if (speed == SPEED_100)
bp->flags |= B44_FLAG_100_BASE_T;
if (cmd->duplex == DUPLEX_FULL)
bp->flags |= B44_FLAG_FULL_DUPLEX;
diff --git a/drivers/net/bna/bnad_ethtool.c b/drivers/net/bna/bnad_ethtool.c
index c51e078e..ae1e118 100644
--- a/drivers/net/bna/bnad_ethtool.c
+++ b/drivers/net/bna/bnad_ethtool.c
@@ -256,7 +256,8 @@ bnad_set_settings(struct net_device *netdev, struct ethtool_cmd *cmd)
/* 10G full duplex setting supported only */
if (cmd->autoneg == AUTONEG_ENABLE)
return -EOPNOTSUPP; else {
- if ((cmd->speed == SPEED_10000) && (cmd->duplex == DUPLEX_FULL))
+ if ((ethtool_cmd_speed(cmd) == SPEED_10000)
+ && (cmd->duplex == DUPLEX_FULL))
return 0;
}
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index bf729ee..e43efd8 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -6758,21 +6758,21 @@ bnx2_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
advertising |= ADVERTISED_Autoneg;
}
else {
+ u32 speed = ethtool_cmd_speed(cmd);
if (cmd->port == PORT_FIBRE) {
- if ((cmd->speed != SPEED_1000 &&
- cmd->speed != SPEED_2500) ||
+ if ((speed != SPEED_1000 &&
+ speed != SPEED_2500) ||
(cmd->duplex != DUPLEX_FULL))
goto err_out_unlock;
- if (cmd->speed == SPEED_2500 &&
+ if (speed == SPEED_2500 &&
!(bp->phy_flags & BNX2_PHY_FLAG_2_5G_CAPABLE))
goto err_out_unlock;
- }
- else if (cmd->speed == SPEED_1000 || cmd->speed == SPEED_2500)
+ } else if (speed == SPEED_1000 || speed == SPEED_2500)
goto err_out_unlock;
autoneg &= ~AUTONEG_SPEED;
- req_line_speed = cmd->speed;
+ req_line_speed = speed;
req_duplex = cmd->duplex;
advertising = 0;
}
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 143a28c..a6c3f8c 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -709,10 +709,11 @@ static void cas_begin_auto_negotiation(struct cas *cp, struct ethtool_cmd *ep)
if (ep->autoneg == AUTONEG_ENABLE)
cp->link_cntl = BMCR_ANENABLE;
else {
+ u32 speed = ethtool_cmd_speed(ep);
cp->link_cntl = 0;
- if (ep->speed == SPEED_100)
+ if (speed == SPEED_100)
cp->link_cntl |= BMCR_SPEED100;
- else if (ep->speed == SPEED_1000)
+ else if (speed == SPEED_1000)
cp->link_cntl |= CAS_BMCR_SPEED1000;
if (ep->duplex == DUPLEX_FULL)
cp->link_cntl |= BMCR_FULLDPLX;
@@ -4653,6 +4654,7 @@ static int cas_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
struct cas *cp = netdev_priv(dev);
unsigned long flags;
+ u32 speed = ethtool_cmd_speed(cmd);
/* Verify the settings we care about. */
if (cmd->autoneg != AUTONEG_ENABLE &&
@@ -4660,9 +4662,9 @@ static int cas_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
return -EINVAL;
if (cmd->autoneg == AUTONEG_DISABLE &&
- ((cmd->speed != SPEED_1000 &&
- cmd->speed != SPEED_100 &&
- cmd->speed != SPEED_10) ||
+ ((speed != SPEED_1000 &&
+ speed != SPEED_100 &&
+ speed != SPEED_10) ||
(cmd->duplex != DUPLEX_HALF &&
cmd->duplex != DUPLEX_FULL)))
return -EINVAL;
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c
index 5f82c9c..8e14d65 100644
--- a/drivers/net/chelsio/cxgb2.c
+++ b/drivers/net/chelsio/cxgb2.c
@@ -638,11 +638,12 @@ static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
return -EOPNOTSUPP; /* can't change speed/duplex */
if (cmd->autoneg == AUTONEG_DISABLE) {
- int cap = speed_duplex_to_caps(cmd->speed, cmd->duplex);
+ u32 speed = ethtool_cmd_speed(cmd);
+ int cap = speed_duplex_to_caps(speed, cmd->duplex);
- if (!(lc->supported & cap) || cmd->speed == SPEED_1000)
+ if (!(lc->supported & cap) || (speed == SPEED_1000))
return -EINVAL;
- lc->requested_speed = cmd->speed;
+ lc->requested_speed = speed;
lc->requested_duplex = cmd->duplex;
lc->advertising = 0;
} else {
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 0404918..0526715 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -1821,7 +1821,8 @@ static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
* being requested.
*/
if (cmd->autoneg == AUTONEG_DISABLE) {
- int cap = speed_duplex_to_caps(cmd->speed, cmd->duplex);
+ u32 speed = ethtool_cmd_speed(cmd);
+ int cap = speed_duplex_to_caps(speed, cmd->duplex);
if (lc->supported & cap)
return 0;
}
@@ -1829,11 +1830,12 @@ static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
}
if (cmd->autoneg == AUTONEG_DISABLE) {
- int cap = speed_duplex_to_caps(cmd->speed, cmd->duplex);
+ u32 speed = ethtool_cmd_speed(cmd);
+ int cap = speed_duplex_to_caps(speed, cmd->duplex);
- if (!(lc->supported & cap) || cmd->speed == SPEED_1000)
+ if (!(lc->supported & cap) || (speed == SPEED_1000))
return -EINVAL;
- lc->requested_speed = cmd->speed;
+ lc->requested_speed = speed;
lc->requested_duplex = cmd->duplex;
lc->advertising = 0;
} else {
diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c
index bdc868c..73565f3 100644
--- a/drivers/net/cxgb4/cxgb4_main.c
+++ b/drivers/net/cxgb4/cxgb4_main.c
@@ -1460,6 +1460,7 @@ static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
unsigned int cap;
struct port_info *p = netdev_priv(dev);
struct link_config *lc = &p->link_cfg;
+ u32 speed = ethtool_cmd_speed(cmd);
if (cmd->duplex != DUPLEX_FULL) /* only full-duplex supported */
return -EINVAL;
@@ -1470,16 +1471,16 @@ static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
* being requested.
*/
if (cmd->autoneg == AUTONEG_DISABLE &&
- (lc->supported & speed_to_caps(cmd->speed)))
- return 0;
+ (lc->supported & speed_to_caps(speed)))
+ return 0;
return -EINVAL;
}
if (cmd->autoneg == AUTONEG_DISABLE) {
- cap = speed_to_caps(cmd->speed);
+ cap = speed_to_caps(speed);
- if (!(lc->supported & cap) || cmd->speed == SPEED_1000 ||
- cmd->speed == SPEED_10000)
+ if (!(lc->supported & cap) || (speed == SPEED_1000) ||
+ (ethtool_cmd_speed(cmd) == SPEED_10000))
return -EINVAL;
lc->requested_speed = cap;
lc->advertising = 0;
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index c05db60..ed3cb6a 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -1219,31 +1219,26 @@ static int rio_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
} else {
np->an_enable = 0;
if (np->speed == 1000) {
- cmd->speed = SPEED_100;
+ ethtool_cmd_speed_set(cmd, SPEED_100);
cmd->duplex = DUPLEX_FULL;
printk("Warning!! Can't disable Auto negotiation in 1000Mbps, change to Manual 100Mbps, Full duplex.\n");
}
- switch(cmd->speed + cmd->duplex) {
+ switch (ethtool_cmd_speed(cmd)) {
- case SPEED_10 + DUPLEX_HALF:
+ case SPEED_10:
np->speed = 10;
- np->full_duplex = 0;
+ np->full_duplex = (cmd->duplex == DUPLEX_FULL) ? 1 : 0;
break;
- case SPEED_10 + DUPLEX_FULL:
- np->speed = 10;
- np->full_duplex = 1;
- break;
- case SPEED_100 + DUPLEX_HALF:
+ case SPEED_100:
np->speed = 100;
- np->full_duplex = 0;
+ np->full_duplex = (cmd->duplex == DUPLEX_FULL) ? 1 : 0;
break;
- case SPEED_100 + DUPLEX_FULL:
- np->speed = 100;
- np->full_duplex = 1;
+
+ case SPEED_1000:
+ /* handled above */
break;
- case SPEED_1000 + DUPLEX_HALF:/* not supported */
- case SPEED_1000 + DUPLEX_FULL:/* not supported */
+
default:
return -EINVAL;
}
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 66ba596..c810cda 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -1669,6 +1669,7 @@ static void e100_watchdog(unsigned long data)
{
struct nic *nic = (struct nic *)data;
struct ethtool_cmd cmd = { .cmd = ETHTOOL_GSET };
+ u32 speed;
netif_printk(nic, timer, KERN_DEBUG, nic->netdev,
"right now = %ld\n", jiffies);
@@ -1676,10 +1677,11 @@ static void e100_watchdog(unsigned long data)
/* mii library handles link maintenance tasks */
mii_ethtool_gset(&nic->mii, &cmd);
+ speed = ethtool_cmd_speed(&cmd);
if (mii_link_ok(&nic->mii) && !netif_carrier_ok(nic->netdev)) {
netdev_info(nic->netdev, "NIC Link is Up %u Mbps %s Duplex\n",
- cmd.speed == SPEED_100 ? 100 : 10,
+ speed == SPEED_100 ? 100 : 10,
cmd.duplex == DUPLEX_FULL ? "Full" : "Half");
} else if (!mii_link_ok(&nic->mii) && netif_carrier_ok(nic->netdev)) {
netdev_info(nic->netdev, "NIC Link is Down\n");
@@ -1698,13 +1700,13 @@ static void e100_watchdog(unsigned long data)
spin_unlock_irq(&nic->cmd_lock);
e100_update_stats(nic);
- e100_adjust_adaptive_ifs(nic, cmd.speed, cmd.duplex);
+ e100_adjust_adaptive_ifs(nic, speed, cmd.duplex);
if (nic->mac <= mac_82557_D100_C)
/* Issue a multicast command to workaround a 557 lock up */
e100_set_multicast_list(nic->netdev);
- if (nic->flags & ich && cmd.speed==SPEED_10 && cmd.duplex==DUPLEX_HALF)
+ if (nic->flags & ich && speed == SPEED_10 && cmd.duplex == DUPLEX_HALF)
/* Need SW workaround for ICH[x] 10Mbps/half duplex Tx hang. */
nic->flags |= ich_10h_workaround;
else
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index dd70738..a53629d 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -197,11 +197,13 @@ static int e1000_set_settings(struct net_device *netdev,
ADVERTISED_TP |
ADVERTISED_Autoneg;
ecmd->advertising = hw->autoneg_advertised;
- } else
- if (e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) {
+ } else {
+ u32 speed = ethtool_cmd_speed(ecmd);
+ if (e1000_set_spd_dplx(adapter, speed + ecmd->duplex)) {
clear_bit(__E1000_RESETTING, &adapter->flags);
return -EINVAL;
}
+ }
/* reset the link */
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index a31d280..1dd81b2 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -269,7 +269,8 @@ static int e1000_set_settings(struct net_device *netdev,
if (adapter->fc_autoneg)
hw->fc.requested_mode = e1000_fc_default;
} else {
- if (e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) {
+ u32 speed = ethtool_cmd_speed(ecmd);
+ if (e1000_set_spd_dplx(adapter, speed + ecmd->duplex)) {
clear_bit(__E1000_RESETTING, &adapter->state);
return -EINVAL;
}
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
index 907b05a..81a7937 100644
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60.c
@@ -1499,7 +1499,8 @@ enc28j60_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
static int
enc28j60_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
- return enc28j60_setlink(dev, cmd->autoneg, cmd->speed, cmd->duplex);
+ return enc28j60_setlink(dev, cmd->autoneg,
+ ethtool_cmd_speed(cmd), cmd->duplex);
}
static u32 enc28j60_get_msglevel(struct net_device *dev)
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 0e1c76a..d24b3f3 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -4029,6 +4029,7 @@ static int nv_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
static int nv_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
{
struct fe_priv *np = netdev_priv(dev);
+ u32 speed = ethtool_cmd_speed(ecmd);
if (ecmd->port != PORT_MII)
return -EINVAL;
@@ -4054,7 +4055,7 @@ static int nv_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
/* Note: autonegotiation disable, speed 1000 intentionally
* forbidden - no one should need that. */
- if (ecmd->speed != SPEED_10 && ecmd->speed != SPEED_100)
+ if (speed != SPEED_10 && speed != SPEED_100)
return -EINVAL;
if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL)
return -EINVAL;
@@ -4138,13 +4139,13 @@ static int nv_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
adv = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ);
adv &= ~(ADVERTISE_ALL | ADVERTISE_100BASE4 | ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM);
- if (ecmd->speed == SPEED_10 && ecmd->duplex == DUPLEX_HALF)
+ if (speed == SPEED_10 && ecmd->duplex == DUPLEX_HALF)
adv |= ADVERTISE_10HALF;
- if (ecmd->speed == SPEED_10 && ecmd->duplex == DUPLEX_FULL)
+ if (speed == SPEED_10 && ecmd->duplex == DUPLEX_FULL)
adv |= ADVERTISE_10FULL;
- if (ecmd->speed == SPEED_100 && ecmd->duplex == DUPLEX_HALF)
+ if (speed == SPEED_100 && ecmd->duplex == DUPLEX_HALF)
adv |= ADVERTISE_100HALF;
- if (ecmd->speed == SPEED_100 && ecmd->duplex == DUPLEX_FULL)
+ if (speed == SPEED_100 && ecmd->duplex == DUPLEX_FULL)
adv |= ADVERTISE_100FULL;
np->pause_flags &= ~(NV_PAUSEFRAME_AUTONEG|NV_PAUSEFRAME_RX_ENABLE|NV_PAUSEFRAME_TX_ENABLE);
if (np->pause_flags & NV_PAUSEFRAME_RX_REQ) {/* for rx we set both advertisements but disable tx pause */
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c
index d976733..2cc221b 100644
--- a/drivers/net/igb/igb_ethtool.c
+++ b/drivers/net/igb/igb_ethtool.c
@@ -223,7 +223,8 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
if (adapter->fc_autoneg)
hw->fc.requested_mode = e1000_fc_default;
} else {
- if (igb_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) {
+ u32 speed = ethtool_cmd_speed(ecmd);
+ if (igb_set_spd_dplx(adapter, speed + ecmd->duplex)) {
clear_bit(__IGB_RESETTING, &adapter->state);
return -EINVAL;
}
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index cc53aa1..edb3d7e 100644
--- a/drivers/net/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ixgb/ixgb_ethtool.c
@@ -129,9 +129,10 @@ static int
ixgb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
{
struct ixgb_adapter *adapter = netdev_priv(netdev);
+ u32 speed = ethtool_cmd_speed(ecmd);
if (ecmd->autoneg == AUTONEG_ENABLE ||
- ecmd->speed + ecmd->duplex != SPEED_10000 + DUPLEX_FULL)
+ (speed + ecmd->duplex != SPEED_10000 + DUPLEX_FULL))
return -EINVAL;
if (netif_running(adapter->netdev)) {
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index 5005a36..e1c3576 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -346,9 +346,10 @@ static int ixgbe_set_settings(struct net_device *netdev,
}
} else {
/* in this case we currently only support 10Gb/FULL */
+ u32 speed = ethtool_cmd_speed(ecmd);
if ((ecmd->autoneg == AUTONEG_ENABLE) ||
(ecmd->advertising != ADVERTISED_10000baseT_Full) ||
- (ecmd->speed + ecmd->duplex != SPEED_10000 + DUPLEX_FULL))
+ (speed + ecmd->duplex != SPEED_10000 + DUPLEX_FULL))
return -EINVAL;
}
diff --git a/drivers/net/jme.c b/drivers/net/jme.c
index be4773f..b5b174a 100644
--- a/drivers/net/jme.c
+++ b/drivers/net/jme.c
@@ -2555,7 +2555,8 @@ jme_set_settings(struct net_device *netdev,
struct jme_adapter *jme = netdev_priv(netdev);
int rc, fdc = 0;
- if (ecmd->speed == SPEED_1000 && ecmd->autoneg != AUTONEG_ENABLE)
+ if (ethtool_cmd_speed(ecmd) == SPEED_1000
+ && ecmd->autoneg != AUTONEG_ENABLE)
return -EINVAL;
/*
diff --git a/drivers/net/ksz884x.c b/drivers/net/ksz884x.c
index 2c37a38..66037b1 100644
--- a/drivers/net/ksz884x.c
+++ b/drivers/net/ksz884x.c
@@ -5998,6 +5998,7 @@ static int netdev_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
struct dev_priv *priv = netdev_priv(dev);
struct dev_info *hw_priv = priv->adapter;
struct ksz_port *port = &priv->port;
+ u32 speed = ethtool_cmd_speed(cmd);
int rc;
/*
@@ -6006,11 +6007,11 @@ static int netdev_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
*/
if (cmd->autoneg && priv->advertising == cmd->advertising) {
cmd->advertising |= ADVERTISED_ALL;
- if (10 == cmd->speed)
+ if (SPEED_10 == speed)
cmd->advertising &=
~(ADVERTISED_100baseT_Full |
ADVERTISED_100baseT_Half);
- else if (100 == cmd->speed)
+ else if (SPEED_100 == speed)
cmd->advertising &=
~(ADVERTISED_10baseT_Full |
ADVERTISED_10baseT_Half);
@@ -6032,8 +6033,8 @@ static int netdev_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
port->force_link = 0;
} else {
port->duplex = cmd->duplex + 1;
- if (cmd->speed != 1000)
- port->speed = cmd->speed;
+ if (speed != SPEED_1000)
+ port->speed = speed;
if (cmd->autoneg)
port->force_link = 0;
else
diff --git a/drivers/net/mii.c b/drivers/net/mii.c
index 05acca7..e8198ed 100644
--- a/drivers/net/mii.c
+++ b/drivers/net/mii.c
@@ -157,10 +157,11 @@ int mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd)
int mii_ethtool_sset(struct mii_if_info *mii, struct ethtool_cmd *ecmd)
{
struct net_device *dev = mii->dev;
+ u32 speed = ethtool_cmd_speed(ecmd);
- if (ecmd->speed != SPEED_10 &&
- ecmd->speed != SPEED_100 &&
- ecmd->speed != SPEED_1000)
+ if (speed != SPEED_10 &&
+ speed != SPEED_100 &&
+ speed != SPEED_1000)
return -EINVAL;
if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL)
return -EINVAL;
@@ -172,7 +173,7 @@ int mii_ethtool_sset(struct mii_if_info *mii, struct ethtool_cmd *ecmd)
return -EINVAL;
if (ecmd->autoneg != AUTONEG_DISABLE && ecmd->autoneg != AUTONEG_ENABLE)
return -EINVAL;
- if ((ecmd->speed == SPEED_1000) && (!mii->supports_gmii))
+ if ((speed == SPEED_1000) && (!mii->supports_gmii))
return -EINVAL;
/* ignore supported, maxtxpkt, maxrxpkt */
@@ -230,9 +231,9 @@ int mii_ethtool_sset(struct mii_if_info *mii, struct ethtool_cmd *ecmd)
bmcr = mii->mdio_read(dev, mii->phy_id, MII_BMCR);
tmp = bmcr & ~(BMCR_ANENABLE | BMCR_SPEED100 |
BMCR_SPEED1000 | BMCR_FULLDPLX);
- if (ecmd->speed == SPEED_1000)
+ if (speed == SPEED_1000)
tmp |= BMCR_SPEED1000;
- else if (ecmd->speed == SPEED_100)
+ else if (speed == SPEED_100)
tmp |= BMCR_SPEED100;
if (ecmd->duplex == DUPLEX_FULL) {
tmp |= BMCR_FULLDPLX;
diff --git a/drivers/net/mlx4/en_ethtool.c b/drivers/net/mlx4/en_ethtool.c
index da1b64d..be4a9e0 100644
--- a/drivers/net/mlx4/en_ethtool.c
+++ b/drivers/net/mlx4/en_ethtool.c
@@ -292,7 +292,8 @@ static int mlx4_en_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
static int mlx4_en_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
if ((cmd->autoneg == AUTONEG_ENABLE) ||
- (cmd->speed != SPEED_10000) || (cmd->duplex != DUPLEX_FULL))
+ (ethtool_cmd_speed(cmd) != SPEED_10000) ||
+ (cmd->duplex != DUPLEX_FULL))
return -EINVAL;
/* Nothing to change */
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 1074231..7633c67 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -2908,7 +2908,8 @@ static int netdev_set_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
return -EINVAL;
}
} else if (ecmd->autoneg == AUTONEG_DISABLE) {
- if (ecmd->speed != SPEED_10 && ecmd->speed != SPEED_100)
+ u32 speed = ethtool_cmd_speed(ecmd);
+ if (speed != SPEED_10 && speed != SPEED_100)
return -EINVAL;
if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL)
return -EINVAL;
@@ -2956,7 +2957,7 @@ static int netdev_set_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
if (ecmd->advertising & ADVERTISED_100baseT_Full)
np->advertising |= ADVERTISE_100FULL;
} else {
- np->speed = ecmd->speed;
+ np->speed = ethtool_cmd_speed(ecmd);
np->duplex = ecmd->duplex;
/* user overriding the initial full duplex parm? */
if (np->duplex == DUPLEX_HALF)
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index 29f90ba..e8d16f6 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -251,6 +251,7 @@ static int
netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
{
struct netxen_adapter *adapter = netdev_priv(dev);
+ u32 speed = ethtool_cmd_speed(ecmd);
int ret;
if (adapter->ahw.port_type != NETXEN_NIC_GBE)
@@ -259,14 +260,14 @@ netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
if (!(adapter->capabilities & NX_FW_CAPABILITY_GBE_LINK_CFG))
return -EOPNOTSUPP;
- ret = nx_fw_cmd_set_gbe_port(adapter, ecmd->speed, ecmd->duplex,
+ ret = nx_fw_cmd_set_gbe_port(adapter, speed, ecmd->duplex,
ecmd->autoneg);
if (ret == NX_RCODE_NOT_SUPPORTED)
return -EOPNOTSUPP;
else if (ret)
return -EIO;
- adapter->link_speed = ecmd->speed;
+ adapter->link_speed = speed;
adapter->link_duplex = ecmd->duplex;
adapter->link_autoneg = ecmd->autoneg;
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index a707217..524e800 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -6859,7 +6859,7 @@ static int niu_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
struct niu_link_config *lp = &np->link_config;
lp->advertising = cmd->advertising;
- lp->speed = cmd->speed;
+ lp->speed = ethtool_cmd_speed(cmd);
lp->duplex = cmd->duplex;
lp->autoneg = cmd->autoneg;
return niu_init_link(np);
diff --git a/drivers/net/pch_gbe/pch_gbe_ethtool.c b/drivers/net/pch_gbe/pch_gbe_ethtool.c
index c35d105..98587dc 100644
--- a/drivers/net/pch_gbe/pch_gbe_ethtool.c
+++ b/drivers/net/pch_gbe/pch_gbe_ethtool.c
@@ -109,12 +109,13 @@ static int pch_gbe_set_settings(struct net_device *netdev,
{
struct pch_gbe_adapter *adapter = netdev_priv(netdev);
struct pch_gbe_hw *hw = &adapter->hw;
+ u32 speed = ethtool_cmd_speed(ecmd);
int ret;
pch_gbe_hal_write_phy_reg(hw, MII_BMCR, BMCR_RESET);
- if (ecmd->speed == USHRT_MAX) {
- ecmd->speed = SPEED_1000;
+ if (speed == USHRT_MAX) {
+ speed = SPEED_1000;
ecmd->duplex = DUPLEX_FULL;
}
ret = mii_ethtool_sset(&adapter->mii, ecmd);
@@ -122,7 +123,7 @@ static int pch_gbe_set_settings(struct net_device *netdev,
pr_err("Error: mii_ethtool_sset\n");
return ret;
}
- hw->mac.link_speed = ecmd->speed;
+ hw->mac.link_speed = speed;
hw->mac.link_duplex = ecmd->duplex;
hw->phy.autoneg_advertised = ecmd->advertising;
hw->mac.autoneg = ecmd->autoneg;
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 1085917..bc71cb2 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -1875,8 +1875,8 @@ static int smc_netdev_set_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
u16 tmp;
unsigned int ioaddr = dev->base_addr;
- if (ecmd->speed != SPEED_10)
- return -EINVAL;
+ if (ethtool_cmd_speed(ecmd) != SPEED_10)
+ return -EINVAL;
if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL)
return -EINVAL;
if (ecmd->port != PORT_TP && ecmd->port != PORT_AUI)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index f767033..e3f3501 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -238,6 +238,8 @@ static void phy_sanitize_settings(struct phy_device *phydev)
*/
int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd)
{
+ u32 speed = ethtool_cmd_speed(cmd);
+
if (cmd->phy_address != phydev->addr)
return -EINVAL;
@@ -253,16 +255,16 @@ int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd)
return -EINVAL;
if (cmd->autoneg == AUTONEG_DISABLE &&
- ((cmd->speed != SPEED_1000 &&
- cmd->speed != SPEED_100 &&
- cmd->speed != SPEED_10) ||
+ ((speed != SPEED_1000 &&
+ speed != SPEED_100 &&
+ speed != SPEED_10) ||
(cmd->duplex != DUPLEX_HALF &&
cmd->duplex != DUPLEX_FULL)))
return -EINVAL;
phydev->autoneg = cmd->autoneg;
- phydev->speed = cmd->speed;
+ phydev->speed = speed;
phydev->advertising = cmd->advertising;
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c
index 615a5ab..61a4a7a 100644
--- a/drivers/net/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/qlcnic/qlcnic_ethtool.c
@@ -302,7 +302,7 @@ qlcnic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
&status) != 0)
return -EIO;
- switch (ecmd->speed) {
+ switch (ethtool_cmd_speed(ecmd)) {
case SPEED_10:
qlcnic_set_phy_speed(status, 0);
break;
@@ -323,7 +323,7 @@ qlcnic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
*((int *)&status)) != 0)
return -EIO;
else {
- adapter->link_speed = ecmd->speed;
+ adapter->link_speed = ethtool_cmd_speed(ecmd);
adapter->link_duplex = ecmd->duplex;
}
} else
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 025dedd..7bfcf95 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1350,7 +1350,8 @@ static int rtl8169_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
spin_lock_irqsave(&tp->lock, flags);
ret = rtl8169_set_speed(dev,
- cmd->autoneg, cmd->speed, cmd->duplex, cmd->advertising);
+ cmd->autoneg, ethtool_cmd_speed(cmd),
+ cmd->duplex, cmd->advertising);
spin_unlock_irqrestore(&tp->lock, flags);
return ret;
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 58b78f4..5443985 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -5380,7 +5380,7 @@ static int s2io_ethtool_sset(struct net_device *dev,
{
struct s2io_nic *sp = netdev_priv(dev);
if ((info->autoneg == AUTONEG_ENABLE) ||
- (info->speed != SPEED_10000) ||
+ (ethtool_cmd_speed(info) != SPEED_10000) ||
(info->duplex != DUPLEX_FULL))
return -EINVAL;
else {
diff --git a/drivers/net/sc92031.c b/drivers/net/sc92031.c
index 76290a8..f3ffc1d 100644
--- a/drivers/net/sc92031.c
+++ b/drivers/net/sc92031.c
@@ -1188,10 +1188,11 @@ static int sc92031_ethtool_set_settings(struct net_device *dev,
{
struct sc92031_priv *priv = netdev_priv(dev);
void __iomem *port_base = priv->port_base;
+ u32 speed = ethtool_cmd_speed(cmd);
u32 phy_ctrl;
u32 old_phy_ctrl;
- if (!(cmd->speed == SPEED_10 || cmd->speed == SPEED_100))
+ if (!(speed == SPEED_10 || speed == SPEED_100))
return -EINVAL;
if (!(cmd->duplex == DUPLEX_HALF || cmd->duplex == DUPLEX_FULL))
return -EINVAL;
@@ -1229,7 +1230,7 @@ static int sc92031_ethtool_set_settings(struct net_device *dev,
// FIXME: Whole branch guessed
phy_ctrl = 0;
- if (cmd->speed == SPEED_10)
+ if (speed == SPEED_10)
phy_ctrl |= PhyCtrlSpd10;
else /* cmd->speed == SPEED_100 */
phy_ctrl |= PhyCtrlSpd100;
diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c
index 5d8468f..10b160a 100644
--- a/drivers/net/sfc/ethtool.c
+++ b/drivers/net/sfc/ethtool.c
@@ -234,7 +234,8 @@ static int efx_ethtool_set_settings(struct net_device *net_dev,
int rc;
/* GMAC does not support 1000Mbps HD */
- if (ecmd->speed == SPEED_1000 && ecmd->duplex != DUPLEX_FULL) {
+ if ((ethtool_cmd_speed(ecmd) == SPEED_1000) &&
+ (ecmd->duplex != DUPLEX_FULL)) {
netif_dbg(efx, drv, efx->net_dev,
"rejecting unsupported 1000Mbps HD setting\n");
return -EINVAL;
diff --git a/drivers/net/sfc/mcdi_phy.c b/drivers/net/sfc/mcdi_phy.c
index 1fcda2d..6c5fccb 100644
--- a/drivers/net/sfc/mcdi_phy.c
+++ b/drivers/net/sfc/mcdi_phy.c
@@ -545,7 +545,7 @@ static int efx_mcdi_phy_set_settings(struct efx_nic *efx, struct ethtool_cmd *ec
caps = (ethtool_to_mcdi_cap(ecmd->advertising) |
1 << MC_CMD_PHY_CAP_AN_LBN);
} else if (ecmd->duplex) {
- switch (ecmd->speed) {
+ switch (ethtool_cmd_speed(ecmd)) {
case 10: caps = 1 << MC_CMD_PHY_CAP_10FDX_LBN; break;
case 100: caps = 1 << MC_CMD_PHY_CAP_100FDX_LBN; break;
case 1000: caps = 1 << MC_CMD_PHY_CAP_1000FDX_LBN; break;
@@ -553,7 +553,7 @@ static int efx_mcdi_phy_set_settings(struct efx_nic *efx, struct ethtool_cmd *ec
default: return -EINVAL;
}
} else {
- switch (ecmd->speed) {
+ switch (ethtool_cmd_speed(ecmd)) {
case 10: caps = 1 << MC_CMD_PHY_CAP_10HDX_LBN; break;
case 100: caps = 1 << MC_CMD_PHY_CAP_100HDX_LBN; break;
case 1000: caps = 1 << MC_CMD_PHY_CAP_1000HDX_LBN; break;
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 176d784..b0fa999 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -322,7 +322,7 @@ static int skge_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
} else {
u32 setting;
- switch (ecmd->speed) {
+ switch (ethtool_cmd_speed(ecmd)) {
case SPEED_1000:
if (ecmd->duplex == DUPLEX_FULL)
setting = SUPPORTED_1000baseT_Full;
@@ -355,7 +355,7 @@ static int skge_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
if ((setting & supported) == 0)
return -EINVAL;
- skge->speed = ecmd->speed;
+ skge->speed = ethtool_cmd_speed(ecmd);
skge->duplex = ecmd->duplex;
}
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index c8d0451..40afe07 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -3453,7 +3453,7 @@ static int sky2_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
} else {
u32 setting;
- switch (ecmd->speed) {
+ switch (ethtool_cmd_speed(ecmd)) {
case SPEED_1000:
if (ecmd->duplex == DUPLEX_FULL)
setting = SUPPORTED_1000baseT_Full;
@@ -3486,7 +3486,7 @@ static int sky2_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
if ((setting & supported) == 0)
return -EINVAL;
- sky2->speed = ecmd->speed;
+ sky2->speed = ethtool_cmd_speed(ecmd);
sky2->duplex = ecmd->duplex;
sky2->flags &= ~SKY2_FLAG_AUTO_SPEED;
}
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 81b6eb8..40a755d 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -1294,7 +1294,7 @@ static void gem_begin_auto_negotiation(struct gem *gp, struct ethtool_cmd *ep)
autoneg = 1;
} else {
autoneg = 0;
- speed = ep->speed;
+ speed = ethtool_cmd_speed(ep);
duplex = ep->duplex;
}
@@ -2686,6 +2686,7 @@ static int gem_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
static int gem_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
struct gem *gp = netdev_priv(dev);
+ u32 speed = ethtool_cmd_speed(cmd);
/* Verify the settings we care about. */
if (cmd->autoneg != AUTONEG_ENABLE &&
@@ -2697,9 +2698,9 @@ static int gem_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
return -EINVAL;
if (cmd->autoneg == AUTONEG_DISABLE &&
- ((cmd->speed != SPEED_1000 &&
- cmd->speed != SPEED_100 &&
- cmd->speed != SPEED_10) ||
+ ((speed != SPEED_1000 &&
+ speed != SPEED_100 &&
+ speed != SPEED_10) ||
(cmd->duplex != DUPLEX_HALF &&
cmd->duplex != DUPLEX_FULL)))
return -EINVAL;
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index 80e907d..8f3f028 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -1383,7 +1383,7 @@ force_link:
if (ep == NULL || ep->autoneg == AUTONEG_ENABLE) {
hp->sw_bmcr = BMCR_SPEED100;
} else {
- if (ep->speed == SPEED_100)
+ if (ethtool_cmd_speed(ep) == SPEED_100)
hp->sw_bmcr = BMCR_SPEED100;
else
hp->sw_bmcr = 0;
@@ -2452,8 +2452,8 @@ static int hme_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
cmd->autoneg != AUTONEG_DISABLE)
return -EINVAL;
if (cmd->autoneg == AUTONEG_DISABLE &&
- ((cmd->speed != SPEED_100 &&
- cmd->speed != SPEED_10) ||
+ ((ethtool_cmd_speed(cmd) != SPEED_100 &&
+ ethtool_cmd_speed(cmd) != SPEED_10) ||
(cmd->duplex != DUPLEX_HALF &&
cmd->duplex != DUPLEX_FULL)))
return -EINVAL;
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index b20538a..84f62af 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -10044,6 +10044,7 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
struct tg3 *tp = netdev_priv(dev);
+ u32 speed = ethtool_cmd_speed(cmd);
if (tp->tg3_flags3 & TG3_FLG3_USE_PHYLIB) {
struct phy_device *phydev;
@@ -10093,14 +10094,14 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
cmd->advertising &= mask;
} else {
if (tp->phy_flags & TG3_PHYFLG_ANY_SERDES) {
- if (cmd->speed != SPEED_1000)
+ if (speed != SPEED_1000)
return -EINVAL;
if (cmd->duplex != DUPLEX_FULL)
return -EINVAL;
} else {
- if (cmd->speed != SPEED_100 &&
- cmd->speed != SPEED_10)
+ if (speed != SPEED_100 &&
+ speed != SPEED_10)
return -EINVAL;
}
}
@@ -10115,7 +10116,7 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
tp->link_config.duplex = DUPLEX_INVALID;
} else {
tp->link_config.advertising = 0;
- tp->link_config.speed = cmd->speed;
+ tp->link_config.speed = speed;
tp->link_config.duplex = cmd->duplex;
}
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
index b13c6b0..f8d26bf 100644
--- a/drivers/net/tulip/de2104x.c
+++ b/drivers/net/tulip/de2104x.c
@@ -1549,10 +1549,11 @@ static int __de_set_settings(struct de_private *de, struct ethtool_cmd *ecmd)
{
u32 new_media;
unsigned int media_lock;
+ u32 speed = ethtool_cmd_speed(ecmd);
- if (ecmd->speed != SPEED_10 && ecmd->speed != 5 && ecmd->speed != 2)
+ if (speed != SPEED_10 && speed != 5 && speed != 2)
return -EINVAL;
- if (de->de21040 && ecmd->speed == 2)
+ if (de->de21040 && speed == 2)
return -EINVAL;
if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL)
return -EINVAL;
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index 119c394..9f11c11 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -1068,25 +1068,26 @@ static int
typhoon_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
struct typhoon *tp = netdev_priv(dev);
+ u32 speed = ethtool_cmd_speed(cmd);
struct cmd_desc xp_cmd;
__le16 xcvr;
int err;
err = -EINVAL;
- if(cmd->autoneg == AUTONEG_ENABLE) {
+ if (cmd->autoneg == AUTONEG_ENABLE) {
xcvr = TYPHOON_XCVR_AUTONEG;
} else {
- if(cmd->duplex == DUPLEX_HALF) {
- if(cmd->speed == SPEED_10)
+ if (cmd->duplex == DUPLEX_HALF) {
+ if (speed == SPEED_10)
xcvr = TYPHOON_XCVR_10HALF;
- else if(cmd->speed == SPEED_100)
+ else if (speed == SPEED_100)
xcvr = TYPHOON_XCVR_100HALF;
else
goto out;
- } else if(cmd->duplex == DUPLEX_FULL) {
- if(cmd->speed == SPEED_10)
+ } else if (cmd->duplex == DUPLEX_FULL) {
+ if (speed == SPEED_10)
xcvr = TYPHOON_XCVR_10FULL;
- else if(cmd->speed == SPEED_100)
+ else if (speed == SPEED_100)
xcvr = TYPHOON_XCVR_100FULL;
else
goto out;
@@ -1105,7 +1106,7 @@ typhoon_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
tp->speed = 0xff; /* invalid */
tp->duplex = 0xff; /* invalid */
} else {
- tp->speed = cmd->speed;
+ tp->speed = speed;
tp->duplex = cmd->duplex;
}
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index baf04b0..9a8f116 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -3247,9 +3247,11 @@ static int velocity_get_settings(struct net_device *dev, struct ethtool_cmd *cmd
return 0;
}
-static int velocity_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+static int velocity_set_settings(struct net_device *dev,
+ struct ethtool_cmd *cmd)
{
struct velocity_info *vptr = netdev_priv(dev);
+ u32 speed = ethtool_cmd_speed(cmd);
u32 curr_status;
u32 new_status = 0;
int ret = 0;
@@ -3258,9 +3260,9 @@ static int velocity_set_settings(struct net_device *dev, struct ethtool_cmd *cmd
curr_status &= (~VELOCITY_LINK_FAIL);
new_status |= ((cmd->autoneg) ? VELOCITY_AUTONEG_ENABLE : 0);
- new_status |= ((cmd->speed == SPEED_1000) ? VELOCITY_SPEED_1000 : 0);
- new_status |= ((cmd->speed == SPEED_100) ? VELOCITY_SPEED_100 : 0);
- new_status |= ((cmd->speed == SPEED_10) ? VELOCITY_SPEED_10 : 0);
+ new_status |= ((speed == SPEED_1000) ? VELOCITY_SPEED_1000 : 0);
+ new_status |= ((speed == SPEED_100) ? VELOCITY_SPEED_100 : 0);
+ new_status |= ((speed == SPEED_10) ? VELOCITY_SPEED_10 : 0);
new_status |= ((cmd->duplex == DUPLEX_FULL) ? VELOCITY_DUPLEX_FULL : 0);
if ((new_status & VELOCITY_AUTONEG_ENABLE) &&
diff --git a/drivers/net/vxge/vxge-ethtool.c b/drivers/net/vxge/vxge-ethtool.c
index 5aef6c8..a70874e 100644
--- a/drivers/net/vxge/vxge-ethtool.c
+++ b/drivers/net/vxge/vxge-ethtool.c
@@ -33,7 +33,8 @@ static int vxge_ethtool_sset(struct net_device *dev, struct ethtool_cmd *info)
{
/* We currently only support 10Gb/FULL */
if ((info->autoneg == AUTONEG_ENABLE) ||
- (info->speed != SPEED_10000) || (info->duplex != DUPLEX_FULL))
+ (ethtool_cmd_speed(info) != SPEED_10000) ||
+ (info->duplex != DUPLEX_FULL))
return -EINVAL;
return 0;
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 7f5379c..c57d187 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -36,8 +36,8 @@ static int port_cost(struct net_device *dev)
if (dev->ethtool_ops && dev->ethtool_ops->get_settings) {
struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET, };
- if (!dev->ethtool_ops->get_settings(dev, &ecmd)) {
- switch(ecmd.speed) {
+ if (!dev_ethtool_get_settings(dev, &ecmd)) {
+ switch (ethtool_cmd_speed(&ecmd)) {
case SPEED_10000:
return 2;
case SPEED_1000:
--
1.7.3.1
^ permalink raw reply related
* [PATCHv2 0/4] ethtool: generalize use of ethtool_cmd_speed API
From: David Decotigny @ 2011-04-27 18:34 UTC (permalink / raw)
To: David S. Miller, Ben Hutchings, mirq-linux, Stanislaw Gruszka,
Alexander Duyck <alexander.h.duyc
Cc: David Decotigny
In-Reply-To: <1303001651-4074-1-git-send-email-decot@google.com>
Hi all,
This is the second version of a patch series aimed at making sure the
speed field of struct ethtool_cmd is accessed as a 32b integer
throughout the kernel.
Thanks to Ben for his careful review!
Below are a few comments before sending the series.
On 04/16/11 19:06, Ben Hutchings wrote:
> Don't encourage use of the SPEED_* macros. The speed is just a value in
> units of Mbit/s.
Updated. Thanks!
>> This makes sure that when a driver calls the ethtool's
>> get/set_settings() callback of another driver,
>
> Many of them are calling themselves, and they can ignore speed_hi
> because they will never set it.
Right. Here is what I replied to Ben in private: I think it makes
sense to have a uniform & consistent use of the API without exception
nor assumption, even though it borrows additional useless CPU cycles
(+ cache lines probably). This comes down to trade-off between code
management and performance, for which I privileged the former because
I don't think the ethtool api is supposed to be heavily used
throughout normal kernel operation.
I left the initial changes in place.
>> the data passed to it
>> is clean. This guarantees that speed_hi will be zeroed correctly if
>> the called callback doesn't explicitely set it: we are sure we don't
>> get a corrupted speed from the underlying driver. We also take care of
>> setting the cmd field appropriately (ETHTOOL_GSET/SSET).
>
> I think this initialisation ought to be done in
> dev_ethtool_get_settings(), and that function moved into net/core/dev.c,
> to avoid code bloat. (Yes it's minimal in this case, but these things
> add up.)
Done. This is in the 2nd patch of the series. Any feedback welcome, I
am not entirely convinced that my additions are pertinent.
> Maybe also in mii_ethtool_gset().
I don't think this is equivalent to dev_ethtool_get_settings(). My
understanding is that mii_ethtool_gset() (and likewise for mdio45_) is
meant to be wrapped almost transparently inside a driver's
get_settings(), so it should make the same assumptions as a normal
get_settings(). However, dev_ethtool_get_settings() is meant to be
used to _call_ some driver's get_settings(), so it should make sure
that it enforces the assumptions this driver is making.
In the end, I didn't change mii_ethtool_gset() the same way I did for
dev_ethtool_get_settings (no memset).
>> --- a/arch/mips/txx9/generic/setup_tx4939.c
>> +++ b/arch/mips/txx9/generic/setup_tx4939.c
[...]
> If you're going to rewrite the whole function then at least get rid of
> this stupid conditional and return ethtool_cmd_speed(&cmd).
Updated. Thanks!
[...]
> e100 is just getting its own settings and doesn't need to be changed.
Right. I still did change it for the sake of consistency (see remark
above).
[...]
>> diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
>> @@ -2763,11 +2763,12 @@ static void pcnet32_check_media(struct net_device *dev, int verbose)
>> netif_carrier_on(dev);
>> if (lp->mii) {
>> if (netif_msg_link(lp)) {
>> - struct ethtool_cmd ecmd;
>> + struct ethtool_cmd ecmd = {
>> + .cmd = ETHTOOL_GSET };
>> mii_ethtool_gset(&lp->mii_if, &ecmd);
>> netdev_info(dev, "link up, %sMbps, %s-duplex\n",
>> - (ecmd.speed == SPEED_100)
>> - ? "100" : "10",
>> + (ethtool_cmd_speed(&ecmd)
>> + == SPEED_100) ? "100" : "10",
>
> Just use ethtool_cmd_speed() and %u rather than this conditional.
Updated. Thanks!
[...]
>> diff --git a/drivers/net/stmmac/stmmac_ethtool.c b/drivers/net/stmmac/stmmac_ethtool.c
>> index 0e61ac8..33cf0b1 100644
>> --- a/drivers/net/stmmac/stmmac_ethtool.c
>> +++ b/drivers/net/stmmac/stmmac_ethtool.c
>> @@ -237,13 +237,13 @@ stmmac_set_pauseparam(struct net_device *netdev,
>>
>> if (phy->autoneg) {
>> if (netif_running(netdev)) {
>> - struct ethtool_cmd cmd;
>> + struct ethtool_cmd cmd = { .cmd = ETHTOOL_SSET };
>> /* auto-negotiation automatically restarted */
>> cmd.cmd = ETHTOOL_NWAY_RST;
>
> This line immediately changes cmd.cmd. The original author is clearly
> confused, as the phy_ethtool_sset() ignores cmd.cmd and ETHTOOL_NWAY_RST
> does not take any parameters.
True. I made this a bit more elegant.
> I think this whole block should really just be:
>
> ret = phy_start_aneg(phy);
Right, but I prefer not to do this in this series.
> [...]
>> diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
>> index e2e6475..6df9540 100644
>> --- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
>> +++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
>> @@ -664,22 +664,28 @@ static void bnx2fc_link_speed_update(struct fc_lport *lport)
[...]
> This restructuring looks entirely unnecessary, and obscures the real
> change being made.
That's definitely true. Made my changes more transparent. Thanks!
>> diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
>> index bde6ee5..ba9e84a 100644
>> --- a/drivers/scsi/fcoe/fcoe.c
>> +++ b/drivers/scsi/fcoe/fcoe.c
>> @@ -2026,25 +2026,30 @@ out_nodev:
>> int fcoe_link_speed_update(struct fc_lport *lport)
>> {
> [...]
>
> Ditto here.
Same here.
On 04/16/11 19:02, Ben Hutchings wrote:
> On Sat, 2011-04-16 at 17:54 -0700, David Decotigny wrote:
>> This makes sure the ethtool's set_settings() callback of network
>> drivers don't ignore the 16 most significant bits when ethtool calls
>> their set_settings().
>>
>> All the driver compiled with make allyesconfig on x86_64 have been
>> updated.
>
> You missed one generic function, mdio45_ethtool_gset_npage() in
> drivers/net/mdio.c.
I am not sure about this one. But I think it falls in the same
category as mii_ethtool_gset() above.
>
> [...]
>> diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
>> index c05db60..ba6c151 100644
>> --- a/drivers/net/dl2k.c
>> +++ b/drivers/net/dl2k.c
>> @@ -1219,11 +1219,11 @@ static int rio_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
>> } else {
>> np->an_enable = 0;
>> if (np->speed == 1000) {
>> - cmd->speed = SPEED_100;
>> + ethtool_cmd_speed_set(cmd, SPEED_100);
>> cmd->duplex = DUPLEX_FULL;
>> printk("Warning!! Can't disable Auto negotiation in 1000Mbps, change to Manual 100Mbps, Full duplex.\n");
>> }
>> - switch(cmd->speed + cmd->duplex) {
>> + switch (ethtool_cmd_speed(cmd) + cmd->duplex) {
> [...]
>
> If you're going to stop these drivers ignoring speed_hi, maybe you
> should also stop them ignoring the difference between speed and duplex!
> Currently the user can ask for 99 Mbit/s full-duplex and get 100 Mbit/s
> half-duplex.
Yes, that is completely right. Updated. Thanks!
>
> There are several others that use this trick.
Yes, I noticed too (e1000(e)) but I think it would deserve another
set of patches.
David Decotigny (4):
ethtool: cosmetics: enforce const-ness in ethtool_cmd_speed
ethtool: Call ethtool's get/set_settings callbacks with cleaned data
ethtool: Use the full 32 bit speed range in ethtool's set_settings
ethtool: cosmetic: Use ethtool ethtool_cmd_speed API
arch/mips/txx9/generic/setup_tx4939.c | 21 ++++++-----------
drivers/infiniband/hw/nes/nes_nic.c | 4 +-
drivers/net/3c509.c | 2 +-
drivers/net/acenic.c | 10 ++++----
drivers/net/arm/etherh.c | 5 ++-
drivers/net/arm/ks8695net.c | 7 +++--
drivers/net/atl1c/atl1c_ethtool.c | 9 ++++---
drivers/net/atl1e/atl1e_ethtool.c | 4 +-
drivers/net/atlx/atl1.c | 9 ++++---
drivers/net/atlx/atl2.c | 4 +-
drivers/net/b44.c | 13 ++++++-----
drivers/net/bcm63xx_enet.c | 3 +-
drivers/net/benet/be_ethtool.c | 16 ++++++------
drivers/net/bna/bnad_ethtool.c | 7 +++--
drivers/net/bnx2.c | 19 +++++++--------
drivers/net/cassini.c | 37 ++++++++++++++++---------------
drivers/net/chelsio/cxgb2.c | 11 +++++----
drivers/net/cxgb3/cxgb3_main.c | 14 ++++++-----
drivers/net/cxgb4/cxgb4_main.c | 14 ++++++-----
drivers/net/cxgb4vf/cxgb4vf_main.c | 3 +-
drivers/net/dl2k.c | 29 ++++++++++--------------
drivers/net/e100.c | 10 +++++---
drivers/net/e1000/e1000_ethtool.c | 10 +++++---
drivers/net/e1000e/ethtool.c | 15 +++++++-----
drivers/net/eepro.c | 2 +-
drivers/net/ehea/ehea_ethtool.c | 23 +++++++++++++++----
drivers/net/enc28j60.c | 5 ++-
drivers/net/enic/enic_main.c | 4 +-
drivers/net/ewrk3.c | 2 +-
drivers/net/forcedeth.c | 25 ++++++++++++--------
drivers/net/ibmveth.c | 2 +-
drivers/net/igb/igb_ethtool.c | 11 +++++----
drivers/net/igbvf/ethtool.c | 8 +++---
drivers/net/ixgb/ixgb_ethtool.c | 7 +++--
drivers/net/ixgbe/ixgbe_ethtool.c | 11 +++++----
drivers/net/ixgbevf/ethtool.c | 8 ++++--
drivers/net/jme.c | 3 +-
drivers/net/ksz884x.c | 9 ++++---
drivers/net/mdio.c | 22 +++++++++++------
drivers/net/mii.c | 31 ++++++++++++++++----------
drivers/net/mlx4/en_ethtool.c | 7 +++--
drivers/net/mv643xx_eth.c | 6 ++--
drivers/net/myri10ge/myri10ge.c | 2 +-
drivers/net/natsemi.c | 11 +++++----
drivers/net/netxen/netxen_nic_ethtool.c | 15 ++++++------
drivers/net/niu.c | 4 +-
drivers/net/ns83820.c | 8 +++---
drivers/net/pch_gbe/pch_gbe_ethtool.c | 9 ++++---
drivers/net/pch_gbe/pch_gbe_main.c | 6 ++--
drivers/net/pch_gbe/pch_gbe_phy.c | 4 +-
drivers/net/pcmcia/smc91c92_cs.c | 6 ++--
drivers/net/pcnet32.c | 16 ++++++------
drivers/net/phy/phy.c | 12 ++++++----
drivers/net/ps3_gelic_net.c | 8 +++---
drivers/net/qla3xxx.c | 2 +-
drivers/net/qlcnic/qlcnic_ethtool.c | 12 +++++-----
drivers/net/qlge/qlge_ethtool.c | 2 +-
drivers/net/r8169.c | 5 ++-
drivers/net/s2io.c | 6 ++--
drivers/net/sc92031.c | 8 ++++--
drivers/net/sfc/ethtool.c | 5 ++-
drivers/net/sfc/mcdi_phy.c | 6 ++--
drivers/net/sfc/mdio_10g.c | 4 +-
drivers/net/sfc/tenxpress.c | 2 +-
drivers/net/skge.c | 6 ++--
drivers/net/sky2.c | 8 +++---
drivers/net/smc911x.c | 4 +-
drivers/net/smc91x.c | 4 +-
drivers/net/spider_net_ethtool.c | 2 +-
drivers/net/stmmac/stmmac_ethtool.c | 5 +--
drivers/net/sungem.c | 15 ++++++------
drivers/net/sunhme.c | 19 +++++++--------
drivers/net/tehuti.c | 2 +-
drivers/net/tg3.c | 13 ++++++-----
drivers/net/tulip/de2104x.c | 11 +++++----
drivers/net/tulip/uli526x.c | 6 ++--
drivers/net/tun.c | 2 +-
drivers/net/typhoon.c | 19 ++++++++-------
drivers/net/usb/asix.c | 28 ++++++++++++-----------
drivers/net/usb/catc.c | 2 +-
drivers/net/usb/dm9601.c | 6 ++--
drivers/net/usb/rtl8150.c | 11 +++++----
drivers/net/usb/smsc75xx.c | 7 +++--
drivers/net/usb/smsc95xx.c | 7 +++--
drivers/net/veth.c | 2 +-
drivers/net/via-velocity.c | 21 +++++++++++------
drivers/net/vmxnet3/vmxnet3_ethtool.c | 4 +-
drivers/net/vxge/vxge-ethtool.c | 7 +++--
drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 11 ++++++---
drivers/scsi/fcoe/fcoe.c | 11 ++++++---
include/linux/ethtool.h | 18 +++++++++++----
include/linux/netdevice.h | 9 +------
include/rdma/ib_addr.h | 13 ++++++-----
net/batman-adv/soft-interface.c | 2 +-
net/bridge/br_if.c | 4 +-
net/core/dev.c | 24 ++++++++++++++++++++
net/core/net-sysfs.c | 24 ++++++++-----------
97 files changed, 522 insertions(+), 420 deletions(-)
--
1.7.3.1
^ permalink raw reply
* [PATCHv2] acenic: Fix using the specified speed when configuring NIC
From: David Decotigny @ 2011-04-27 18:34 UTC (permalink / raw)
To: David S. Miller, Ben Hutchings, mirq-linux, Stanislaw Gruszka,
Alexander Duyck <alexander.h.duyc
Cc: David Decotigny
In-Reply-To: <1303001651-4074-1-git-send-email-decot@google.com>
This tells the NIC to take the speed specified by ethtool into account
when configuring the NIC, instead of keeping the previous speed.
Signed-off-by: David Decotigny <decot@google.com>
---
drivers/net/acenic.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c
index a579899..82260ca 100644
--- a/drivers/net/acenic.c
+++ b/drivers/net/acenic.c
@@ -2720,7 +2720,7 @@ static int ace_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
link |= LNK_NEGOTIATE;
if (ethtool_cmd_speed(ecmd) != speed) {
link &= ~(LNK_1000MB | LNK_100MB | LNK_10MB);
- switch (speed) {
+ switch (ethtool_cmd_speed(ecmd)) {
case SPEED_1000:
link |= LNK_1000MB;
break;
--
1.7.3.1
^ permalink raw reply related
* [PATCHv2 1/4] ethtool: cosmetics: enforce const-ness in ethtool_cmd_speed
From: David Decotigny @ 2011-04-27 18:34 UTC (permalink / raw)
To: David S. Miller, Ben Hutchings, mirq-linux, Stanislaw Gruszka,
Alexander Duyck <alexander.h.duyc
Cc: David Decotigny
In-Reply-To: <1303001651-4074-1-git-send-email-decot@google.com>
The 'ep' argument of ethtool_cmd_speed is not altered: advertise it in
protoype. +Indentation fix. Also add comments to advise using the
ethtool_cmd_speed API to get/set the link speed.
Signed-off-by: David Decotigny <decot@google.com>
---
include/linux/ethtool.h | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 9de3127..7e6e0a8 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -24,7 +24,10 @@ struct ethtool_cmd {
__u32 cmd;
__u32 supported; /* Features this interface supports */
__u32 advertising; /* Features this interface advertises */
- __u16 speed; /* The forced speed, 10Mb, 100Mb, gigabit */
+ __u16 speed; /* The forced speed (lower bits) in
+ * Mbps. Please use
+ * ethtool_cmd_speed()/_set() to
+ * access it */
__u8 duplex; /* Duplex, half or full */
__u8 port; /* Which connector port */
__u8 phy_address;
@@ -33,7 +36,10 @@ struct ethtool_cmd {
__u8 mdio_support;
__u32 maxtxpkt; /* Tx pkts before generating tx int */
__u32 maxrxpkt; /* Rx pkts before generating rx int */
- __u16 speed_hi;
+ __u16 speed_hi; /* The forced speed (upper
+ * bits) in Mbps. Please use
+ * ethtool_cmd_speed()/_set() to
+ * access it */
__u8 eth_tp_mdix;
__u8 reserved2;
__u32 lp_advertising; /* Features the link partner advertises */
@@ -41,14 +47,14 @@ struct ethtool_cmd {
};
static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
- __u32 speed)
+ __u32 speed)
{
ep->speed = (__u16)speed;
ep->speed_hi = (__u16)(speed >> 16);
}
-static inline __u32 ethtool_cmd_speed(struct ethtool_cmd *ep)
+static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
{
return (ep->speed_hi << 16) | ep->speed;
}
--
1.7.3.1
^ permalink raw reply related
* Re: [ethtool PATCH 4/6] Add support for __be64 and bitops to ethtool
From: Alexander Duyck @ 2011-04-27 18:33 UTC (permalink / raw)
To: Ben Hutchings
Cc: davem@davemloft.net, Kirsher, Jeffrey T, netdev@vger.kernel.org
In-Reply-To: <1303924185.2875.48.camel@bwh-desktop>
On 4/27/2011 10:09 AM, Ben Hutchings wrote:
> On Wed, 2011-04-27 at 09:46 -0700, Alexander Duyck wrote:
>> On 4/27/2011 8:54 AM, Ben Hutchings wrote:
>>> On Thu, 2011-04-21 at 13:40 -0700, Alexander Duyck wrote:
>>>> This change is meant to add support for __be64 values and bitops to
>>>> ethtool. These changes will be needed in order to support network flow
>>>> classifier rule configuration.
> [...]
>>> Where is __always_inline supposed to be defined?
>>
>> Sorry that should have just been inline. I forgot we have to take tools
>> other than gcc into account.
>
> Oh, it's a gcc extension? I read the code before trying to compile it.
> I've never tested with anything other than gcc but I think it's worth
> making a small effort to avoid gcc extensions.
>
> [...]
>> On a side note, is there a git tree somewhere I can re-base off of? At
>> this point I know you have pulled in a number of patches and I figure it
>> would be helpful for me to clean up my tree so I am not guessing what is
>> there and what isn't.
>
> git://git.kernel.org/pub/scm/network/ethtool/ethtool.git
>
> Ben.
>
I just saw the updates pushed to the tree. Thanks. I'll start working
on incorporating the suggestions you made and should have an updated
version of the remaining patches ready in the next day or so.
Thanks,
Alex
^ permalink raw reply
* Re: Linux TCP's Robustness to Multipath Packet Reordering
From: Alexander Zimmermann @ 2011-04-27 17:53 UTC (permalink / raw)
To: Yuchung Cheng
Cc: Dominik Kaspar, Carsten Wolff, John Heffner, Eric Dumazet, netdev,
Lennart Schulte, Arnd Hannemann
In-Reply-To: <BANLkTi=i5ZftuL++ORuy=n_yM_futWYoZw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1323 bytes --]
Hi,
Am 27.04.2011 um 19:39 schrieb Yuchung Cheng:
> Hi Dominik,
>
> On Wed, Apr 27, 2011 at 9:22 AM, Dominik Kaspar <dokaspar.ietf@gmail.com> wrote:
>>
>> Hi Carsten,
>>
>> Thanks for your feedback. I made some new tests with the same setup of
>> packet-based forwarding over two emulated paths (600 KB/s, 10 ms) +
>> (400 KB/s, 100 ms). In the first experiments, which showed a step-wise
>> adaptation to reordering, SACK, DSACK, and Timestamps were all
>> enabled. In the experiments, I individually disabled these three
>> mechanisms and saw the following:
>>
>> - Disabling timestamps causes TCP to never adjust to reordering at all.
>> - Disabling SACK allows TCP to adapt very rapidly ("perfect" aggregation!).
>
> Did you enable tcp_fack when sack is enabled? this may make a (big)
> difference. FACK assumes little network reordering and mark packet
> losses more aggressively.
It's not necessary to do it manually. Linux will disable FACK as soon as it
will detected reordering
Alex
//
// Dipl.-Inform. Alexander Zimmermann
// Department of Computer Science, Informatik 4
// RWTH Aachen University
// Ahornstr. 55, 52056 Aachen, Germany
// phone: (49-241) 80-21422, fax: (49-241) 80-22222
// email: zimmermann@cs.rwth-aachen.de
// web: http://www.umic-mesh.net
//
[-- Attachment #2: Signierter Teil der Nachricht --]
[-- Type: application/pgp-signature, Size: 243 bytes --]
^ permalink raw reply
* Re: [ethtool PATCH 6/6] Update documentation for -u/-U operations
From: Ben Hutchings @ 2011-04-27 18:23 UTC (permalink / raw)
To: Alexander Duyck; +Cc: davem, jeffrey.t.kirsher, netdev
In-Reply-To: <20110421204045.23054.12548.stgit@gitlad.jf.intel.com>
On Thu, 2011-04-21 at 13:40 -0700, Alexander Duyck wrote:
> This patch updates the documentation for the -u/-U operations to include
> the recent changes made to support addition/deletion/display of network
> flow classifier rules.
This should be included in the same patch.
> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> ---
>
> ethtool.8.in | 185 +++++++++++++++++++++++++++++-----------------------------
> ethtool.c | 32 ++++++----
> 2 files changed, 111 insertions(+), 106 deletions(-)
>
> diff --git a/ethtool.8.in b/ethtool.8.in
> index 12a1d1d..8908351 100644
> --- a/ethtool.8.in
> +++ b/ethtool.8.in
> @@ -42,10 +42,20 @@
> [\\fB\\$1\\fP\ \\fIN\\fP]
> ..
> .\"
> +.\" .BM - same as above but has a mask field for format "[value N [value-mask N]]"
> +.\"
> +.de BM
> +[\\fB\\$1\\fP\ \\fIN\\fP\ [\\fB\\$1\-mask\\fP\ \\fIN\\fP]]
You've changed the code to accept 'm' as an alternative to
<field> '-mask', so this should be changed accordingly.
[...]
> @@ -236,9 +252,9 @@ ethtool \- query or control network driver and hardware settings
> .HP
> .B ethtool \-N
> .I ethX
> -.RB [ rx\-flow\-hash \ \*(FL
> -.RB \ \*(HO]
> +.RB [ rx-flow-hash \ \*(FL \ \*(HO]
> .HP
> +
This looks like an unintentional reversion of part of commit
db6c0cee6cd956767e1c39109fe81104cc4694cb.
> .B ethtool \-x|\-\-show\-rxfh\-indir
> .I ethX
> .HP
> @@ -257,54 +273,28 @@ ethtool \- query or control network driver and hardware settings
> .HP
> .B ethtool \-u|\-\-show\-ntuple
> .I ethX
> -.TP
> +.BN class-rule
> +.HP
> +
> .BI ethtool\ \-U|\-\-config\-ntuple \ ethX
> -.RB {
> -.A3 flow\-type tcp4 udp4 sctp4
> -.RB [ src\-ip
> -.IR addr
> -.RB [ src\-ip\-mask
> -.IR mask ]]
> -.RB [ dst\-ip
> -.IR addr
> -.RB [ dst\-ip\-mask
> -.IR mask ]]
> -.RB [ src\-port
> -.IR port
> -.RB [ src\-port\-mask
> -.IR mask ]]
> -.RB [ dst\-port
> -.IR port
> -.RB [ dst\-port\-mask
> -.IR mask ]]
> -.br
> -.RB | \ flow\-type\ ether
> -.RB [ src
> -.IR mac\-addr
> -.RB [ src\-mask
> -.IR mask ]]
> -.RB [ dst
> -.IR mac\-addr
> -.RB [ dst\-mask
> -.IR mask ]]
> -.RB [ proto
> -.IR N
> -.RB [ proto\-mask
> -.IR mask ]]\ }
> -.br
> -.RB [ vlan
> -.IR VLAN\-tag
> -.RB [ vlan\-mask
> -.IR mask ]]
> -.RB [ user\-def
> -.IR data
> -.RB [ user\-def\-mask
> -.IR mask ]]
> -.RI action \ N
> -.
> -.\" Adjust lines (i.e. full justification) and hyphenate.
> -.ad
> -.hy
As do the last 3 deleted lines here.
> +.BN class-rule-del
> +.RB [\ flow-type \ \*(NC
> +.RB [ src \ \*(MA\ [ src-mask \ \*(MA]]
> +.RB [ dst \ \*(MA\ [ dst-mask \ \*(MA]]
> +.BM proto
> +.RB [ src-ip \ \*(PA\ [ src-ip-mask \ \*(PA]]
> +.RB [ dst-ip \ \*(PA\ [ dst-ip-mask \ \*(PA]]
> +.BM tos
> +.BM l4proto
> +.BM src-port
> +.BM dst-port
> +.BM spi
> +.BM vlan-etype
> +.BM vlan
> +.BM user-def
> +.BN action
> +.BN loc
> +.RB ]
But these options aren't all applicable to all flow-types.
[...]
> diff --git a/ethtool.c b/ethtool.c
> index 421fe20..e65979d 100644
> --- a/ethtool.c
> +++ b/ethtool.c
> @@ -243,20 +243,26 @@ static struct option {
> " equal N | weight W0 W1 ...\n" },
> { "-U", "--config-ntuple", MODE_SCLSRULE, "Configure Rx ntuple filters "
> "and actions",
> - " { flow-type tcp4|udp4|sctp4\n"
> - " [ src-ip ADDR [src-ip-mask MASK] ]\n"
> - " [ dst-ip ADDR [dst-ip-mask MASK] ]\n"
> - " [ src-port PORT [src-port-mask MASK] ]\n"
> - " [ dst-port PORT [dst-port-mask MASK] ]\n"
> - " | flow-type ether\n"
> - " [ src MAC-ADDR [src-mask MASK] ]\n"
> - " [ dst MAC-ADDR [dst-mask MASK] ]\n"
> - " [ proto N [proto-mask MASK] ] }\n"
> - " [ vlan VLAN-TAG [vlan-mask MASK] ]\n"
> - " [ user-def DATA [user-def-mask MASK] ]\n"
> - " action N\n" },
> + " [ class-rule-del %d ] |\n"
> + " [ flow-type ether|ip4|tcp4|udp4|sctp4|ah4|esp4\n"
> + " [ src %x:%x:%x:%x:%x:%x [src-mask %x:%x:%x:%x:%x:%x] ]\n"
> + " [ dst %x:%x:%x:%x:%x:%x [dst-mask %x:%x:%x:%x:%x:%x] ]\n"
> + " [ proto %d [proto-mask MASK] ]\n"
> + " [ src-ip %d.%d.%d.%d [src-ip-mask %d.%d.%d.%d] ]\n"
> + " [ dst-ip %d.%d.%d.%d [dst-ip-mask %d.%d.%d.%d] ]\n"
> + " [ tos %d [tos-mask %x] ]\n"
> + " [ l4proto %d [l4proto-mask MASK] ]\n"
> + " [ src-port %d [src-port-mask %x] ]\n"
> + " [ dst-port %d [dst-port-mask %x] ]\n"
> + " [ spi %d [spi-mask %x] ]\n"
> + " [ vlan-etype %x [vlan-etype-mask %x] ]\n"
> + " [ vlan %x [vlan-mask %x] ]\n"
> + " [ user-def %x [user-def-mask %x] ]\n"
> + " [ action %d ]\n"
> + " [ loc %d]]\n" },
[...]
Again, it's not clear which options apply to which flow-types, and the
'm' shortcut is not documented.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [ethtool PATCH 3/6] ethtool: remove strings based approach for displaying n-tuple
From: Ben Hutchings @ 2011-04-27 18:12 UTC (permalink / raw)
To: Alexander Duyck; +Cc: davem, jeffrey.t.kirsher, netdev
In-Reply-To: <20110421204030.23054.29242.stgit@gitlad.jf.intel.com>
On Thu, 2011-04-21 at 13:40 -0700, Alexander Duyck wrote:
> This change is meant to remove the strings based approach for displaying
> n-tuple filters. A follow-on patch will replace that functionality with a
> network flow classification based approach that will get the number of
> filters, get their locations, and then request and display them
> individually.
[...]
I'm deferring this until the other patches are updated.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [ethtool PATCH 5/6] v4 Add RX packet classification interface
From: Ben Hutchings @ 2011-04-27 18:12 UTC (permalink / raw)
To: Alexander Duyck; +Cc: davem, jeffrey.t.kirsher, netdev
In-Reply-To: <20110421204040.23054.87188.stgit@gitlad.jf.intel.com>
On Thu, 2011-04-21 at 13:40 -0700, Alexander Duyck wrote:
[...]
> diff --git a/ethtool.c b/ethtool.c
> index 15af86a..421fe20 100644
> --- a/ethtool.c
> +++ b/ethtool.c
[...]
> @@ -926,16 +862,45 @@ static void parse_cmdline(int argc, char **argp)
> i = argc;
> break;
> }
> - if (mode == MODE_SNTUPLE) {
> + if (mode == MODE_SCLSRULE) {
> if (!strcmp(argp[i], "flow-type")) {
> i += 1;
> if (i >= argc) {
> exit_bad_args();
> break;
> }
> - parse_rxntupleopts(argc, argp, i);
> - i = argc;
> - break;
> + if (rxclass_parse_ruleopts(&argp[i],
> + argc - i,
> + &rx_rule_fs) < 0) {
> + exit_bad_args();
> + } else {
> + i = argc;
> + rx_class_rule_added = 1;
> + }
> + } else if (!strcmp(argp[i], "class-rule-del")) {
A shorter keyword like 'delete' would do, since the -U option is only
used for flow classification.
> + i += 1;
> + if (i >= argc) {
> + exit_bad_args();
> + break;
> + }
> + rx_class_rule_del =
> + get_uint_range(argp[i], 0,
> + INT_MAX);
> + } else {
> + exit_bad_args();
> + }
> + break;
> + }
> + if (mode == MODE_GCLSRULE) {
> + if (!strcmp(argp[i], "class-rule")) {
This keyword seems redundant.
[...]
> @@ -3163,21 +3068,130 @@ static int do_permaddr(int fd, struct ifreq *ifr)
> return err;
> }
>
> +static int flow_spec_to_ntuple(struct ethtool_rx_flow_spec *fsp,
> + struct ethtool_rx_ntuple_flow_spec *ntuple)
> +{
> + int i;
Should be size_t, since it's compared with a sizeof() expression.
> + /* verify location is not specified */
> + if (fsp->location != RX_CLS_LOC_UNSPEC)
> + return -1;
> +
> + /* verify ring cookie can transfer to action */
> + if (fsp->ring_cookie > INT_MAX &&
> + ~fsp->ring_cookie > 1)
> + return -1;
The second part of this condition would be more clearly expressed as:
fsp->ring_cookie < (u64)(-2)
> + /* verify only one field is setting data field */
> + if ((fsp->flow_type & FLOW_EXT) &&
> + (fsp->m_ext.data[0] || fsp->m_ext.data[1]) &&
> + fsp->m_ext.vlan_etype)
> + return -1;
> +
> + /* initialize entire ntuple to all 0xFF */
> + memset(ntuple, ~0, sizeof(*ntuple));
The comment needs to explain *why* the value is ~0 rather than 0. I
assume the idea is to set the masks to ~0 if they are not initialised
below.
> + /* set non-filter values */
> + ntuple->flow_type = fsp->flow_type;
> + ntuple->action = fsp->ring_cookie;
> +
> + /* copy header portion over */
> + memcpy(&ntuple->h_u, &fsp->h_u, sizeof(fsp->h_u));
This deserves a comment that the two h_u fields are different unions,
but are defined identically except for padding at the end.
> + /* copy mask portion over and invert */
> + memcpy(&ntuple->m_u, &fsp->m_u, sizeof(fsp->m_u));
> + for (i = 0; i < sizeof(fsp->m_u); i++)
> + ntuple->m_u.hdata[i] ^= 0xFF;
> +
> + /* copy extended fields */
> + if (fsp->flow_type & FLOW_EXT) {
> + ntuple->vlan_tag =
> + ntohs(fsp->h_ext.vlan_tci);
> + ntuple->vlan_tag_mask =
> + ~ntohs(fsp->m_ext.vlan_tci);
> + if (fsp->m_ext.vlan_etype) {
> + ntuple->data =
> + ntohl(fsp->h_ext.vlan_etype);
> + ntuple->data_mask =
> + ~(u64)ntohl(fsp->m_ext.vlan_etype);
> + } else {
> + ntuple->data =
> + (u64)ntohl(fsp->h_ext.data[0]);
> + ntuple->data |=
> + (u64)ntohl(fsp->h_ext.data[1]) << 32;
> + ntuple->data_mask =
> + (u64)ntohl(~fsp->m_ext.data[0]);
> + ntuple->data_mask |=
> + (u64)ntohl(~fsp->m_ext.data[1]) << 32;
> + }
> + }
I think it would be clearer to add:
else {
ntuple->vlan_tag_mask = ~(u16)0;
ntuple->data_mask = ~(u64)0;
}
rather than use memset() above.
> + return 0;
> +}
> +
> static int do_srxntuple(int fd, struct ifreq *ifr)
> {
> + struct ethtool_rx_ntuple ntuplecmd;
> + struct ethtool_value eval;
> int err;
>
> - if (sntuple_changed) {
> - struct ethtool_rx_ntuple ntuplecmd;
> + /* verify if Ntuple is supported on the HW */
This comment is inaccurate.
> + err = flow_spec_to_ntuple(&rx_rule_fs, &ntuplecmd.fs);
> + if (err)
> + return -1;
> +
> + /*
> + * Check to see if the flag is set for N-tuple, this allows
> + * us to avoid the possible EINVAL response for the N-tuple
> + * flag not being set on the device
> + */
> + eval.cmd = ETHTOOL_GFLAGS;
> + ifr->ifr_data = (caddr_t)&eval;
> + err = ioctl(fd, SIOCETHTOOL, ifr);
> + if (err || !(eval.data & ETH_FLAG_NTUPLE))
> + return -1;
>
> - ntuplecmd.cmd = ETHTOOL_SRXNTUPLE;
> - memcpy(&ntuplecmd.fs, &ntuple_fs,
> - sizeof(struct ethtool_rx_ntuple_flow_spec));
> + /* send rule via N-tuple */
> + ntuplecmd.cmd = ETHTOOL_SRXNTUPLE;
> + ifr->ifr_data = (caddr_t)&ntuplecmd;
> + err = ioctl(fd, SIOCETHTOOL, ifr);
>
> - ifr->ifr_data = (caddr_t)&ntuplecmd;
> - err = ioctl(fd, SIOCETHTOOL, ifr);
> - if (err < 0)
> - perror("Cannot add new RX n-tuple filter");
> + /*
> + * Display error only if reponse is something other than op not
> + * supported. It is possible that the interface uses the network
> + * flow classifier interface instead of N-tuple.
> + */
> + if (err && errno != EOPNOTSUPP)
> + perror("Cannot add new rule via N-tuple");
> +
> + return err;
> +}
> +
> +static int do_srxclsrule(int fd, struct ifreq *ifr)
> +{
> + int err;
> +
> + if (rx_class_rule_added) {
> + /* attempt to add rule via N-tuple specifier */
> + err = do_srxntuple(fd, ifr);
> + if (!err)
> + return 0;
> +
> + /* attempt to add rule via network flow classifier */
> + err = rxclass_rule_ins(fd, ifr, &rx_rule_fs);
> + if (err < 0) {
> + fprintf(stderr, "Cannot insert"
> + " classification rule\n");
> + return 1;
> + }
Is this the right order to try them? I'm not sure.
> + } else if (rx_class_rule_del >= 0) {
> + err = rxclass_rule_del(fd, ifr, rx_class_rule_del);
> +
> + if (err < 0) {
> + fprintf(stderr, "Cannot delete"
> + " classification rule\n");
> + return 1;
> + }
> } else {
> exit_bad_args();
> }
[...]
> diff --git a/rxclass.c b/rxclass.c
> new file mode 100644
> index 0000000..5ad0639
> --- /dev/null
> +++ b/rxclass.c
> @@ -0,0 +1,1106 @@
> +/*
> + * Copyright (C) 2008 Sun Microsystems, Inc. All rights reserved.
> + */
> +#include <stdio.h>
> +#include <stdint.h>
> +#include <stddef.h>
> +#include <stdlib.h>
> +#include <string.h>
> +#include <errno.h>
> +
> +#include <linux/sockios.h>
> +#include <arpa/inet.h>
> +#include "ethtool-util.h"
> +#include "ethtool-bitops.h"
> +
> +/*
> + * This is a rule manager implementation for ordering rx flow
> + * classification rules in a longest prefix first match order.
> + * The assumption is that this rule manager is the only one adding rules to
> + * the device's hardware classifier.
> + */
> +
> +struct rmgr_ctrl {
> + /* slot contains a bitmap indicating which filters are valid */
> + unsigned long *slot;
> + __u32 n_rules;
> + __u32 size;
> +};
> +
> +static struct rmgr_ctrl rmgr;
> +static int rmgr_init_done = 0;
> +
> +static void invert_flow_mask(struct ethtool_rx_flow_spec *fsp)
> +{
> + int i;
Should be size_t, since it's compared with a sizeof() expression.
> + for (i = 0; i < sizeof(fsp->m_u); i++)
> + fsp->m_u.hdata[i] ^= 0xFF;
> +}
> +
> +static void rmgr_print_nfc_spec_ext(struct ethtool_rx_flow_spec *fsp)
> +{
> + u64 data, datam;
> + __u16 etype, etypem, tci, tcim;
> +
> + if (!(fsp->flow_type & FLOW_EXT))
> + return;
> +
> + etype = ntohs(fsp->h_ext.vlan_etype);
> + etypem = ntohs(~fsp->m_ext.vlan_etype);
> + tci = ntohs(fsp->h_ext.vlan_tci);
> + tcim = ntohs(~fsp->m_ext.vlan_tci);
> + data = (u64)ntohl(fsp->h_ext.data[0]) << 32;
> + data = (u64)ntohl(fsp->h_ext.data[1]);
> + datam = (u64)ntohl(~fsp->m_ext.data[0]) << 32;
> + datam |= (u64)ntohl(~fsp->m_ext.data[1]);
> +
> + fprintf(stdout,
> + "\tVLAN EtherType: 0x%x mask: 0x%x\n"
Lower-case 'ethertype', please.
> + "\tVLAN: 0x%x mask: 0x%x\n"
> + "\tUser-defined: 0x%Lx mask: 0x%Lx\n",
'L' is not documented as an integer modifier for printf(). Use 'll'
instead.
> + etype, etypem, tci, tcim, data, datam);
> +}
> +
> +static void rmgr_print_nfc_rule(struct ethtool_rx_flow_spec *fsp)
> +{
> + unsigned char *smac, *smacm, *dmac, *dmacm;
> + __u32 sip, dip, sipm, dipm, flow_type;
> + __u16 proto, protom;
> +
> + if (fsp->location != RX_CLS_LOC_UNSPEC)
> + fprintf(stdout, "Filter: %d\n", fsp->location);
> + else
> + fprintf(stdout, "Filter: Unspecified\n");
> +
> + flow_type = fsp->flow_type & ~FLOW_EXT;
> +
> + invert_flow_mask(fsp);
> +
> + switch (flow_type) {
> + case TCP_V4_FLOW:
> + case UDP_V4_FLOW:
> + case SCTP_V4_FLOW:
> + case AH_V4_FLOW:
> + case ESP_V4_FLOW:
> + case IP_USER_FLOW:
> + sip = ntohl(fsp->h_u.tcp_ip4_spec.ip4src);
> + dip = ntohl(fsp->h_u.tcp_ip4_spec.ip4dst);
> + sipm = ntohl(fsp->m_u.tcp_ip4_spec.ip4src);
> + dipm = ntohl(fsp->m_u.tcp_ip4_spec.ip4dst);
I think this will work for AH_V4, ESP_V4 and IP_USER due to similar
structure layout, but it's kind of dodgy. Please handle each structure
type separately.
[...]
> +static int rmgr_del(__u32 loc)
> +{
> + /* verify rule exists before attempting to delete */
> + int err = rmgr_find(loc);
> + if (err)
> + return err;
> +
> + /* clear bit for the rule */
> + clear_bit(loc, rmgr.slot);
> +
> + return 0;
> +}
> +
> +static int rmgr_add(struct ethtool_rx_flow_spec *fsp)
> +{
> + __u32 loc = fsp->location;
> +
> + /* location provided, insert rule and update regions to match rule */
> + if (loc != RX_CLS_LOC_UNSPEC)
> + return rmgr_ins(loc);
> +
> + /* start at the end of the list since it is lowest priority */
> + loc = rmgr.size - 1;
> +
> + /* only part of last word is set so fill in remaining bits and test */
> + if (!~(rmgr.slot[loc / BITS_PER_LONG] |
> + (~1UL << (loc % BITS_PER_LONG))))
> + loc -= 1 + (loc % BITS_PER_LONG);
I think this is meant to avoid the need to search for bits in a partial
word but it's a very non-obvious way to do that.
> + /* find an open slot */
> + while (loc != RX_CLS_LOC_UNSPEC && !~rmgr.slot[loc / BITS_PER_LONG])
> + loc -= BITS_PER_LONG;
Just because RX_CLS_LOC_UNSPEC happens to be equal to -1 doesn't mean
it's a good idea to use the name here!
> + /* find and use available location in slot */
> + while (loc != RX_CLS_LOC_UNSPEC && test_bit(loc, rmgr.slot))
> + loc--;
> +
> + /* location found, insert rule */
> + if (loc != RX_CLS_LOC_UNSPEC) {
> + fsp->location = loc;
> + return rmgr_ins(loc);
> + }
I think it would be clearer to use a separate word index:
__u32 loc;
int i;
/* location provided, insert rule and update regions to match rule */
if (fs->location != RX_CLS_LOC_UNSPEC)
return rmgr_ins(fs->location);
/* start at the end of the list since it is lowest priority */
for (i = rmgr.size / BITS_PER_LONG - 1; i >= 0; i--) {
if (~rmgr.slot[i]) {
loc = i * BITS_PER_LONG - 1;
while (test_bit(loc, rmgr.slot))
loc--;
/* location found, insert rule */
fsp->location = loc;
return rmgr_ins(loc);
}
}
[...]
> +int rxclass_rule_getall(int fd, struct ifreq *ifr)
> +{
> + struct ethtool_rxnfc nfccmd;
> + int err, i, j;
> +
> + /* init table of available rules */
> + err = rmgr_init(fd, ifr);
> + if (err < 0)
> + return err;
> +
> + fprintf(stdout, "Total %d rules\n\n", rmgr.n_rules);
> +
> + /* fetch and display all available rules */
> + for (i = 0; i < rmgr.size; i += BITS_PER_LONG) {
> + if (!~rmgr.slot[i / BITS_PER_LONG])
> + continue;
The '~' is wrong. We want to skip words where all bits are clear, not
where all bits are set.
[...]
> +int rxclass_rule_get(int fd, struct ifreq *ifr, __u32 loc)
> +{
> + struct ethtool_rxnfc nfccmd;
> + int err;
> +
> + /* init table of available rules */
> + err = rmgr_init(fd, ifr);
> + if (err < 0)
> + return err;
> +
> + /* verify rule exists before attempting to display */
> + err = rmgr_find(loc);
> + if (err < 0)
> + return err;
Is this really necessary? Shouldn't we let the driver check that for
us, and save the cost of initialising the rule manager?
[...]
> +int rxclass_rule_ins(int fd, struct ifreq *ifr,
> + struct ethtool_rx_flow_spec *fsp)
> +{
> + struct ethtool_rxnfc nfccmd;
> + int err;
> +
> + /* init table of available rules */
> + err = rmgr_init(fd, ifr);
> + if (err < 0)
> + return err;
> +
> + /* verify rule location */
> + err = rmgr_add(fsp);
> + if (err < 0)
> + return err;
> +
> + /* notify netdev of new rule */
> + nfccmd.cmd = ETHTOOL_SRXCLSRLINS;
> + nfccmd.fs = *fsp;
> + ifr->ifr_data = (caddr_t)&nfccmd;
> + err = ioctl(fd, SIOCETHTOOL, ifr);
> + if (err < 0) {
> + perror("rmgr: Cannot insert RX class rule");
> + return -1;
> + }
> + rmgr.n_rules++;
If we're about to destroy the rule manager immediately afterwards, why
bother maintaining n_rules?
> + printf("Added rule with ID %d\n", fsp->location);
> +
> + rmgr_cleanup();
> +
> + return 0;
> +}
> +
> +int rxclass_rule_del(int fd, struct ifreq *ifr, __u32 loc)
> +{
> + struct ethtool_rxnfc nfccmd;
> + int err;
> +
> + /* init table of available rules */
> + err = rmgr_init(fd, ifr);
> + if (err < 0)
> + return err;
> +
> + /* verify rule exists */
> + err = rmgr_del(loc);
> + if (err < 0)
> + return err;
Again, I think that can be left to the driver.
[...]
> +typedef enum {
> + OPT_NONE = 0,
> + OPT_S32,
> + OPT_U8,
> + OPT_U16,
> + OPT_U32,
> + OPT_U64,
> + OPT_BE16,
> + OPT_BE32,
> + OPT_BE64,
> + OPT_IP4,
> + OPT_MAC,
> +} rule_opt_type_t;
> +
> +#define NFC_FLAG_RING 0x001
> +#define NFC_FLAG_LOC 0x002
> +#define NFC_FLAG_SADDR 0x004
> +#define NFC_FLAG_DADDR 0x008
> +#define NFC_FLAG_SPORT 0x010
> +#define NFC_FLAG_DPORT 0x020
> +#define NFC_FLAG_SPI 0x030
> +#define NFC_FLAG_TOS 0x040
> +#define NFC_FLAG_PROTO 0x080
> +#define NTUPLE_FLAG_VLAN 0x100
> +#define NTUPLE_FLAG_UDEF 0x200
> +#define NTUPLE_FLAG_VETH 0x400
> +
> +struct rule_opts {
> + const char *name;
> + rule_opt_type_t type;
> + u32 flag;
> + int offset;
> + int moffset;
> +};
I think that this ought to be merged with the argument parsing in
ethtool.c, but I won't insist that you do that immedaitely. However:
[...]
> +static int rxclass_get_ipv4(char *str, __be32 *val)
> +{
> + if (!strchr(str, '.')) {
> + unsigned long long v;
> + int err;
> +
> + err = rxclass_get_ulong(str, &v, 32);
> + if (err)
> + return -1;
> +
> + *val = htonl((u32)v);
> +
> + return 0;
> + }
> +
> + if (!inet_pton(AF_INET, str, val))
> + return -1;
There's no need to make a special case for integers. inet_aton() should
handle all the historically supported IPv4 literal formats.
[...]
> +int rxclass_parse_ruleopts(char **argp, int argc,
> + struct ethtool_rx_flow_spec *fsp)
> +{
> + const struct rule_opts *options;
> + unsigned char *p = (unsigned char *)fsp;
> + int i = 0, n_opts, err;
> + u32 flags = 0;
> + int flow_type;
> +
> + if (*argp == NULL || **argp == '\0' || argc < 1)
> + goto syntax_err;
argc < 1 is sufficient.
> + if (!strcmp(argp[0], "tcp4"))
> + flow_type = TCP_V4_FLOW;
> + else if (!strcmp(argp[0], "udp4"))
> + flow_type = UDP_V4_FLOW;
> + else if (!strcmp(argp[0], "sctp4"))
> + flow_type = SCTP_V4_FLOW;
> + else if (!strcmp(argp[0], "ah4"))
> + flow_type = AH_V4_FLOW;
> + else if (!strcmp(argp[0], "esp4"))
> + flow_type = ESP_V4_FLOW;
> + else if (!strcmp(argp[0], "ip4"))
> + flow_type = IP_USER_FLOW;
> + else if (!strcmp(argp[0], "ether"))
> + flow_type = ETHER_FLOW;
> + else
> + goto syntax_err;
> +
> + switch (flow_type) {
> + case TCP_V4_FLOW:
> + case UDP_V4_FLOW:
> + case SCTP_V4_FLOW:
> + options = rule_nfc_tcp_ip4;
> + n_opts = ARRAY_SIZE(rule_nfc_tcp_ip4);
> + break;
> + case AH_V4_FLOW:
> + case ESP_V4_FLOW:
> + options = rule_nfc_esp_ip4;
> + n_opts = ARRAY_SIZE(rule_nfc_esp_ip4);
> + break;
> + case IP_USER_FLOW:
> + options = rule_nfc_usr_ip4;
> + n_opts = ARRAY_SIZE(rule_nfc_usr_ip4);
> + break;
> + case ETHER_FLOW:
> + options = rule_nfc_ether;
> + n_opts = ARRAY_SIZE(rule_nfc_ether);
> + break;
> + default:
> + fprintf(stdout, "Add rule, invalid rule type[%s]\n", argp[0]);
stderr, not stdout
[...]
> + if (idx == n_opts) {
> + fprintf(stdout, "Add rule, unreconized option[%s]\n",
Typo: 'unreconized' should be 'unrecognized'.
> + argp[i]);
> + return -1;
> + }
> + }
> +
> + if (flags & (NTUPLE_FLAG_VLAN | NTUPLE_FLAG_UDEF | NTUPLE_FLAG_VETH))
> + fsp->flow_type |= FLOW_EXT;
> +
> + return 0;
> +
> +syntax_err:
> + fprintf(stdout, "Add rule, invalid syntax\n");
stderr
> + return -1;
> +}
>
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox