* Re: pull request: wireless-2.6 2009-11-23
From: David Miller @ 2009-11-23 22:02 UTC (permalink / raw)
To: linville-2XuSBdqkA4R54TAoqtyWWQ
Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20091123214251.GB9045-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
From: "John W. Linville" <linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
Date: Mon, 23 Nov 2009 16:42:52 -0500
> Here are a few more fixes intended for 2.6.32. They are small and
> self-contained and mostly speak for themselves.
>
> Please let me know if there are problems!
Pulled, thanks a lot John.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" 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: [net-next-2.6 PATCH] net/ipv4: Move && and || to end of previous line
From: Ilpo Järvinen @ 2009-11-23 22:08 UTC (permalink / raw)
To: Joe Perches; +Cc: David Miller, william.allen.simpson, Netdev
In-Reply-To: <1259000895.16503.77.camel@Joe-Laptop.home>
On Mon, 23 Nov 2009, Joe Perches wrote:
> On Sun, 2009-11-22 at 16:31 -0800, David Miller wrote:
> > It should be of the form:
> > if (x &&
> > y)
> >
> > or:
> > if (x && y)
> >
> > Fix patches, rather than complaints, for existing cases where things
> > do not follow this pattern are certainly welcome.
>
> Also collapsed some multiple tabs to single space.
>
> Compiled tested only:
>
> net/ipv4/inet_lro.c | 36 ++++++++++++++++++------------------
> net/ipv4/ip_output.c | 6 ++++--
> net/ipv4/ipconfig.c | 13 ++++++-------
> net/ipv4/route.c | 19 ++++++++++---------
> net/ipv4/tcp_htcp.c | 10 +++++-----
> net/ipv4/tcp_input.c | 4 ++--
> net/ipv4/tcp_lp.c | 4 ++--
> net/ipv4/tcp_output.c | 4 ++--
> net/ipv4/tcp_probe.c | 4 ++--
> net/ipv4/tcp_veno.c | 5 ++---
> net/ipv4/tcp_yeah.c | 4 ++--
> net/ipv4/udp.c | 36 ++++++++++++++++++------------------
> 12 files changed, 73 insertions(+), 72 deletions(-)
>
> diff --git a/net/ipv4/inet_lro.c b/net/ipv4/inet_lro.c
> index 6a667da..47038cb 100644
> --- a/net/ipv4/inet_lro.c
> +++ b/net/ipv4/inet_lro.c
> @@ -64,15 +64,15 @@ static int lro_tcp_ip_check(struct iphdr *iph, struct tcphdr *tcph,
> if (iph->ihl != IPH_LEN_WO_OPTIONS)
> return -1;
>
> - if (tcph->cwr || tcph->ece || tcph->urg || !tcph->ack
> - || tcph->rst || tcph->syn || tcph->fin)
> + if (tcph->cwr || tcph->ece || tcph->urg || !tcph->ack ||
> + tcph->rst || tcph->syn || tcph->fin)
> return -1;
>
> if (INET_ECN_is_ce(ipv4_get_dsfield(iph)))
> return -1;
>
> - if (tcph->doff != TCPH_LEN_WO_OPTIONS
> - && tcph->doff != TCPH_LEN_W_TIMESTAMP)
> + if (tcph->doff != TCPH_LEN_WO_OPTIONS &&
> + tcph->doff != TCPH_LEN_W_TIMESTAMP)
> return -1;
>
> /* check tcp options (only timestamp allowed) */
> @@ -262,10 +262,10 @@ static int lro_check_tcp_conn(struct net_lro_desc *lro_desc,
> struct iphdr *iph,
> struct tcphdr *tcph)
> {
> - if ((lro_desc->iph->saddr != iph->saddr)
> - || (lro_desc->iph->daddr != iph->daddr)
> - || (lro_desc->tcph->source != tcph->source)
> - || (lro_desc->tcph->dest != tcph->dest))
> + if ((lro_desc->iph->saddr != iph->saddr) ||
> + (lro_desc->iph->daddr != iph->daddr) ||
> + (lro_desc->tcph->source != tcph->source) ||
> + (lro_desc->tcph->dest != tcph->dest))
> return -1;
> return 0;
> }
> @@ -339,9 +339,9 @@ static int __lro_proc_skb(struct net_lro_mgr *lro_mgr, struct sk_buff *skb,
> u64 flags;
> int vlan_hdr_len = 0;
>
> - if (!lro_mgr->get_skb_header
> - || lro_mgr->get_skb_header(skb, (void *)&iph, (void *)&tcph,
> - &flags, priv))
> + if (!lro_mgr->get_skb_header ||
> + lro_mgr->get_skb_header(skb, (void *)&iph, (void *)&tcph,
> + &flags, priv))
> goto out;
>
> if (!(flags & LRO_IPV4) || !(flags & LRO_TCP))
> @@ -351,8 +351,8 @@ static int __lro_proc_skb(struct net_lro_mgr *lro_mgr, struct sk_buff *skb,
> if (!lro_desc)
> goto out;
>
> - if ((skb->protocol == htons(ETH_P_8021Q))
> - && !(lro_mgr->features & LRO_F_EXTRACT_VLAN_ID))
> + if ((skb->protocol == htons(ETH_P_8021Q)) &&
> + !(lro_mgr->features & LRO_F_EXTRACT_VLAN_ID))
> vlan_hdr_len = VLAN_HLEN;
>
> if (!lro_desc->active) { /* start new lro session */
> @@ -446,9 +446,9 @@ static struct sk_buff *__lro_proc_segment(struct net_lro_mgr *lro_mgr,
> int hdr_len = LRO_MAX_PG_HLEN;
> int vlan_hdr_len = 0;
>
> - if (!lro_mgr->get_frag_header
> - || lro_mgr->get_frag_header(frags, (void *)&mac_hdr, (void *)&iph,
> - (void *)&tcph, &flags, priv)) {
> + if (!lro_mgr->get_frag_header ||
> + lro_mgr->get_frag_header(frags, (void *)&mac_hdr, (void *)&iph,
> + (void *)&tcph, &flags, priv)) {
> mac_hdr = page_address(frags->page) + frags->page_offset;
> goto out1;
> }
> @@ -472,8 +472,8 @@ static struct sk_buff *__lro_proc_segment(struct net_lro_mgr *lro_mgr,
> if (!skb)
> goto out;
>
> - if ((skb->protocol == htons(ETH_P_8021Q))
> - && !(lro_mgr->features & LRO_F_EXTRACT_VLAN_ID))
> + if ((skb->protocol == htons(ETH_P_8021Q)) &&
> + !(lro_mgr->features & LRO_F_EXTRACT_VLAN_ID))
> vlan_hdr_len = VLAN_HLEN;
>
> iph = (void *)(skb->data + vlan_hdr_len);
> diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
> index 322b408..b78e615 100644
> --- a/net/ipv4/ip_output.c
> +++ b/net/ipv4/ip_output.c
> @@ -264,9 +264,11 @@ int ip_mc_output(struct sk_buff *skb)
>
> This check is duplicated in ip_mr_input at the moment.
> */
> - && ((rt->rt_flags&RTCF_LOCAL) || !(IPCB(skb)->flags&IPSKB_FORWARDED))
> + &&
> + ((rt->rt_flags & RTCF_LOCAL) ||
> + !(IPCB(skb)->flags & IPSKB_FORWARDED))
> #endif
> - ) {
> + ) {
Certainly better in general already but there is still some work to be
done here as now you have an && only line. I guess it mostly has to do
with comments but #if... blahblahs could be another type of failure (in
automation like this).
--
i.
^ permalink raw reply
* Re: macvlan: fix gso_max_size setting
From: Patrick McHardy @ 2009-11-23 22:11 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20091123.101013.40629093.davem@davemloft.net>
David Miller wrote:
> From: Patrick McHardy <kaber@trash.net>
> Date: Mon, 23 Nov 2009 11:33:06 +0100
>
>
>> Fix macvlan gso_max_size setting. Based on net-next-2.6.git.
>
> Pretty serious defect, maybe net-2.6 material?
Sure, please take it in net-2.6.
>
> If someone hits this, it's going to trigger something awful.
Don't drivers simply drop the packet? Otherwise I think you
should be able to trigger the same problem using the TC mirred
action.
^ permalink raw reply
* Re: [Resend][PATCH] Wireless / ath5k: Simplify suspend and resume callbacks
From: Rafael J. Wysocki @ 2009-11-23 22:12 UTC (permalink / raw)
To: John W. Linville
Cc: ath5k-devel, linux-wireless, Bob Copeland, LKML, pm list, netdev,
Luis R. Rodriguez
In-Reply-To: <20091123213353.GA9045@tuxdriver.com>
On Monday 23 November 2009, John W. Linville wrote:
> On Sat, Nov 21, 2009 at 11:44:24PM +0100, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rjw@sisk.pl>
> > Subject: Wireless / ath5k: Simplify suspend and resume callbacks
> >
> > Simplify the suspend and resume callbacks of ath5k by converting the
> > driver to struct dev_pm_ops and allowing the PCI PM core to do the
> > PCI-specific suspend/resume handling.
> >
> > Tested with Atheros Communications Inc. AR2413 802.11bg NIC (rev 01)
> > D-Link CardBus.adapter.
> >
> > Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
>
> This is already queued for -next.
Thanks!
Rafael
^ permalink raw reply
* Re: [net-next-2.6 PATCH] net/ipv4: Move && and || to end of previous line
From: Joe Perches @ 2009-11-23 22:14 UTC (permalink / raw)
To: Ilpo Järvinen; +Cc: David Miller, william.allen.simpson, Netdev
In-Reply-To: <alpine.DEB.2.00.0911240004530.19211@melkinpaasi.cs.helsinki.fi>
On Tue, 2009-11-24 at 00:08 +0200, Ilpo Järvinen wrote:
> Certainly better in general already but there is still some work to be
> done here as now you have an && only line. I guess it mostly has to do
> with comments but #if... blahblahs could be another type of failure (in
> automation like this).
The current form is
if (foo
#ifdef BAR
&& bar
#endif
)
Another option could be:
#ifdef BAR
if (foo && bar)
#else
if (foo)
#endif
In any case, it won't be pretty.
^ permalink raw reply
* Re: [net-next-2.6 PATCH] net/ipv[46]/netfilter: Move && and || to end of previous line
From: Patrick McHardy @ 2009-11-23 22:20 UTC (permalink / raw)
To: Joe Perches; +Cc: David Miller, netdev, netfilter-devel
In-Reply-To: <1259005771.16503.90.camel@Joe-Laptop.home>
Joe Perches wrote:
> On Sun, 2009-11-22 at 16:31 -0800, David Miller wrote:
>
>> It should be of the form:
>> if (x &&
>> y)
>>
>> or:
>> if (x && y)
>>
>> Fix patches, rather than complaints, for existing cases where things
>> do not follow this pattern are certainly welcome.
>>
>
> Compile tested only.
>
Applied, thanks for cleaning this up.
^ permalink raw reply
* Re: macvlan: fix gso_max_size setting
From: David Miller @ 2009-11-23 22:22 UTC (permalink / raw)
To: kaber; +Cc: netdev
In-Reply-To: <4B0B087B.3020000@trash.net>
From: Patrick McHardy <kaber@trash.net>
Date: Mon, 23 Nov 2009 23:11:07 +0100
> David Miller wrote:
>> From: Patrick McHardy <kaber@trash.net>
>> Date: Mon, 23 Nov 2009 11:33:06 +0100
>>
>>
>>> Fix macvlan gso_max_size setting. Based on net-next-2.6.git.
>>
>> Pretty serious defect, maybe net-2.6 material?
>
> Sure, please take it in net-2.6.
Done, thanks.
>>
>> If someone hits this, it's going to trigger something awful.
>
> Don't drivers simply drop the packet? Otherwise I think you
> should be able to trigger the same problem using the TC mirred
> action.
I see nothing in the IXGBE driver's transmit code paths which guard
against this.
^ permalink raw reply
* Re: [PATCH 1/1] Defer skb allocation for both mergeable buffers and big packets in virtio_net
From: Rusty Russell @ 2009-11-23 22:24 UTC (permalink / raw)
To: Shirley Ma
Cc: Eric Dumazet, Michael S. Tsirkin, Avi Kivity, netdev, kvm,
linux-kernel, Hollis Blanchard
In-Reply-To: <1258992421.5022.19.camel@localhost.localdomain>
On Tue, 24 Nov 2009 02:37:01 am Shirley Ma wrote:
> > > + skb = (struct sk_buff *)buf;
> > This cast is unnecessary, but a comment would be nice:
>
> Without this cast there is a compile warning.
Hi Shirley,
Looks like buf is a void *, so no cast should be necessary. But I could
be reading the patch wrong.
> > However, I question whether making it 16 byte is the right thing: the
> > ethernet header is 14 bytes long, so don't we want 8 bytes of padding?
>
> Because in QEMU it requires 10 bytes header in a separately, so one page
> is used to share between virtio_net_hdr header which is 10 bytes head
> and rest of data. So I put 6 bytes offset here between two buffers. I
> didn't look at the reason why a seperate buf is used for virtio_net_hdr
> in QEMU.
It's a qemu bug. It insists the header be an element in the scatterlist by
itself. Unfortunately we have to accommodate it.
However, there's no reason for the merged rxbuf and big packet layout to be
the same: for the big packet case you should layout as follows:
#define BIG_PACKET_PAD (NET_SKB_PAD - sizeof(struct virtio_net_hdr) + NET_IP_ALIGN)
struct big_packet_page {
struct virtio_net_hdr hdr;
char pad[BIG_PACKET_PAD];
/* Actual packet data starts here */
unsigned char data[PAGE_SIZE - BIG_PACKET_PAD - sizeof(struct virtio_net_hdr)];
};
Then use this type as the template for registering the sg list for the
big packet case.
> > I think you can move the memcpy outside the if, like so:
> >
> > memcpy(&hdr, p, hdr_len);
>
> I didn't move it out, because num_buf = hdr->mhdr.num_buffers;
Yes, that has to stay inside, but the memcpy can move out. It's just a bit
neater to have more common code.
Thanks,
Rusty.
^ permalink raw reply
* Re: [Bugme-new] [Bug 14677] New: multicast client application does not receive packets
From: Andrew Morton @ 2009-11-23 22:31 UTC (permalink / raw)
To: netdev; +Cc: bugzilla-daemon, bugme-daemon, berndp
In-Reply-To: <bug-14677-10286@http.bugzilla.kernel.org/>
(switched to email. Please respond via emailed reply-to-all, not via the
bugzilla web interface).
On Mon, 23 Nov 2009 22:00:45 GMT
bugzilla-daemon@bugzilla.kernel.org wrote:
> http://bugzilla.kernel.org/show_bug.cgi?id=14677
>
> Summary: multicast client application does not receive packets
> Product: Networking
> Version: 2.5
> Kernel Version: 2.6.31.4-2.6.32-rc8
> Platform: All
> OS/Version: Linux
> Tree: Mainline
> Status: NEW
> Severity: normal
> Priority: P1
> Component: IPV4
> AssignedTo: shemminger@linux-foundation.org
> ReportedBy: berndp@optonline.net
> Regression: Yes
>
>
> When upgrading the kernel from 2.6.29.1 to 2.6.31.4, we discovered that packets
> no longer get delivered to an application that is subscribing to the multicast
> data.
>
> We verified that multicast support was compiled into the kernel
> (CONFIG_IP_MULTICAST). A dump on the interface with tcpdump shows the multicast
> packets arriving on the network interface. However, they do not get delivered
> to the application.
>
> /proc/net/igmp clearly showed that we were subscribed to the relevant multicast
> groups, and netstat showed that the application was listening.
>
> Upgrading to 2.6.32-rc8 did not fix the problem, but downgrading to 2.6.29.1
> did.
>
> This problem was seen on two different supermicro systems: one with a single
> (4-core) i7 940 Intel CPU, and another one with dual X5570 Xeon CPUS. In both
> cases the interface was on a quad-port NIC card 82571EB gigabit ethernet
> controller, rev 06.
^ permalink raw reply
* Re: [net-next-2.6 PATCH] net/ipv4: Move && and || to end of previous line
From: Ilpo Järvinen @ 2009-11-23 22:32 UTC (permalink / raw)
To: Joe Perches; +Cc: David Miller, william.allen.simpson, Netdev
In-Reply-To: <1259014446.16503.116.camel@Joe-Laptop.home>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1051 bytes --]
On Mon, 23 Nov 2009, Joe Perches wrote:
> On Tue, 2009-11-24 at 00:08 +0200, Ilpo Järvinen wrote:
> > Certainly better in general already but there is still some work to be
> > done here as now you have an && only line. I guess it mostly has to do
> > with comments but #if... blahblahs could be another type of failure (in
> > automation like this).
>
> The current form is
>
> if (foo
> #ifdef BAR
> && bar
> #endif
> )
>
> Another option could be:
>
> #ifdef BAR
> if (foo && bar)
> #else
> if (foo)
> #endif
>
> In any case, it won't be pretty.
But wouldn't your automation produce:
#ifdef BAR
if (foo
#endif
&&
bar
? Like it did for the case where there was a comment between.
As I didn't go through the whole patch I don't know if there were in fact
any #if things that got made into that kind of construct or not (just
mentioned it that such places might also be affected incorrectly by your
automation). I only noticed one of such after comment (ie., && on
otherwise empty line) and hit reply.
--
i.
^ permalink raw reply
* Re: macvlan: fix gso_max_size setting
From: Patrick McHardy @ 2009-11-23 22:33 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Herbert Xu
In-Reply-To: <20091123.142207.14190542.davem@davemloft.net>
[-- Attachment #1: Type: text/plain, Size: 862 bytes --]
David Miller wrote:
> From: Patrick McHardy <kaber@trash.net>
> Date: Mon, 23 Nov 2009 23:11:07 +0100
>
>
>> David Miller wrote:
>>
>>> From: Patrick McHardy <kaber@trash.net>
>>> Date: Mon, 23 Nov 2009 11:33:06 +0100
>>>
>>>
>>>
>>>> Fix macvlan gso_max_size setting. Based on net-next-2.6.git.
>>>>
>>> Pretty serious defect, maybe net-2.6 material?
>>>
>> Sure, please take it in net-2.6.
>>
>
> Done, thanks.
>
>
>>> If someone hits this, it's going to trigger something awful.
>>>
>> Don't drivers simply drop the packet? Otherwise I think you
>> should be able to trigger the same problem using the TC mirred
>> action.
>>
>
> I see nothing in the IXGBE driver's transmit code paths which guard
> against this.
>
Perhaps we should simply fall back to software in that case.
Compile tested only.
[-- Attachment #2: x --]
[-- Type: text/plain, Size: 685 bytes --]
net: fall back to software segmentation if skb length exceeds dev->gso_max_size
Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ffc3106..edd1e2b 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1943,7 +1943,8 @@ static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
{
return skb_is_gso(skb) &&
(!skb_gso_ok(skb, dev->features) ||
- unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
+ unlikely(skb->ip_summed != CHECKSUM_PARTIAL) ||
+ unlikely(skb->len > dev->gso_max_size));
}
static inline void netif_set_gso_max_size(struct net_device *dev,
^ permalink raw reply related
* Re: ixgbe question
From: Robert Olsson @ 2009-11-23 22:14 UTC (permalink / raw)
To: David Miller; +Cc: robert, eric.dumazet, hawk, peter.p.waskiewicz.jr, netdev
In-Reply-To: <20091123.132823.162855593.davem@davemloft.net>
David Miller writes:
> It seem very obvious to me that, for whatever reason, the MSI-X vectors
> are only being sent to cpu 1 on Eric's system.
>
> I also suspect, as a result, that it has nothing to do with the IXGBE
> driver but rather is some IRQ controller programming or some bug or
> limitation in the IRQ affinity mask handling in the kernel.
Probably so yes. I'll guess Eric will dig into this.
Cheers
--ro
^ permalink raw reply
* Diagnostic Monitoring Interface Monitoring (DOM) PATCH 0/5 for net-next-2.6
From: Robert Olsson @ 2009-11-23 22:45 UTC (permalink / raw)
To: David Miller; +Cc: netdev, robert
Here are basic support to bring Diagnostic Monitoring Interface Monitoring (DOM)
to Linux this is more or less mandatory when building optical networks.
Optical modules as SFP, SFP+, XFP, GBIC etc holds transceiver and link diagnostic
data needed to monitor and troubleshoot optical links, Talks to networks cards
via the I2C-bus (DOM lives in memory page 0xA2).
In essential:
Usage example: ethtool -D eth5
Ext-Calbr: Avr RX-Power: Alarm & Warn: RX_LOS: Wavelength: 1310 nm
Alarms, warnings in beginning of line, Ie. AH = Alarm High, WL == Warn Low etc
Temp: 35.9 C Thresh: Lo: -12.0/-8.0 Hi: 103.0/110.0 C
Vcc: 3.33 V Thresh: Lo: 3.0/3.0 Hi: 3.7/4.0 V
Tx-Bias: 13.4 mA Thresh: Lo: 2.0/4.0 Hi: 70.0/84.0 mA
ALWL TX-pwr: -5.9 dBm ( 0.26 mW) Thresh: Lo: -4.0/-2.0 Hi: 7.0/8.2 dBm
AHWH RX-pwr: -5.0 dBm ( 0.31 mW) Thresh: Lo: -35.2/-28.0 Hi: -8.2/-6.0 dBm
Read more in Documentation/networking/dom.txt
It's tested with the igb driver, there is also a patch for the ixgbe driver but I
haven't any SFP+ with DOM support yet.
There are room for improvements an clean-ups.
Cheers
--ro
^ permalink raw reply
* Diagnostic Monitoring Interface Monitoring (DOM) PATCH 3/5 for net-next-2.6
From: Robert Olsson @ 2009-11-23 22:52 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Robert Olsson
Signed-off-by: Robert Olsson <robert.olsson@its.uu.se>
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c
index ac9d527..5d190ad 100644
--- a/drivers/net/igb/igb_ethtool.c
+++ b/drivers/net/igb/igb_ethtool.c
@@ -34,6 +34,7 @@
#include <linux/interrupt.h>
#include <linux/if_ether.h>
#include <linux/ethtool.h>
+#include <net/dom.h>
#include <linux/sched.h>
#include "igb.h"
@@ -2063,6 +2064,234 @@ static void igb_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
}
}
+static s32 read_phy_diag(struct e1000_hw *hw, u8 page, u8 offset,
+ u16 *data)
+{
+ u32 i, i2ccmd = 0;
+
+ if (offset > E1000_MAX_SGMII_PHY_REG_ADDR) {
+ hw_dbg("DOM Register Address %u is out of range\n", offset);
+ return -E1000_ERR_PARAM;
+ }
+
+ /*
+ * Set up Op-code, Phy Address, and register address in the I2CCMD
+ * register. The MAC will take care of interfacing with the
+ * PHY to retrieve the desired data.
+ */
+
+ i2ccmd = (E1000_I2CCMD_OPCODE_READ) | (page << E1000_I2CCMD_PHY_ADDR_SHIFT) |
+ ( offset << E1000_I2CCMD_REG_ADDR_SHIFT);
+
+ wr32(E1000_I2CCMD, i2ccmd);
+
+ /* Poll the ready bit to see if the I2C read completed */
+ for (i = 0; i < E1000_I2CCMD_PHY_TIMEOUT; i++) {
+ udelay(50);
+ i2ccmd = rd32(E1000_I2CCMD);
+ //printk("DATA i2ccmd=0x%x\n", i2ccmd);
+ if (i2ccmd & E1000_I2CCMD_READY)
+ break;
+ }
+ if (!(i2ccmd & E1000_I2CCMD_READY)) {
+ hw_dbg("I2CCMD Read did not complete\n");
+ return -E1000_ERR_PHY;
+ }
+ if (i2ccmd & E1000_I2CCMD_ERROR) {
+ hw_dbg("I2CCMD Error bit set\n");
+ return -E1000_ERR_PHY;
+ }
+
+ /* Need to byte-swap the 16-bit value. */
+ *data = ((i2ccmd >> 8) & 0x00FF) | ((i2ccmd << 8) & 0xFF00);
+ return 0;
+}
+
+int igb_get_phy_diag(struct net_device *netdev, struct ethtool_phy_diag *pd)
+{
+ struct igb_adapter *adapter = netdev_priv(netdev);
+ struct e1000_hw *hw = &adapter->hw;
+ u16 p1, p2;
+ int res;
+ u8 type, eo;
+
+ if((res = read_phy_diag(hw, 0x0, DOM_A0_DOM_TYPE, &pd->type)))
+ goto out;
+
+ type = pd->type >> 8;
+
+ if( ~(type) & DOM_TYPE_DOM || type & DOM_TYPE_LEGAGY_DOM)
+ goto out;
+
+ if( type& DOM_TYPE_DOM & DOM_TYPE_ADDR_CHNGE) {
+ hw_dbg("DOM module not supported (Address change)\n");
+ goto out;
+ }
+
+ eo = pd->type & 0xFF;
+ if((res = read_phy_diag(hw, 0x0, DOM_A0_WAVELENGTH, &pd->wavelength)))
+ goto out;
+
+ /* If supported. Read alarms and Warnings first*/
+ if( eo & DOM_EO_AW) {
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_ALARM, &pd->alarm)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_WARNING, &pd->warning)))
+ goto out;
+ }
+
+ /* Basic diag */
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TEMP, &pd->temp)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TEMP_SLOPE, &pd->temp_slope)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TEMP_OFFSET, &pd->temp_offset)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_VCC, &pd->vcc)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_VCC_SLOPE, &pd->vcc_slope)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_VCC_OFFSET, &pd->vcc_offset)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_BIAS, &pd->tx_bias)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_I_SLOPE, &pd->tx_bias_slope)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_I_OFFSET, &pd->tx_bias_offset)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_PWR, &pd->tx_pwr)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_PWR_SLOPE, &pd->tx_pwr_slope)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_PWR_OFFSET, &pd->tx_pwr_offset)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR, &pd->rx_pwr)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_0, &p1)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_0+2, &p2)))
+ goto out;
+
+ pd->rx_pwr_cal[0] = (p1<<16) + p2;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_1, &p1)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_1+2, &p2)))
+ goto out;
+
+ pd->rx_pwr_cal[1] = (p1<<16) + p2;
+
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_2, &p1)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_2+2, &p2)))
+ goto out;
+
+ pd->rx_pwr_cal[2] = (p1<<16) + p2;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_3, &p1)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_3+2, &p2)))
+ goto out;
+
+ pd->rx_pwr_cal[3] = (p1<<16) + p2;
+
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_4, &p1)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_4+2, &p2)))
+ goto out;
+
+ pd->rx_pwr_cal[4] = (p1<<16) + p2;
+
+ /* Thresholds for Alarms and Warnings */
+ if( !(eo & DOM_EO_AW))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TEMP_AHT, &pd->temp_aht)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TEMP_ALT, &pd->temp_alt)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TEMP_WHT, &pd->temp_wht)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TEMP_WLT, &pd->temp_wlt)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_VCC_AHT, &pd->vcc_aht)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_VCC_ALT, &pd->vcc_alt)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_VCC_WHT, &pd->vcc_wht)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_VCC_WLT, &pd->vcc_wlt)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_BIAS_AHT, &pd->tx_bias_aht)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_BIAS_ALT, &pd->tx_bias_alt)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_BIAS_WHT, &pd->tx_bias_wht)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_BIAS_WLT, &pd->tx_bias_wlt)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_PWR_AHT, &pd->tx_pwr_aht)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_PWR_ALT, &pd->tx_pwr_alt)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_PWR_WHT, &pd->tx_pwr_wht)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_PWR_WLT, &pd->tx_pwr_wlt)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_AHT, &pd->rx_pwr_aht)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_ALT, &pd->rx_pwr_alt)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_WHT, &pd->rx_pwr_wht)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_WLT, &pd->rx_pwr_wlt)))
+ goto out;
+
+out:
+ return res;
+}
+
static const struct ethtool_ops igb_ethtool_ops = {
.get_settings = igb_get_settings,
.set_settings = igb_set_settings,
@@ -2097,6 +2326,7 @@ static const struct ethtool_ops igb_ethtool_ops = {
.get_ethtool_stats = igb_get_ethtool_stats,
.get_coalesce = igb_get_coalesce,
.set_coalesce = igb_set_coalesce,
+ .get_phy_diag = igb_get_phy_diag,
};
void igb_set_ethtool_ops(struct net_device *netdev)
^ permalink raw reply related
* Diagnostic Monitoring Interface Monitoring (DOM) PATCH 4/5 for net-next-2.6
From: Robert Olsson @ 2009-11-23 22:55 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Robert Olsson
Signed-off-by: Robert Olsson <robert.olsson@its.uu.se>
Untested.
--ro
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index 026e94a..a5bdd65 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -34,9 +34,11 @@
#include <linux/ethtool.h>
#include <linux/vmalloc.h>
#include <linux/uaccess.h>
+#include <net/dom.h>
#include "ixgbe.h"
-
+#include "ixgbe_phy.h"
+#include "ixgbe_common.h"
#define IXGBE_ALL_RAR_ENTRIES 16
@@ -2031,6 +2033,206 @@ static int ixgbe_set_flags(struct net_device *netdev, u32 data)
}
+static s32 read_phy_diag(struct ixgbe_hw *hw, u8 page, u8 offset,
+ u16 *data)
+{
+ s32 status = 0;
+ u8 tmp [2];
+
+ status = ixgbe_read_i2c_byte_generic(hw, page, offset, &tmp[0]);
+ if(status != 0)
+ goto err;
+
+ status = ixgbe_read_i2c_byte_generic(hw, page, offset, &tmp[1]);
+ *data = (tmp[0]<<8) | tmp[1];
+err:
+ return status;
+}
+
+int ixgb_get_phy_diag(struct net_device *netdev, struct ethtool_phy_diag *pd)
+{
+ struct ixgbe_adapter *adapter = netdev_priv(netdev);
+ struct ixgbe_hw *hw = &adapter->hw;
+ u16 p1, p2;
+ int res;
+ u8 type, eo;
+
+ if((res = read_phy_diag(hw, 0x0, DOM_A0_DOM_TYPE, &pd->type)))
+ goto out;
+
+ type = pd->type >> 8;
+
+ if( ~(type) & DOM_TYPE_DOM || type & DOM_TYPE_LEGAGY_DOM)
+ goto out;
+
+ if( type& DOM_TYPE_DOM & DOM_TYPE_ADDR_CHNGE) {
+ hw_dbg(hw, "DOM module not supported (Address change)\n");
+ goto out;
+ }
+
+ eo = pd->type & 0xFF;
+ if((res = read_phy_diag(hw, 0x0, DOM_A0_WAVELENGTH, &pd->wavelength)))
+ goto out;
+
+ /* If supported. Read alarms and Warnings first*/
+ if( eo & DOM_EO_AW) {
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_ALARM, &pd->alarm)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_WARNING, &pd->warning)))
+ goto out;
+ }
+
+ /* Basic diag */
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TEMP, &pd->temp)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TEMP_SLOPE, &pd->temp_slope)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TEMP_OFFSET, &pd->temp_offset)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_VCC, &pd->vcc)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_VCC_SLOPE, &pd->vcc_slope)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_VCC_OFFSET, &pd->vcc_offset)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_BIAS, &pd->tx_bias)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_I_SLOPE, &pd->tx_bias_slope)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_I_OFFSET, &pd->tx_bias_offset)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_PWR, &pd->tx_pwr)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_PWR_SLOPE, &pd->tx_pwr_slope)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_PWR_OFFSET, &pd->tx_pwr_offset)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR, &pd->rx_pwr)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_0, &p1)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_0+2, &p2)))
+ goto out;
+
+ pd->rx_pwr_cal[0] = (p1<<16) + p2;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_1, &p1)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_1+2, &p2)))
+ goto out;
+
+ pd->rx_pwr_cal[1] = (p1<<16) + p2;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_2, &p1)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_2+2, &p2)))
+ goto out;
+
+ pd->rx_pwr_cal[2] = (p1<<16) + p2;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_3, &p1)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_3+2, &p2)))
+ goto out;
+
+ pd->rx_pwr_cal[3] = (p1<<16) + p2;
+
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_4, &p1)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_4+2, &p2)))
+ goto out;
+
+ pd->rx_pwr_cal[4] = (p1<<16) + p2;
+
+ /* Thresholds for Alarms and Warnings */
+ if( !(eo & DOM_EO_AW))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TEMP_AHT, &pd->temp_aht)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TEMP_ALT, &pd->temp_alt)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TEMP_WHT, &pd->temp_wht)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TEMP_WLT, &pd->temp_wlt)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_VCC_AHT, &pd->vcc_aht)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_VCC_ALT, &pd->vcc_alt)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_VCC_WHT, &pd->vcc_wht)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_VCC_WLT, &pd->vcc_wlt)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_BIAS_AHT, &pd->tx_bias_aht)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_BIAS_ALT, &pd->tx_bias_alt)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_BIAS_WHT, &pd->tx_bias_wht)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_BIAS_WLT, &pd->tx_bias_wlt)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_PWR_AHT, &pd->tx_pwr_aht)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_PWR_ALT, &pd->tx_pwr_alt)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_PWR_WHT, &pd->tx_pwr_wht)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_PWR_WLT, &pd->tx_pwr_wlt)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_AHT, &pd->rx_pwr_aht)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_ALT, &pd->rx_pwr_alt)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_WHT, &pd->rx_pwr_wht)))
+ goto out;
+
+ if((res = read_phy_diag(hw, 0x1, DOM_A2_RX_PWR_WLT, &pd->rx_pwr_wlt)))
+ goto out;
+
+out:
+ return res;
+}
+
static const struct ethtool_ops ixgbe_ethtool_ops = {
.get_settings = ixgbe_get_settings,
.set_settings = ixgbe_set_settings,
@@ -2066,5 +2268,6 @@ static const struct ethtool_ops ixgbe_ethtool_ops = {
.set_coalesce = ixgbe_set_coalesce,
.get_flags = ethtool_op_get_flags,
.set_flags = ixgbe_set_flags,
+ .get_phy_diag = ixgb_get_phy_diag,
};
^ permalink raw reply related
* Diagnostic Monitoring Interface Monitoring (DOM) PATCH 5/5 for net-next-2.6
From: Robert Olsson @ 2009-11-23 22:58 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Robert Olsson
Ethtool support.
Signed-off-by: Robert Olsson <robert.olsson@its.uu.se>
Cheers
--ro
diff --git a/Makefile.am b/Makefile.am
index eac65fe..0988a6c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,5 @@
AM_CFLAGS = -Wall
+AM_LDLAGS = -lm
man_MANS = ethtool.8
EXTRA_DIST = LICENSE ethtool.8 ethtool.spec.in aclocal.m4 ChangeLog autogen.sh
diff --git a/ethtool-copy.h b/ethtool-copy.h
index 3ca4e2c..90ea1cb 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -266,6 +266,54 @@ struct ethtool_stats {
__u64 data[0];
};
+/* Diagmostic Monitoring Interface Data -- DOM */
+struct ethtool_phy_diag {
+ __u32 cmd;
+ /* A0 page */
+ __u16 type;
+ __u16 wavelength;
+ /* A2 page */
+ __u16 alarm;
+ __u16 warning;
+ __s16 temp;
+ __u16 temp_slope;
+ __s16 temp_offset;
+ __u16 vcc;
+ __u16 vcc_slope;
+ __s16 vcc_offset;
+ __u16 tx_bias;
+ __u16 tx_bias_slope;
+ __s16 tx_bias_offset;
+ __u16 tx_pwr;
+ __u16 tx_pwr_slope;
+ __s16 tx_pwr_offset;
+ __u16 rx_pwr;
+ __u32 rx_pwr_cal[5];
+
+ /* Thresholds */
+ __s16 temp_alt;
+ __s16 temp_aht;
+ __s16 temp_wlt;
+ __s16 temp_wht;
+ __u16 vcc_alt;
+ __u16 vcc_aht;
+ __u16 vcc_wlt;
+ __u16 vcc_wht;
+ __u16 tx_bias_alt;
+ __u16 tx_bias_aht;
+ __u16 tx_bias_wlt;
+ __u16 tx_bias_wht;
+ __u16 tx_pwr_alt;
+ __u16 tx_pwr_aht;
+ __u16 tx_pwr_wlt;
+ __u16 tx_pwr_wht;
+ __u16 rx_pwr_alt;
+ __u16 rx_pwr_aht;
+ __u16 rx_pwr_wlt;
+ __u16 rx_pwr_wht;
+};
+
+
struct ethtool_perm_addr {
__u32 cmd; /* ETHTOOL_GPERMADDR */
__u32 size;
diff --git a/ethtool-util.h b/ethtool-util.h
index 5572771..1a69426 100644
--- a/ethtool-util.h
+++ b/ethtool-util.h
@@ -9,7 +9,9 @@
typedef unsigned long long __u64;
typedef __uint32_t __u32; /* ditto */
typedef __uint16_t __u16; /* ditto */
+typedef __int16_t __s16; /* ditto */
typedef __uint8_t __u8; /* ditto */
+typedef __int8_t __s8; /* ditto */
/* historical: we used to use kernel-like types; remove these once cleaned */
typedef unsigned long long u64;
diff --git a/ethtool.c b/ethtool.c
index 0110682..caa9f6c 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -14,6 +14,7 @@
* amd8111e support by Reeja John <reeja.john@amd.com>
* long arguments by Andi Kleen.
* SMSC LAN911x support by Steve Glendinning <steve.glendinning@smsc.com>
+ * Diagnostic Monitoring Interface Support by Robert Olsson <robert@herjulf.net>
*
* TODO:
* * no-args => summary of each device (mii-tool style)
@@ -38,8 +39,9 @@
#include <errno.h>
#include <net/if.h>
#include <sys/utsname.h>
-
#include <linux/sockios.h>
+#include "dom.h"
+
#include "ethtool-util.h"
@@ -78,6 +80,7 @@ static int dump_rxfhash(int fhash, u64 val);
static int do_srxclass(int fd, struct ifreq *ifr);
static int do_grxclass(int fd, struct ifreq *ifr);
static int send_ioctl(int fd, struct ifreq *ifr);
+static int do_phy_diag(int fd, struct ifreq *ifr);
static enum {
MODE_HELP = -1,
@@ -101,6 +104,7 @@ static enum {
MODE_GSTATS,
MODE_GNFC,
MODE_SNFC,
+ MODE_PHY_DIAG
} mode = MODE_GSET;
static struct option {
@@ -184,6 +188,7 @@ static struct option {
{ "-t", "--test", MODE_TEST, "Execute adapter self test",
" [ online | offline ]\n" },
{ "-S", "--statistics", MODE_GSTATS, "Show adapter statistics" },
+ { "-D", "--phy_diag", MODE_PHY_DIAG, "Show PHY diagnostics" },
{ "-n", "--show-nfc", MODE_GNFC, "Show Rx network flow classification"
"options",
" [ rx-flow-hash tcp4|udp4|ah4|sctp4|"
@@ -496,7 +501,8 @@ static void parse_cmdline(int argc, char **argp)
(mode == MODE_GSTATS) ||
(mode == MODE_GNFC) ||
(mode == MODE_SNFC) ||
- (mode == MODE_PHYS_ID)) {
+ (mode == MODE_PHYS_ID) ||
+ (mode == MODE_PHY_DIAG)) {
devname = argp[i];
break;
}
@@ -1504,6 +1510,8 @@ static int doit(void)
return do_grxclass(fd, &ifr);
} else if (mode == MODE_SNFC) {
return do_srxclass(fd, &ifr);
+ } else if (mode == MODE_PHY_DIAG) {
+ return do_phy_diag(fd, &ifr);
}
return 69;
@@ -2403,6 +2411,287 @@ static int send_ioctl(int fd, struct ifreq *ifr)
return ioctl(fd, SIOCETHTOOL, ifr);
}
+static int do_phy_diag(int fd, struct ifreq *ifr)
+{
+ int err, ecal = 0, aw = 0;
+ double tmp, alt=0, aht=0, wlt=0, wht=0;
+ __u8 type, option, alarm[2], warn[2];
+
+
+ struct ethtool_phy_diag pd;
+
+ pd.cmd = ETHTOOL_GPHYDIAG;
+ ifr->ifr_data = (caddr_t)&pd;
+ err = ioctl(fd, SIOCETHTOOL, ifr);
+ if (err < 0) {
+ perror("Cannot get PHY diagnostics");
+ return 0;
+ }
+
+ type = pd.type >> 8;
+
+ if( ~(type) & DOM_TYPE_DOM || type & DOM_TYPE_LEGAGY_DOM) {
+ fprintf(stdout, "PHY Diagnostics not supported:\n");
+ return 0;
+ }
+
+ if(type & DOM_TYPE_INT_CAL)
+ fprintf(stdout, "Int-Calbr: ");
+
+ if(type & DOM_TYPE_EXT_CAL) {
+ fprintf(stdout, "Ext-Calbr: ");
+ ecal = 1;
+ }
+
+ if(type & DOM_TYPE_RX_PWR)
+ fprintf(stdout, "Avr RX-Power: ");
+ else
+ fprintf(stdout, "OMA RX-Power: ");
+
+ if(type & DOM_TYPE_ADDR_CHNGE)
+ fprintf(stdout,"Addr Change: ");
+
+ /* Check options */
+ option = pd.type & 0x00FF;
+
+ if(option & DOM_EO_AW) {
+ fprintf(stdout, "Alarm & Warn: ");
+ aw = 1;
+ }
+
+ if(option & DOM_EO_TX_DISABLE)
+ fprintf(stdout, "TX_DISABLE: ");
+
+ if(option & DOM_EO_TX_FAULT)
+ fprintf(stdout, "TX_FAULT: ");
+
+ if(option & DOM_EO_RX_LOS)
+ fprintf(stdout, "RX_LOS: ");
+
+ if(option & DOM_EO_RATE_SELECT_MON)
+ fprintf(stdout, "RATE_SELECT MON: ");
+
+ if(option & DOM_EO_APP_SELECT)
+ fprintf(stdout, "RATE_SELECT: ");
+
+ if(option & DOM_EO_RATE_SELECT)
+ fprintf(stdout, "RATE_SELECT: ");
+
+ if(aw) {
+ alarm[0] = pd.alarm >> 8;
+ alarm[1] = pd.alarm & 0x00FF;;
+
+ warn[0] = pd.warning >> 8;
+ warn[1] = pd.warning & 0x00FF;
+ }
+
+
+ fprintf(stdout, "\tWavelength: %d nm\n", pd.wavelength);
+
+ if(aw)
+ fprintf(stdout, "Alarms, warnings in beginning of line, Ie. AH = Alarm High, WL == Warn Low etc\n");
+
+
+#define ECAL(v, s, o) (( ((double) (s>>8)) + (s & 0xFF)) * (double) v + o)
+
+ /* Temp */
+
+ if (ecal) {
+ tmp = ECAL(pd.temp, pd.temp_slope, pd.temp_offset);
+ if(aw) {
+ alt = ECAL(pd.temp_alt, pd.temp_slope, pd.temp_offset);
+ aht = ECAL(pd.temp_aht, pd.temp_slope, pd.temp_offset);
+ wlt = ECAL(pd.temp_wlt, pd.temp_slope, pd.temp_offset);
+ wht = ECAL(pd.temp_wht, pd.temp_slope, pd.temp_offset);
+ }
+
+ }
+ else
+ tmp = (double) (pd.temp);
+
+ if(aw) {
+ if(alarm[0] & DOM_TYPE_TEMP_AH)
+ fprintf(stdout, "AH");
+
+ if(alarm[0] & DOM_TYPE_TEMP_AL)
+ fprintf(stdout, "AL");
+
+ if(warn[0] & DOM_TYPE_TEMP_WH)
+ fprintf(stdout, "WH");
+
+ if(warn[0] & DOM_TYPE_TEMP_WL)
+ fprintf(stdout, "WL");
+ }
+ fprintf(stdout, "\tTemp: %5.1f C", tmp/256);
+ if(aw)
+ fprintf(stdout, "\t\t\tThresh: Lo: %5.1f/%-5.1f Hi: %5.1f/%-5.1f C\n",
+ alt/256, wlt/256, wht/256, aht/256);
+ else
+ fprintf(stdout, "\n");
+
+
+
+ /* VCC */
+
+ if (ecal) {
+ tmp = ECAL(pd.vcc, pd.vcc_slope, pd.vcc_offset);
+ if(aw) {
+ alt = ECAL(pd.vcc_alt, pd.vcc_slope, pd.temp_offset);
+ aht = ECAL(pd.vcc_aht, pd.vcc_slope, pd.temp_offset);
+ wlt = ECAL(pd.vcc_wlt, pd.vcc_slope, pd.temp_offset);
+ wht = ECAL(pd.vcc_wht, pd.vcc_slope, pd.temp_offset);
+ }
+ }
+ else
+ tmp = (double) (pd.vcc);
+
+ fprintf(stdout, "\tVcc: %5.2f V\t", tmp/10000);
+ if(1)
+ fprintf(stdout, "\t\tThresh: Lo: %5.1f/%-5.1f Hi: %5.1f/%-5.1f V\n",
+ alt/10000, wlt/10000, wht/10000, aht/10000);
+
+ else
+ fprintf(stdout, "\n");
+
+
+ /* TX BIAS */
+
+ if (ecal) {
+ tmp = ECAL(pd.tx_bias, pd.tx_bias_slope, pd.tx_bias_offset);
+ if(aw) {
+ alt = ECAL(pd.tx_bias_alt, pd.tx_bias_slope, pd.temp_offset);
+ aht = ECAL(pd.tx_bias_aht, pd.tx_bias_slope, pd.temp_offset);
+ wlt = ECAL(pd.tx_bias_wlt, pd.tx_bias_slope, pd.temp_offset);
+ wht = ECAL(pd.tx_bias_wht, pd.tx_bias_slope, pd.temp_offset);
+ }
+ }
+ else
+ tmp = (double) (pd.tx_bias);
+
+ if(aw) {
+
+ if(alarm[0] & DOM_TYPE_TX_BIAS_AH)
+ fprintf(stdout, "AH");
+
+ if(alarm[0] & DOM_TYPE_TX_BIAS_AL)
+ fprintf(stdout, "AL");
+
+ if(warn[0] & DOM_TYPE_TX_BIAS_WH)
+ fprintf(stdout, "WH");
+
+ if(warn[0] & DOM_TYPE_TX_BIAS_WL)
+ fprintf(stdout, "WL");
+
+ }
+ fprintf(stdout, "\tTx-Bias: %5.1f mA\t", tmp/500);
+ if(aw)
+ fprintf(stdout, "\tThresh: Lo: %5.1f/%-5.1f Hi: %5.1f/%-5.1f mA\n",
+ alt/500, wlt/500, wht/500, aht/500);
+
+ else
+ fprintf(stdout, "\n");
+
+
+ /* TX PWR */
+
+ if (ecal) {
+ tmp = ECAL(pd.tx_pwr, pd.tx_pwr_slope, pd.tx_pwr_offset);
+ if(aw) {
+ alt = ECAL(pd.tx_pwr_alt, pd.tx_pwr_slope, pd.temp_offset);
+ aht = ECAL(pd.tx_pwr_aht, pd.tx_pwr_slope, pd.temp_offset);
+ wlt = ECAL(pd.tx_pwr_wlt, pd.tx_pwr_slope, pd.temp_offset);
+ wht = ECAL(pd.tx_pwr_wht, pd.tx_pwr_slope, pd.temp_offset);
+ }
+ }
+ else
+ tmp = (double) (pd.tx_pwr);
+ if(aw) {
+
+ if(alarm[0] & DOM_TYPE_TX_PWR_AH)
+ fprintf(stdout, "AH");
+
+ if(alarm[0] & DOM_TYPE_TX_PWR_AL)
+ fprintf(stdout, "AL");
+
+ if(warn[0] & DOM_TYPE_TX_PWR_WH)
+ fprintf(stdout, "WH");
+
+ if(warn[0] & DOM_TYPE_TX_PWR_WL)
+ fprintf(stdout, "WL");
+
+ }
+ tmp = tmp/10000;
+ fprintf(stdout, "\tTX-pwr: %5.1f dBm (%5.2f mW)", 10*log10(tmp), tmp);
+ if(aw) {
+ alt = alt/10000;
+ aht = aht/10000;
+ wlt = wlt/10000;
+ wht = wht/10000;
+ fprintf(stdout, "\tThresh: Lo: %5.1f/%-5.1f Hi: %5.1f/%-5.1f dBm\n",
+ 10*log10(alt), 10*log10(wlt), 10*log10(wht), 10*log10(aht));
+ }
+ else
+ fprintf(stdout, "\n");
+
+ /* RX PWR */
+ if (ecal) {
+ /* Note factors is in floast cast to avoid conversion */
+ float *f[5];
+ double s, o;
+
+ f[0] = (float *) &pd.rx_pwr_cal[0];
+ f[1] = (float *) &pd.rx_pwr_cal[1];
+ f[2] = (float *) &pd.rx_pwr_cal[2];
+ f[3] = (float *) &pd.rx_pwr_cal[3];
+ f[4] = (float *) &pd.rx_pwr_cal[4];
+ s = *f[4] + *f[3] + *f[2] + *f[1];
+ o = *f[0];
+
+ if(aw) {
+ tmp = pd.rx_pwr * s + o;
+ alt = pd.rx_pwr_alt * s + o;
+ aht = pd.rx_pwr_aht * s + o;
+ wlt = pd.rx_pwr_wlt * s + o;
+ wht = pd.rx_pwr_wht * s + o;
+ }
+ }
+ else
+ tmp = (double) (pd.rx_pwr);
+
+ if(aw) {
+
+ if(alarm[1] & DOM_TYPE_RX_PWR_AH)
+ fprintf(stdout, "AH");
+
+ if(alarm[1] & DOM_TYPE_RX_PWR_AL)
+ fprintf(stdout, "AL");
+
+ if(warn[1] & DOM_TYPE_RX_PWR_WH)
+ fprintf(stdout, "WH");
+
+ if(warn[1] & DOM_TYPE_RX_PWR_WL)
+ fprintf(stdout, "WL");
+
+ }
+ tmp = (double) (tmp)/10000;
+ fprintf(stdout, "\tRX-pwr: %5.1f dBm (%5.2f mW) ", 10*log10(tmp), tmp);
+
+ if(aw) {
+ alt = alt/10000;
+ aht = aht/10000;
+ wlt = wlt/10000;
+ wht = wht/10000;
+
+ fprintf(stdout, "\tThresh: Lo: %5.1f/%-5.1f Hi: %5.1f/%-5.1f dBm\n",
+ 10*log10(alt), 10*log10(wlt), 10*log10(wht), 10*log10(aht));
+ }
+ else
+ fprintf(stdout, "\n");
+
+ return 0;
+}
+
+
int main(int argc, char **argp, char **envp)
{
parse_cmdline(argc, argp);
^ permalink raw reply related
* Re: Diagnostic Monitoring Interface Monitoring (DOM) PATCH 4/5 for net-next-2.6
From: Joe Perches @ 2009-11-23 23:07 UTC (permalink / raw)
To: Robert Olsson; +Cc: David Miller, netdev
In-Reply-To: <19211.4849.284727.703717@gargle.gargle.HOWL>
On Mon, 2009-11-23 at 23:55 +0100, Robert Olsson wrote:
> Signed-off-by: Robert Olsson <robert.olsson@its.uu.se>
Can you run ./scripts/checkpatch.pl on your patches please?
> + if((res = read_phy_diag(hw, 0x1, DOM_A2_TEMP_SLOPE, &pd->temp_slope)))
> + goto out;
[etc...]
> + if((res = read_phy_diag(hw, 0x1, DOM_A2_TX_I_OFFSET, &pd->tx_bias_offset)))
> + goto out;
perhaps this is clearer as:
if (read_phy_diag(hw, 0x1, reg, loc) ||
read_phy_diag(hw, 0x1, reg2, loc2) ||
...
read_phy_diag(hw, 0x1, regN, locN))
goto out;
^ permalink raw reply
* Diagnostic Monitoring Interface Monitoring (DOM) PATCH 1/5 for net-next-2.6
From: Robert Olsson @ 2009-11-23 22:49 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Robert Olsson
Signed-off-by: Robert Olsson <robert.olsson@its.uu.se>
diff --git a/Documentation/networking/dom.txt b/Documentation/networking/dom.txt
new file mode 100644
index 0000000..ff255b4
--- /dev/null
+++ b/Documentation/networking/dom.txt
@@ -0,0 +1,41 @@
+Diagnostic Monitoring Interface Monitoring also called DOM is a specification
+for optical transceivers to allow link and other diagnostics related to the
+transceiver's to standardized and communicated. For communication the I2C
+bus is used. The SFF specifications is available at ftp://ftp.seagate.com/
+Specification is generic and should work for many types of optical modules
+as GBIC, SFP, SFp+, XFP etc
+
+In short DOM spec adds a memory page where the diagnostics's is kept (address
+0xA2 bytes 66 to 105) but there are lot's of option's and variants. For example
+alarm and warnings are optional. See example below.
+
+Not all SFP's (SFP is for GIGE) have DOM support normally long range supports
+DOM. And of course your board and driver needs this support too.
+For SFP+ (10G) DOM is mandatory.
+
+Linux kernel support is via ethertool.
+
+include/net/dom.h # Basic definitions
+net/core/ethtool.c # adds ethtool_phy_diag()
+include/linux/ethtool.h # adds ETHTOOL_GPHYDIAG
+
+And drivers hooks exists currently in igb and ixgbe driver
+
+Usage example: ethtool -D eth5
+
+Ext-Calbr: Avr RX-Power: Alarm & Warn: RX_LOS: Wavelength: 1310 nm
+Alarms, warnings in beginning of line, Ie. AH = Alarm High, WL == Warn Low etc
+ Temp: 35.9 C Thresh: Lo: -12.0/-8.0 Hi: 103.0/110.0 C
+ Vcc: 3.33 V Thresh: Lo: 3.0/3.0 Hi: 3.7/4.0 V
+ Tx-Bias: 13.4 mA Thresh: Lo: 2.0/4.0 Hi: 70.0/84.0 mA
+ALWL TX-pwr: -5.9 dBm ( 0.26 mW) Thresh: Lo: -4.0/-2.0 Hi: 7.0/8.2 dBm
+AHWH RX-pwr: -5.0 dBm ( 0.31 mW) Thresh: Lo: -35.2/-28.0 Hi: -8.2/-6.0 dBm
+
+
+First line shows the options supported by the module. As we see this module
+supports Alarms and warnings as a consequence thresholds are printed. As example
+RX-pwr: -35.2 < no_alarm < -6.0 dBm and -28.0 < no_warning < -8.2 dBm. (dBm yields
+1 mW == 0 dBm)
+
+In the example above we see both warnings for both TX-pwr (low) and RX-Pwr high.
+The Rx side would need some attenuation.
diff --git a/include/net/dom.h b/include/net/dom.h
new file mode 100644
index 0000000..4c118a9
--- /dev/null
+++ b/include/net/dom.h
@@ -0,0 +1,109 @@
+#ifndef _LINUX_DOM_H
+#define _LINUX_DOM_H
+
+/*
+ Diagnostic Monitoring Interface for Optical Tranceivers
+ SFF-8472 v. 10.4 (Jan 2009)
+ ftp://ftp.seagate.com/sff/SFF-8472.PDF
+
+ Licensce GPL. Copyright Robert Olsson robert@herjulf.net
+*/
+
+#define DOM_A0_IDENTIFIER 0
+#define DOM_A0_WAVELENGTH 60
+#define DOM_A0_CC_BASE 63
+#define DOM_A0_DOM_TYPE 92
+
+/* DOM_TYPE codings in DOM_A0_DOM_TYPE */
+#define DOM_TYPE_LEGAGY_DOM (1<<7)
+#define DOM_TYPE_DOM (1<<6) /* Has DOM support */
+#define DOM_TYPE_INT_CAL (1<<5) /* Internally calibrated */
+#define DOM_TYPE_EXT_CAL (1<<4) /* Externally calibrated */
+#define DOM_TYPE_RX_PWR (1<<3) /* Received Power OMA=0, 1=average */
+#define DOM_TYPE_ADDR_CHNGE (1<<2) /* Address change required */
+
+#define DOM_A0_EO 93 /* Enhanced options */
+#define DOM_EO_AW (1<<7) /* Alarm & Warnings */
+#define DOM_EO_TX_DISABLE (1<<6)
+#define DOM_EO_TX_FAULT (1<<5)
+#define DOM_EO_RX_LOS (1<<4)
+#define DOM_EO_RATE_SELECT_MON (1<<3)
+#define DOM_EO_APP_SELECT (1<<2)
+#define DOM_EO_RATE_SELECT (1<<1)
+
+#define DOM_A0_CC_EXT 95
+
+#define DOM_A2_TEMP_AHT 0 /* Temp alarm high threshold */
+#define DOM_A2_TEMP_ALT 2
+#define DOM_A2_TEMP_WHT 4 /* Temp warning high threshold */
+#define DOM_A2_TEMP_WLT 6
+
+#define DOM_A2_VCC_AHT 8 /* VCC alarm high threshold */
+#define DOM_A2_VCC_ALT 10
+#define DOM_A2_VCC_WHT 12 /* VCC warning high threshold */
+#define DOM_A2_VCC_WLT 14
+
+#define DOM_A2_TX_BIAS_AHT 16 /* TX_BIAS alarm high threshold */
+#define DOM_A2_TX_BIAS_ALT 18
+#define DOM_A2_TX_BIAS_WHT 20 /* TX_BIAS warning high threshold */
+#define DOM_A2_TX_BIAS_WLT 22
+
+#define DOM_A2_TX_PWR_AHT 24 /* TX_PWR alarm high threshold */
+#define DOM_A2_TX_PWR_ALT 26
+#define DOM_A2_TX_PWR_WHT 28 /* TX_PWR warning high threshold */
+#define DOM_A2_TX_PWR_WLT 30
+
+#define DOM_A2_RX_PWR_AHT 32 /* RX_PWR alarm high threshold */
+#define DOM_A2_RX_PWR_ALT 34
+#define DOM_A2_RX_PWR_WHT 36 /* RX_PWR warning high threshold */
+#define DOM_A2_RX_PWR_WLT 38
+
+#define DOM_A2_RX_PWR_4 56 /* 4 bytes Calibration constants*/
+#define DOM_A2_RX_PWR_3 60 /* 4 bytes */
+#define DOM_A2_RX_PWR_2 64 /* 4 bytes */
+#define DOM_A2_RX_PWR_1 68 /* 4 bytes */
+#define DOM_A2_RX_PWR_0 72 /* 4 bytes */
+
+#define DOM_A2_TX_I_SLOPE 76 /* 2 bytes */
+#define DOM_A2_TX_I_OFFSET 78 /* 2 bytes */
+#define DOM_A2_TX_PWR_SLOPE 80 /* 2 bytes */
+#define DOM_A2_TX_PWR_OFFSET 82 /* 2 bytes */
+#define DOM_A2_TEMP_SLOPE 84 /* 2 bytes */
+#define DOM_A2_TEMP_OFFSET 86 /* 2 bytes */
+#define DOM_A2_VCC_SLOPE 88 /* 2 bytes */
+#define DOM_A2_VCC_OFFSET 90 /* 2 bytes */
+
+#define DOM_A2_CC_DMI 95
+#define DOM_A2_TEMP 96 /* 2 bytes */
+#define DOM_A2_VCC 98 /* 2 bytes */
+#define DOM_A2_TX_BIAS 100 /* 2 bytes */
+#define DOM_A2_TX_PWR 102 /* 2 bytes */
+#define DOM_A2_RX_PWR 104 /* 2 bytes */
+
+#define DOM_A2_ALARM 112 /* 2 bytes */
+#define DOM_TYPE_TEMP_AH (1<<7) /* Temp alarm high */
+#define DOM_TYPE_TEMP_AL (1<<6) /* low */
+#define DOM_TYPE_VCC_AH (1<<5)
+#define DOM_TYPE_VCC_AL (1<<4)
+#define DOM_TYPE_TX_BIAS_AH (1<<3)
+#define DOM_TYPE_TX_BIAS_AL (1<<2)
+#define DOM_TYPE_TX_PWR_AH (1<<1)
+#define DOM_TYPE_TX_PWR_AL (1<<0)
+/* Next byte 113 */
+#define DOM_TYPE_RX_PWR_AH (1<<7)
+#define DOM_TYPE_RX_PWR_AL (1<<6)
+
+#define DOM_A2_WARNING 116 /* 2 bytes */
+#define DOM_TYPE_TEMP_WH (1<<7) /* Temp warning high */
+#define DOM_TYPE_TEMP_WL (1<<6) /* low */
+#define DOM_TYPE_VCC_WH (1<<5)
+#define DOM_TYPE_VCC_WL (1<<4)
+#define DOM_TYPE_TX_BIAS_WH (1<<3)
+#define DOM_TYPE_TX_BIAS_WL (1<<2)
+#define DOM_TYPE_TX_PWR_WH (1<<1)
+#define DOM_TYPE_TX_PWR_WL (1<<0)
+/* Next byte 117 */
+#define DOM_TYPE_RX_PWR_WH (1<<7)
+#define DOM_TYPE_RX_PWR_WL (1<<6)
+
+#endif /* _LINUX_DOM_H */
^ permalink raw reply related
* Re: linux-next: manual merge of the net tree with the net-current tree
From: Stephen Rothwell @ 2009-11-23 23:17 UTC (permalink / raw)
To: Amit Salecha
Cc: David Miller, netdev@vger.kernel.org, linux-next@vger.kernel.org,
linux-kernel@vger.kernel.org
In-Reply-To: <99737F4847ED0A48AECC9F4A1974A4B80CFE956C25@MNEXMB2.qlogic.org>
[-- Attachment #1: Type: text/plain, Size: 285 bytes --]
Hi Amit,
On Mon, 23 Nov 2009 12:09:10 -0600 Amit Salecha <amit.salecha@qlogic.com> wrote:
>
> This merge looks ok and I have tested it.
Thanks for the confirmation.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* Diagnostic Monitoring Interface Monitoring (DOM) PATCH 2/5 for net-next-2.6
From: Robert Olsson @ 2009-11-23 22:51 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Robert Olsson
Signed-off-by: Robert Olsson <robert.olsson@its.uu.se>
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index edd03b7..d2a729b 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -272,6 +272,53 @@ struct ethtool_stats {
__u64 data[0];
};
+/* Diagmostic Monitoring Interface Data -- DOM */
+struct ethtool_phy_diag {
+ __u32 cmd;
+ /* A0 page */
+ __u16 type;
+ __u16 wavelength;
+ /* A2 page */
+ __u16 alarm;
+ __u16 warning;
+ __s16 temp;
+ __u16 temp_slope;
+ __s16 temp_offset;
+ __u16 vcc;
+ __u16 vcc_slope;
+ __s16 vcc_offset;
+ __u16 tx_bias;
+ __u16 tx_bias_slope;
+ __s16 tx_bias_offset;
+ __u16 tx_pwr;
+ __u16 tx_pwr_slope;
+ __s16 tx_pwr_offset;
+ __u16 rx_pwr;
+ __u32 rx_pwr_cal[5];
+
+ /* Thresholds */
+ __s16 temp_alt;
+ __s16 temp_aht;
+ __s16 temp_wlt;
+ __s16 temp_wht;
+ __u16 vcc_alt;
+ __u16 vcc_aht;
+ __u16 vcc_wlt;
+ __u16 vcc_wht;
+ __u16 tx_bias_alt;
+ __u16 tx_bias_aht;
+ __u16 tx_bias_wlt;
+ __u16 tx_bias_wht;
+ __u16 tx_pwr_alt;
+ __u16 tx_pwr_aht;
+ __u16 tx_pwr_wlt;
+ __u16 tx_pwr_wht;
+ __u16 rx_pwr_alt;
+ __u16 rx_pwr_aht;
+ __u16 rx_pwr_wlt;
+ __u16 rx_pwr_wht;
+};
+
struct ethtool_perm_addr {
__u32 cmd; /* ETHTOOL_GPERMADDR */
__u32 size;
@@ -499,6 +546,7 @@ struct ethtool_ops {
int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
int (*flash_device)(struct net_device *, struct ethtool_flash *);
int (*reset)(struct net_device *, u32 *);
+ int (*get_phy_diag)(struct net_device *, struct ethtool_phy_diag*);
};
#endif /* __KERNEL__ */
@@ -557,6 +605,7 @@ struct ethtool_ops {
#define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */
#define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */
#define ETHTOOL_RESET 0x00000034 /* Reset hardware */
+#define ETHTOOL_GPHYDIAG 0x00000035 /* Get PHY diagnostics */
/* compatibility with older code */
#define SPARC_ETH_GSET ETHTOOL_GSET
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index d8aee58..f4a1eae 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -893,6 +893,21 @@ static int ethtool_flash_device(struct net_device *dev, char __user *useraddr)
return dev->ethtool_ops->flash_device(dev, &efl);
}
+static int ethtool_phy_diag(struct net_device *dev, void __user *useraddr)
+{
+ struct ethtool_phy_diag pd;
+
+ if (!dev->ethtool_ops->get_phy_diag)
+ return -EOPNOTSUPP;
+
+ dev->ethtool_ops->get_phy_diag(dev, &pd); /* FIXME */
+
+ if (copy_to_user(useraddr, &pd, sizeof(pd)))
+ return -EFAULT;
+
+ return 0;
+}
+
/* The main entry point in this file. Called from net/core/dev.c */
int dev_ethtool(struct net *net, struct ifreq *ifr)
@@ -1112,6 +1127,9 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
case ETHTOOL_RESET:
rc = ethtool_reset(dev, useraddr);
break;
+ case ETHTOOL_GPHYDIAG:
+ rc = ethtool_phy_diag(dev, useraddr);
+ break;
default:
rc = -EOPNOTSUPP;
}
^ permalink raw reply related
* Re: [PATCH 1/1] Defer skb allocation for both mergeable buffers and big packets in virtio_net
From: Shirley Ma @ 2009-11-23 23:27 UTC (permalink / raw)
To: Rusty Russell
Cc: Eric Dumazet, Michael S. Tsirkin, Avi Kivity, netdev, kvm,
linux-kernel, Hollis Blanchard
In-Reply-To: <200911240854.24054.rusty@rustcorp.com.au>
On Tue, 2009-11-24 at 08:54 +1030, Rusty Russell wrote:
> #define BIG_PACKET_PAD (NET_SKB_PAD - sizeof(struct virtio_net_hdr) +
> NET_IP_ALIGN)
> struct big_packet_page {
> struct virtio_net_hdr hdr;
> char pad[BIG_PACKET_PAD];
> /* Actual packet data starts here */
> unsigned char data[PAGE_SIZE - BIG_PACKET_PAD - sizeof(struct
> virtio_net_hdr)];
> };
The padding was used for qemu userspace buffer copy, skb data is copied
from the page for size of GOOD_COPY_LEN, and skb data is reserved
NET_IP_ALIGN.
If we add paddings as above, userspace copy will starts NET_SKB_PAD +
NET_IP_ALIGN? I am little bit confused here.
> Then use this type as the template for registering the sg list for the
> big packet case.
>
> > > I think you can move the memcpy outside the if, like so:
> > >
> > > memcpy(&hdr, p, hdr_len);
> >
> > I didn't move it out, because num_buf = hdr->mhdr.num_buffers;
>
> Yes, that has to stay inside, but the memcpy can move out. It's just
> a bit
> neater to have more common code.
num_buf is assigned after memcpy so we couldn't move memcpy out.
Anyway I separated mergeable buffers and big packets in the new patch to
make it clear and it will be easy to modify when we drop big packets
support in the future.
Thanks
Shirley
^ permalink raw reply
* Re: ixgbe question
From: Waskiewicz Jr, Peter P @ 2009-11-23 23:28 UTC (permalink / raw)
To: Eric Dumazet
Cc: robert@herjulf.net, Jesper Dangaard Brouer,
Waskiewicz Jr, Peter P, Linux Netdev List
In-Reply-To: <4B0ABF6D.9000103@gmail.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2301 bytes --]
On Mon, 23 Nov 2009, Eric Dumazet wrote:
> robert@herjulf.net a écrit :
> > Eric Dumazet writes:
> >
> > > Jesper Dangaard Brouer a écrit :
> > >
> > > > How is your smp_affinity mask's set?
> > > >
> > > > grep . /proc/irq/*/fiber1-*/../smp_affinity
> > >
> >
> > Weird... set clone_skb to 1 to be sure and vary dst or something so
> > the HW classifier selects different queues and with proper RX affinty.
> >
> > You should see in /proc/net/softnet_stat something like:
> >
> > 012a7bb9 00000000 000000ae 00000000 00000000 00000000 00000000 00000000 00000000
> > 01288d4c 00000000 00000049 00000000 00000000 00000000 00000000 00000000 00000000
> > 0128fe28 00000000 00000043 00000000 00000000 00000000 00000000 00000000 00000000
> > 01295387 00000000 00000047 00000000 00000000 00000000 00000000 00000000 00000000
> > 0129a722 00000000 0000004a 00000000 00000000 00000000 00000000 00000000 00000000
> > 0128c5e4 00000000 00000046 00000000 00000000 00000000 00000000 00000000 00000000
> > 0128f718 00000000 00000043 00000000 00000000 00000000 00000000 00000000 00000000
> > 012993e3 00000000 0000004a 00000000 00000000 00000000 00000000 00000000 00000000
> >
>
> slone_skb set to 1, this changes nothing but slows down pktgen (obviously)
>
> Result: OK: 117614452(c117608705+d5746) nsec, 100000000 (60byte,0frags)
> 850235pps 408Mb/sec (408112800bps) errors: 0
>
> All RX processing of 16 RX queues done by CPU 1 only.
Ok, I was confused earlier. I thought you were saying that all packets
were headed into a single Rx queue. This is different.
Do you know what version of irqbalance you're running, or if it's running
at all? We've seen issues with irqbalance where it won't recognize the
ethernet device if the driver has been reloaded. In that case, it won't
balance the interrupts at all. If the default affinity was set to one
CPU, then well, you're screwed.
My suggestion in this case is after you reload ixgbe and start your tests,
see if it all goes to one CPU. If it does, then restart irqbalance
(service irqbalance restart - or just kill it and restart by hand). Then
start running your test, and in 10 seconds you should see the interrupts
move and spread out.
Let me know if this helps,
-PJ
^ permalink raw reply
* Re: [PATCH] irq: Add node_affinity CPU masks for smarter irqbalance hints
From: Waskiewicz Jr, Peter P @ 2009-11-23 23:32 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Waskiewicz Jr, Peter P, Yong Zhang, linux-kernel@vger.kernel.org,
arjan@linux.jf.intel.com, davem@davemloft.net,
netdev@vger.kernel.org
In-Reply-To: <1258995923.4531.715.camel@laptop>
On Mon, 23 Nov 2009, Peter Zijlstra wrote:
> On Mon, 2009-11-23 at 01:36 -0800, Peter P Waskiewicz Jr wrote:
>
> > This mechanism isn't going to be used by any internal kernel mechanism
> > for determining interrupt placement or operation. It's purely something
> > that either a driver can modify, or external script (through /proc),
> > that irqbalance will make use of. If irqbalance isn't running, or the
> > current version of irqbalance doesn't support reading node_affinity,
> > then it won't affect the system's operation.
> >
> > If irqbalance does support it, it'll read whatever the supplied mask is,
> > and then will try and balance interrupts within that mask. It will bail
> > if the mask is invalid, or won't apply to the running system, just like
> > how putting a bogus mask into smp_affinity is ignored.
> >
> > If there's something I'm missing beyond this with the two suggestions
> > you've made (I looked into those two parameters and tried to draw
> > conclusions), please let me know.
>
> I don't see the point in adding it, if the driver wants to set a node
> cpu mask it can already do that using the regular smp affinity settings.
Unfortunately, a driver can't. The irq_set_affinity() function isn't
exported. I proposed a patch on netdev to export it, and then to tie down
an interrupt using IRQF_NOBALANCING, so irqbalance won't touch it. That
was rejected, since the driver is enforcing policy of the interrupt
balancing, not irqbalance.
I and Jesse Brandeburg had a meeting with Arjan about this. What we came
up with was this interface, so drivers can set what they'd like to see, if
irqbalance decides to honor it. That way interrupt affinity policies are
set only by irqbalance, but this interface gives us a mechanism to hint to
irqbalance what we'd like it to do.
Also, if you use the /proc interface to change smp_affinity on an
interrupt without any of these changes, irqbalance will override it on its
next poll interval. This also is not desirable.
Cheers,
-PJ
^ permalink raw reply
* Re: ixgbe question
From: David Miller @ 2009-11-23 23:44 UTC (permalink / raw)
To: peter.p.waskiewicz.jr; +Cc: eric.dumazet, robert, hawk, netdev
In-Reply-To: <Pine.WNT.4.64.0911231525180.10056@ppwaskie-MOBL2.amr.corp.intel.com>
From: "Waskiewicz Jr, Peter P" <peter.p.waskiewicz.jr@intel.com>
Date: Mon, 23 Nov 2009 15:28:18 -0800 (Pacific Standard Time)
> Do you know what version of irqbalance you're running, or if it's running
> at all?
Eric said he tried both with and without irqbalanced.
^ permalink raw reply
* Re: icmp redirects problem
From: Alex Samad @ 2009-11-24 0:12 UTC (permalink / raw)
To: Jarek Poplawski; +Cc: netdev
In-Reply-To: <4B0B058E.3050906@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1965 bytes --]
On Mon, Nov 23, 2009 at 10:58:38PM +0100, Jarek Poplawski wrote:
> Alex Samad wrote, On 11/23/2009 05:31 AM:
>
[snip]
> >
> > laptop gets its ip from dchp server that make 192.168.11.1 the default
> > gateway and its 192.168.11.1 that sends out the icmp redirect.
>
> Btw, it seems you should fix your routing (by adding sydrt01's eth0
> the second ip or advertising 192.168.11.10 more) to avoid those
> redirects.
sorry I am lost on this statement, I can't add 192.168.11.10 to sydrt01
as it is not physically connected to the 192.168.10.0/24 any more, which
is why I had added the route on sydrt01 and which is why it send
icmp_rediercts.
I have updated the route table on each static machine, but the problem
is on the machines that get their ip via dhcp - I haven't looked at
pushing out route information via dhcp - I am not sure that it would
work in a mixed windows / linux environment.
what do you mean by advertising 192.168.11.10 more ?
>
> >
> > I had a quick look at the kernel tree for 2.6.31 (which is what I am
> > using).
>
> ...
>
> > Line 680
> > secure_redirects - BOOLEAN
> > 681 Accept ICMP redirect messages only for gateways,
> > 682 listed in default gateway list.
> > 683 secure_redirects for the interface will be enabled if at
> > least one of
> > 684 conf/{all,interface}/secure_redirects is set to TRUE,
> > 685 it will be disabled otherwise
> > 686 default TRUE
>
> Very helpful links. So, as you wrote "the documentation seems to suggest"
> something, and IMHO even if it doesn't, it's needlessly too concise
> considering your "lost time", and I'd suggest you sending a patch to fix
> this. (It seems it could "touch" shared_media, as well.)
Which is wrong the code or the documentation and which part the test or
the reliance on the shared_media or on the redirects flags
>
> Thanks,
> Jarek P.
>
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ 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