* Re: [PATCH RESEND net] net/mlx4_en: Limit the RFS filter IDs to be < RPS_NO_FILTER
From: Or Gerlitz @ 2012-07-25 15:04 UTC (permalink / raw)
To: Ben Hutchings; +Cc: davem, netdev, oren, Amir Vadai
In-Reply-To: <1343228230.2694.12.camel@bwh-desktop.uk.solarflarecom.com>
On 25/07/2012 17:57, Ben Hutchings wrote:
>
> resending as of typo in my signature... sorry
>
> --signoff is so much easier than typing it every time :-)
I know and I do that on the regular basis, today did that differently
and here's the result...
Or.
>
>
>> drivers/net/ethernet/mellanox/mlx4/en_cq.c | 8 ++------
>> drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 2 +-
>> 2 files changed, 3 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_cq.c b/drivers/net/ethernet/mellanox/mlx4/en_cq.c
>> index aa9c2f6..866829b 100644
>> --- a/drivers/net/ethernet/mellanox/mlx4/en_cq.c
>> +++ b/drivers/net/ethernet/mellanox/mlx4/en_cq.c
>> @@ -77,12 +77,8 @@ int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq,
>> struct mlx4_en_dev *mdev = priv->mdev;
>> int err = 0;
>> char name[25];
>> - struct cpu_rmap *rmap =
>> -#ifdef CONFIG_RFS_ACCEL
>> - priv->dev->rx_cpu_rmap;
>> -#else
>> - NULL;
>> -#endif
>> + struct cpu_rmap *rmap = IS_ENABLED(CONFIG_RFS_ACCEL) ?
>> + priv->dev->rx_cpu_rmap : NULL;
>
> This is a separate change.
OK, will send two patches
>
>
>> cq->dev = mdev->pndev[priv->port];
>> cq->mcq.set_ci_db = cq->wqres.db.db;
>> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
>> index 8864d8b..edd9cb8 100644
>> --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
>> +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
>> @@ -201,7 +201,7 @@ mlx4_en_filter_alloc(struct mlx4_en_priv *priv, int rxq_index, __be32 src_ip,
>>
>> filter->flow_id = flow_id;
>>
>> - filter->id = priv->last_filter_id++;
>> + filter->id = priv->last_filter_id++ % RPS_NO_FILTER;
>
> This should do for now.
thanks
Or.
>
>
> Ideally the filter ID would be based on the index used in hardware. We
> would need to change the API to allow for devices where this cannot be
> determined synchronously, as in this driver. (And the filter ID might
> also need to be wider.)
>
> Ben.
>
>>
>> list_add_tail(&filter->next,&priv->filters);
>> hlist_add_head(&filter->filter_chain,
>
^ permalink raw reply
* [PATCH] ipv4: rt_cache_valid must check expired routes
From: Eric Dumazet @ 2012-07-25 15:11 UTC (permalink / raw)
To: David Miller; +Cc: netdev
From: Eric Dumazet <edumazet@google.com>
commit d2d68ba9fe8 (ipv4: Cache input routes in fib_info nexthops.)
introduced rt_cache_valid() helper. It unfortunately doesn't check if
route is expired before caching it.
I noticed sk_setup_caps() was constantly called on a tcp workload.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
This patch is bringed by an European guy, but its still July after
all ;)
net/ipv4/route.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 6bcb8fc..30e7021 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -444,7 +444,7 @@ static inline int ip_rt_proc_init(void)
}
#endif /* CONFIG_PROC_FS */
-static inline int rt_is_expired(struct rtable *rth)
+static inline bool rt_is_expired(const struct rtable *rth)
{
return rth->rt_genid != rt_genid(dev_net(rth->dst.dev));
}
@@ -1222,9 +1222,11 @@ static void rt_cache_route(struct fib_nh *nh, struct rtable *rt)
}
}
-static bool rt_cache_valid(struct rtable *rt)
+static bool rt_cache_valid(const struct rtable *rt)
{
- return (rt && rt->dst.obsolete == DST_OBSOLETE_FORCE_CHK);
+ return rt &&
+ rt->dst.obsolete == DST_OBSOLETE_FORCE_CHK &&
+ !rt_is_expired(rt);
}
static void rt_set_nexthop(struct rtable *rt, __be32 daddr,
^ permalink raw reply related
* Re: [PATCH RESEND net-next V2] IB/ipoib: break linkage to neighbouring system
From: Or Gerlitz @ 2012-07-25 16:19 UTC (permalink / raw)
To: Roland Dreier; +Cc: David Miller, netdev, eric.dumazet, cl, shlomop
In-Reply-To: <CAG4TOxNrywFPj_91RzkPikPoWP4hwe+2oninuF7zkrBFo6Q3Kg@mail.gmail.com>
On 25/07/2012 10:52, Roland Dreier wrote:
> On Tue, Jul 24, 2012 at 2:00 PM, David Miller<davem@davemloft.net> wrote:
>> Looks good, Roland you got this?
>
> Yes, I'll read it over and pick it up, thanks.
great, lets us know if anything need to be clarified, waiting to hear
from you...
^ permalink raw reply
* broken nat on linus' latest tree.
From: Dave Jones @ 2012-07-25 17:44 UTC (permalink / raw)
To: netdev
I put Linus' latest tree on my firewall, and found that none
of the machines in my house can talk to the net any more.
The setup is pretty basic. eth0 talks to the cable modem,
eth1 talks to lan. ip masq between them.
Running tcpdump, when I run a ping from another machine to the internet,
I see icmp requests arriving on eth1.
I see those requests and their replies going in/out of eth0, but I don't
see the replies being forwarded back to eth1.
(It happens with all traffic, not just icmp).
3.5 works, this is a post-merge regression.
Any ideas ?
Dave
^ permalink raw reply
* [PATCH net-next,2/2] hyperv: Add error handling to rndis_filter_device_add()
From: Haiyang Zhang @ 2012-07-25 18:08 UTC (permalink / raw)
To: davem, netdev; +Cc: haiyangz, kys, olaf, linux-kernel, devel
In-Reply-To: <1343239722-21328-1-git-send-email-haiyangz@microsoft.com>
Reported-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
---
drivers/net/hyperv/rndis_filter.c | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index fbf5394..e5d6146 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -804,18 +804,15 @@ int rndis_filter_device_add(struct hv_device *dev,
/* Send the rndis initialization message */
ret = rndis_filter_init_device(rndis_device);
if (ret != 0) {
- /*
- * TODO: If rndis init failed, we will need to shut down the
- * channel
- */
+ rndis_filter_device_remove(dev);
+ return ret;
}
/* Get the mac address */
ret = rndis_filter_query_device_mac(rndis_device);
if (ret != 0) {
- /*
- * TODO: shutdown rndis device and the channel
- */
+ rndis_filter_device_remove(dev);
+ return ret;
}
memcpy(device_info->mac_adr, rndis_device->hw_mac_adr, ETH_ALEN);
--
1.7.4.1
^ permalink raw reply related
* Re: [PATCH 1/6] ipv4: Delete routing cache.
From: Ben Greear @ 2012-07-25 18:02 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20120712.104253.1298961759089179385.davem@davemloft.net>
I just ran a quick test on yesterday's net-next, and our
virtual-router logic appears to work fine.
This logic sets up lots of routing rules and routing tables
and basically routes the same packet through multiple
VETH links.
We'll do some more extensive testing, including performance related stuff
when we move to newer upstream kernels with this feature.
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* [PATCH net-next,1/2] hyperv: Add a check for ring_size value
From: Haiyang Zhang @ 2012-07-25 18:08 UTC (permalink / raw)
To: davem, netdev; +Cc: haiyangz, kys, olaf, linux-kernel, devel
It prevents ring_size being set to a too small value.
Reported-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
---
drivers/net/hyperv/netvsc_drv.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 8e23c08..8c5a1c4 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -47,7 +47,7 @@ struct net_device_context {
struct work_struct work;
};
-
+#define RING_SIZE_MIN 64
static int ring_size = 128;
module_param(ring_size, int, S_IRUGO);
MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)");
@@ -518,6 +518,11 @@ static void __exit netvsc_drv_exit(void)
static int __init netvsc_drv_init(void)
{
+ if (ring_size < RING_SIZE_MIN) {
+ ring_size = RING_SIZE_MIN;
+ pr_info("Increased ring_size to %d (min allowed)\n",
+ ring_size);
+ }
return vmbus_driver_register(&netvsc_drv);
}
--
1.7.4.1
^ permalink raw reply related
* [PATCH] igb: correct hardware type (i210/i211) check in igb_loopback_test()
From: Jesper Juhl @ 2012-07-25 19:05 UTC (permalink / raw)
To: linux-kernel
Cc: netdev, e1000-devel, Carolyn Wyborny, Jeff Pieper, Jeff Kirsher,
Rick Jones, John Ronciak, Jesse Brandeburg, Bruce Allan,
Don Skidmore, Greg Rose, Peter P Waskiewicz Jr, Alex Duyck,
David S. Miller
In the original code
...
if ((adapter->hw.mac.type == e1000_i210)
|| (adapter->hw.mac.type == e1000_i210)) {
...
the second check of 'adapter->hw.mac.type' is pointless since it tests
for the exact same value as the first.
After reading through a few other parts of the driver I believe that
the second check was actually intended to check for 'e1000_i211'
rather than 'e1000_i210', but I admit that I'm not certain so someone
with more knowledge about this driver should ACK the patch before it
gets merged.
Unfortunately I have no hardware to actually test this on, so it is
compile tested only.
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
drivers/net/ethernet/intel/igb/igb_ethtool.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index a19c84c..ad489b7 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -1783,7 +1783,7 @@ static int igb_loopback_test(struct igb_adapter *adapter, u64 *data)
goto out;
}
if ((adapter->hw.mac.type == e1000_i210)
- || (adapter->hw.mac.type == e1000_i210)) {
+ || (adapter->hw.mac.type == e1000_i211)) {
dev_err(&adapter->pdev->dev,
"Loopback test not supported "
"on this part at this time.\n");
--
1.7.11.3
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.
^ permalink raw reply related
* Re: [PATCH] igb: correct hardware type (i210/i211) check in igb_loopback_test()
From: Wyborny, Carolyn @ 2012-07-25 19:13 UTC (permalink / raw)
To: Jesper Juhl, linux-kernel@vger.kernel.org
Cc: e1000-devel@lists.sourceforge.net, netdev@vger.kernel.org,
Rick Jones, Allan, Bruce W, Brandeburg, Jesse, Ronciak, John,
David S. Miller
In-Reply-To: <alpine.LNX.2.00.1207252059320.11754@swampdragon.chaosbits.net>
-----Original Message-----
From: Jesper Juhl [mailto:jj@chaosbits.net]
Sent: Wednesday, July 25, 2012 12:06 PM
To: linux-kernel@vger.kernel.org
Cc: netdev@vger.kernel.org; e1000-devel@lists.sourceforge.net; Wyborny, Carolyn; Pieper, Jeffrey E; Kirsher, Jeffrey T; Rick Jones; Ronciak, John; Brandeburg, Jesse; Allan, Bruce W; Skidmore, Donald C; Rose, Gregory V; Waskiewicz Jr, Peter P; Duyck, Alexander H; David S. Miller
Subject: [PATCH] igb: correct hardware type (i210/i211) check in igb_loopback_test()
In the original code
...
if ((adapter->hw.mac.type == e1000_i210)
|| (adapter->hw.mac.type == e1000_i210)) { ...
the second check of 'adapter->hw.mac.type' is pointless since it tests for the exact same value as the first.
After reading through a few other parts of the driver I believe that the second check was actually intended to check for 'e1000_i211'
rather than 'e1000_i210', but I admit that I'm not certain so someone with more knowledge about this driver should ACK the patch before it gets merged.
Unfortunately I have no hardware to actually test this on, so it is compile tested only.
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
drivers/net/ethernet/intel/igb/igb_ethtool.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index a19c84c..ad489b7 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -1783,7 +1783,7 @@ static int igb_loopback_test(struct igb_adapter *adapter, u64 *data)
goto out;
}
if ((adapter->hw.mac.type == e1000_i210)
- || (adapter->hw.mac.type == e1000_i210)) {
+ || (adapter->hw.mac.type == e1000_i211)) {
dev_err(&adapter->pdev->dev,
"Loopback test not supported "
"on this part at this time.\n");
--
1.7.11.3
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.
ACK.
Good catch. Thanks Jesper!
Carolyn
Carolyn Wyborny
Linux Development
LAN Access Division
Intel Corporation
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
^ permalink raw reply related
* [PATCH] igb: don't break user visible strings over multiple lines in igb_ethtool.c
From: Jesper Juhl @ 2012-07-25 19:19 UTC (permalink / raw)
To: linux-kernel
Cc: e1000-devel, netdev, Rick Jones, Bruce Allan, Jesse Brandeburg,
David S. Miller
Even when they go beyond 80 characters, user visible strings should be
on one line to make them easy to grep for.
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
drivers/net/ethernet/intel/igb/igb_ethtool.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
This patch was generated on top of another patch I submitted a few minutes ago:
Subject: [PATCH] igb: correct hardware type (i210/i211) check in igb_loopback_test()
Message-ID: <alpine.LNX.2.00.1207252059320.11754@swampdragon.chaosbits.net>
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index ad489b7..90550f5 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -209,8 +209,8 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
/* When SoL/IDER sessions are active, autoneg/speed/duplex
* cannot be changed */
if (igb_check_reset_block(hw)) {
- dev_err(&adapter->pdev->dev, "Cannot change link "
- "characteristics when SoL/IDER is active.\n");
+ dev_err(&adapter->pdev->dev,
+ "Cannot change link characteristics when SoL/IDER is active.\n");
return -EINVAL;
}
@@ -1089,8 +1089,8 @@ static bool reg_pattern_test(struct igb_adapter *adapter, u64 *data,
wr32(reg, (_test[pat] & write));
val = rd32(reg) & mask;
if (val != (_test[pat] & write & mask)) {
- dev_err(&adapter->pdev->dev, "pattern test reg %04X "
- "failed: got 0x%08X expected 0x%08X\n",
+ dev_err(&adapter->pdev->dev,
+ "pattern test reg %04X failed: got 0x%08X expected 0x%08X\n",
reg, val, (_test[pat] & write & mask));
*data = reg;
return 1;
@@ -1108,8 +1108,8 @@ static bool reg_set_and_check(struct igb_adapter *adapter, u64 *data,
wr32(reg, write & mask);
val = rd32(reg);
if ((write & mask) != (val & mask)) {
- dev_err(&adapter->pdev->dev, "set/check reg %04X test failed:"
- " got 0x%08X expected 0x%08X\n", reg,
+ dev_err(&adapter->pdev->dev,
+ "set/check reg %04X test failed: got 0x%08X expected 0x%08X\n", reg,
(val & mask), (write & mask));
*data = reg;
return 1;
@@ -1171,8 +1171,9 @@ static int igb_reg_test(struct igb_adapter *adapter, u64 *data)
wr32(E1000_STATUS, toggle);
after = rd32(E1000_STATUS) & toggle;
if (value != after) {
- dev_err(&adapter->pdev->dev, "failed STATUS register test "
- "got: 0x%08X expected: 0x%08X\n", after, value);
+ dev_err(&adapter->pdev->dev,
+ "failed STATUS register test got: 0x%08X expected: 0x%08X\n",
+ after, value);
*data = 1;
return 1;
}
@@ -1777,16 +1778,14 @@ static int igb_loopback_test(struct igb_adapter *adapter, u64 *data)
* sessions are active */
if (igb_check_reset_block(&adapter->hw)) {
dev_err(&adapter->pdev->dev,
- "Cannot do PHY loopback test "
- "when SoL/IDER is active.\n");
+ "Cannot do PHY loopback test when SoL/IDER is active.\n");
*data = 0;
goto out;
}
if ((adapter->hw.mac.type == e1000_i210)
|| (adapter->hw.mac.type == e1000_i211)) {
dev_err(&adapter->pdev->dev,
- "Loopback test not supported "
- "on this part at this time.\n");
+ "Loopback test not supported on this part at this time.\n");
*data = 0;
goto out;
}
--
1.7.11.3
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
^ permalink raw reply related
* RE: [PATCH 1/4] pch_gbe: Fix the checksum fill to the error location
From: Andy Cress @ 2012-07-25 20:10 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, Zhong Hongbo
In-Reply-To: <1342510387.2626.174.camel@edumazet-glaptop>
Eric,
For the checksum patch, that needs to be tabled until Hongbo has a chance to evaluate/revise it, but that isn't vital to the goal of avoiding transmit timeouts, so the other 3 patches should still go forward. I'll submit a revised patch set with just those 3.
I tried applying the dont-copy-payload patch you outlined below, and for some reason it won't send successfully with that change. I'm not sure why though. This approach seems sound, and should greatly help transmit performance, if I could figure out what else it needs.
Andy
-----Original Message-----
From: Eric Dumazet [mailto:eric.dumazet@gmail.com]
Sent: Tuesday, July 17, 2012 3:33 AM
To: Andy Cress
Cc: netdev@vger.kernel.org; Zhong Hongbo
Subject: Re: [PATCH 1/4] pch_gbe: Fix the checksum fill to the error location
On Tue, 2012-07-17 at 09:09 +0200, Eric Dumazet wrote:
> Hmm... I fail to understand why you care about NIC doing checksums,
> while pch_gbe_tx_queue() make a _copy_ of each outgoing
> packets.
>
> There _must_ be a way to avoid most of these copies (ie not touching
> payload), only mess with the header to insert these 2 nul bytes ?
>
> /* [Header:14][payload] ---> [Header:14][paddong:2][payload] */
>
> So at device setup : dev->needed_headroom = 2;
>
> and in xmit,
>
> if (skb_headroom(skb) < 2) {
> struct sk_buff *skb_new;
>
> skb_new = skb_realloc_headroom(skb, 2);
> if (!skb_new) { handle error }
> consume_skb(skb);
> skb = skb_new;
> }
> ptr = skb_push(skb, 2);
> memmove(ptr, ptr + 2, ETH_HLEN);
> ptr[ETH_HLEN] = 0;
> ptr[ETH_HLEN + 1] = 0;
>
>
Something like the following (untested) patch
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 55 +++++-----
1 file changed, 29 insertions(+), 26 deletions(-)
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
index b100656..2d3d982 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
@@ -1163,7 +1163,7 @@ static void pch_gbe_tx_queue(struct pch_gbe_adapter *adapter,
struct pch_gbe_hw *hw = &adapter->hw;
struct pch_gbe_tx_desc *tx_desc;
struct pch_gbe_buffer *buffer_info;
- struct sk_buff *tmp_skb;
+ char *ptr;
unsigned int frame_ctrl;
unsigned int ring_num;
@@ -1221,18 +1221,27 @@ static void pch_gbe_tx_queue(struct pch_gbe_adapter *adapter,
buffer_info = &tx_ring->buffer_info[ring_num];
- tmp_skb = buffer_info->skb;
+ if (skb_headroom(skb) < 2) {
+ struct sk_buff *skb_new;
+
+ skb_new = skb_realloc_headroom(skb, 2);
+ if (!skb_new) {
+ tx_ring->next_to_use = ring_num;
+ dev_kfree_skb_any(skb);
+ return;
+ }
+ consume_skb(skb);
+ skb = skb_new;
+ }
/* [Header:14][payload] ---> [Header:14][paddong:2][payload] */
- memcpy(tmp_skb->data, skb->data, ETH_HLEN);
- tmp_skb->data[ETH_HLEN] = 0x00;
- tmp_skb->data[ETH_HLEN + 1] = 0x00;
- tmp_skb->len = skb->len;
- memcpy(&tmp_skb->data[ETH_HLEN + 2], &skb->data[ETH_HLEN],
- (skb->len - ETH_HLEN));
+ ptr = skb_push(skb, 2);
+ memmove(ptr, ptr + 2, ETH_HLEN);
+ ptr[ETH_HLEN] = 0x00;
+ ptr[ETH_HLEN + 1] = 0x00;
/*-- Set Buffer information --*/
- buffer_info->length = tmp_skb->len;
- buffer_info->dma = dma_map_single(&adapter->pdev->dev, tmp_skb->data,
+ buffer_info->length = skb->len;
+ buffer_info->dma = dma_map_single(&adapter->pdev->dev, skb->data,
buffer_info->length,
DMA_TO_DEVICE);
if (dma_mapping_error(&adapter->pdev->dev, buffer_info->dma)) {
@@ -1240,18 +1249,20 @@ static void pch_gbe_tx_queue(struct pch_gbe_adapter *adapter,
buffer_info->dma = 0;
buffer_info->time_stamp = 0;
tx_ring->next_to_use = ring_num;
+ dev_kfree_skb_any(skb);
return;
}
buffer_info->mapped = true;
buffer_info->time_stamp = jiffies;
+ buffer_info->skb = skb;
/*-- Set Tx descriptor --*/
tx_desc = PCH_GBE_TX_DESC(*tx_ring, ring_num);
- tx_desc->buffer_addr = (buffer_info->dma);
- tx_desc->length = (tmp_skb->len);
- tx_desc->tx_words_eob = ((tmp_skb->len + 3));
+ tx_desc->buffer_addr = buffer_info->dma;
+ tx_desc->length = skb->len;
+ tx_desc->tx_words_eob = skb->len + 3;
tx_desc->tx_frame_ctrl = (frame_ctrl);
- tx_desc->gbec_status = (DSC_INIT16);
+ tx_desc->gbec_status = DSC_INIT16;
if (unlikely(++ring_num == tx_ring->count))
ring_num = 0;
@@ -1265,7 +1276,6 @@ static void pch_gbe_tx_queue(struct pch_gbe_adapter *adapter,
pch_tx_timestamp(adapter, skb);
#endif
- dev_kfree_skb_any(skb);
}
/**
@@ -1543,19 +1553,12 @@ static void pch_gbe_alloc_tx_buffers(struct pch_gbe_adapter *adapter,
struct pch_gbe_tx_ring *tx_ring)
{
struct pch_gbe_buffer *buffer_info;
- struct sk_buff *skb;
unsigned int i;
- unsigned int bufsz;
struct pch_gbe_tx_desc *tx_desc;
- bufsz =
- adapter->hw.mac.max_frame_size + PCH_GBE_DMA_ALIGN + NET_IP_ALIGN;
-
for (i = 0; i < tx_ring->count; i++) {
buffer_info = &tx_ring->buffer_info[i];
- skb = netdev_alloc_skb(adapter->netdev, bufsz);
- skb_reserve(skb, PCH_GBE_DMA_ALIGN);
- buffer_info->skb = skb;
+ buffer_info->skb = NULL;
tx_desc = PCH_GBE_TX_DESC(*tx_ring, i);
tx_desc->gbec_status = (DSC_INIT16);
}
@@ -1622,9 +1625,9 @@ pch_gbe_clean_tx(struct pch_gbe_adapter *adapter,
buffer_info->length, DMA_TO_DEVICE);
buffer_info->mapped = false;
}
- if (buffer_info->skb) {
- pr_debug("trim buffer_info->skb : %d\n", i);
- skb_trim(buffer_info->skb, 0);
+ if (skb) {
+ dev_kfree_skb_any(skb);
+ buffer_info->skb = NULL;
}
tx_desc->gbec_status = DSC_INIT16;
if (unlikely(++i == tx_ring->count))
^ permalink raw reply related
* [RFC NET-NEXT PATCH 0/6] implement MDI-X set support in Intel drivers
From: Jesse Brandeburg @ 2012-07-25 17:59 UTC (permalink / raw)
To: netdev; +Cc: bhutchings, jesse.brandeburg
This is an update (v2) to the patches sent previously.
This series implements MDI-X set support in the Intel gigabit ethernet
drivers. It specifically allows a user to control the MDI state,
in order for them to work around issues with broken switches.
The only change to this series is updated descriptions and an
addition of reporting the current mdix_ctrl value in the
"get_settings" functions, which allows the new extended reporting
in the ethtool app's MDI-X: line
sent as RFC for now to get feedback while internal testing
completes. (and net-next is closed)
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
---
Bruce W Allan (1):
e1000e: implement 82577/579 MDI setting support
Jesse Brandeburg (5):
igb: update to allow reading/setting MDI state
e1000e: implement MDI/MDI-X control
e1000: configure and read MDI settings
igb: implement 580 MDI setting support
ethtool.h: MDI setting support
drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 39 ++++++++++++++++++++
drivers/net/ethernet/intel/e1000/e1000_main.c | 4 ++
drivers/net/ethernet/intel/e1000e/ethtool.c | 41 ++++++++++++++++++++-
drivers/net/ethernet/intel/e1000e/phy.c | 31 +++++++++++++++-
drivers/net/ethernet/intel/igb/e1000_phy.c | 29 ++++++++++++++-
drivers/net/ethernet/intel/igb/e1000_phy.h | 5 ++-
drivers/net/ethernet/intel/igb/igb_ethtool.c | 42 ++++++++++++++++++++++
drivers/net/ethernet/intel/igb/igb_main.c | 4 ++
include/linux/ethtool.h | 17 ++++++---
9 files changed, 198 insertions(+), 14 deletions(-)
--
Jesse Brandeburg
^ permalink raw reply
* [RFC ETHTOOL PATCH 0/2] implement MDI-X set
From: Jesse Brandeburg @ 2012-07-25 17:52 UTC (permalink / raw)
To: netdev, bhutchings; +Cc: jesse.brandeburg
Some users reported issues connecting to some switches, where
they were unable to get link (see kernel.org bugzilla 11998)
This patch series improves ethtool to support controlling the
MDI/MDI-X state of a link. It also adds support to the "get
settings" function to show if the MDI state was forced or not.
This is currently RFC because internal testing was not completed
but I am sending the patch to make sure the design is good.
Special thanks to Ben Hutchings for his input to this series.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
---
Jesse Brandeburg (2):
ethtool: allow setting MDI-X state
ethtool.h: implement new MDI-X set defines
ethtool-copy.h | 17 +++++++++++------
ethtool.8.in | 8 ++++++++
ethtool.c | 48 +++++++++++++++++++++++++++++++++++++++++++++---
3 files changed, 64 insertions(+), 9 deletions(-)
--
Jesse Brandeburg
^ permalink raw reply
* [RFC ETHTOOL PATCH 1/2] ethtool.h: implement new MDI-X set defines
From: Jesse Brandeburg @ 2012-07-25 17:53 UTC (permalink / raw)
To: netdev, bhutchings; +Cc: jesse.brandeburg
In-Reply-To: <20120725174351.9839.132.stgit@jbrandeb-snb.jf.intel.com>
These changes implement the kernel side of the interface
for allowing drivers to set MDI-X state on twisted pair.
Changes implemented as suggested by Ben Hutchings, thanks Ben!
see ethtool patches titled:
ethtool: allow setting MDI-X state
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
CC: Ben Hutchings <bhutchings@solarflare.com>
---
ethtool-copy.h | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/ethtool-copy.h b/ethtool-copy.h
index 9e26a76..1e2673e 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -42,8 +42,10 @@ struct ethtool_cmd {
* bits) in Mbps. Please use
* ethtool_cmd_speed()/_set() to
* access it */
- __u8 eth_tp_mdix;
- __u8 reserved2;
+ __u8 eth_tp_mdix; /* twisted pair MDI-X status */
+ __u8 eth_tp_mdix_ctrl; /* twisted pair MDI-X control, when set,
+ * link should be renegotiated if necessary
+ */
__u32 lp_advertising; /* Features the link partner advertises */
__u32 reserved[2];
};
@@ -945,10 +947,13 @@ enum ethtool_sfeatures_retval_bits {
#define AUTONEG_DISABLE 0x00
#define AUTONEG_ENABLE 0x01
-/* Mode MDI or MDI-X */
-#define ETH_TP_MDI_INVALID 0x00
-#define ETH_TP_MDI 0x01
-#define ETH_TP_MDI_X 0x02
+/* MDI or MDI-X status/control - if MDI/MDI_X/AUTO is set then
+ * the driver is required to renegotiate link
+ */
+#define ETH_TP_MDI_INVALID 0x00 /* status: unknown; control: unsupported */
+#define ETH_TP_MDI 0x01 /* status: MDI; control: force MDI */
+#define ETH_TP_MDI_X 0x02 /* status: MDI-X; control: force MDI-X */
+#define ETH_TP_MDI_AUTO 0x03 /* control: auto-select */
/* Wake-On-Lan options. */
#define WAKE_PHY (1 << 0)
^ permalink raw reply related
* [RFC NET-NEXT PATCH 5/6] e1000e: implement MDI/MDI-X control
From: Jesse Brandeburg @ 2012-07-25 18:00 UTC (permalink / raw)
To: netdev; +Cc: bhutchings, jesse.brandeburg
In-Reply-To: <20120725175430.9995.11370.stgit@jbrandeb-snb.jf.intel.com>
some users report issues with link failing when connected to certain
switches. This gives the user the ability to control the MDI state
from the driver, allowing users to work around some improperly
behaving switches.
forcing in this driver is for now only allowed when auto-neg is
enabled.
This is in regards to the related ethtool app patch and
bugzilla.kernel.org bug 11998
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
CC: bruce.w.allan@intel.com
CC: n.poppelier@xs4all.nl
CC: bastien@durel.org
CC: jsveiga@it.eng.br
---
drivers/net/ethernet/intel/e1000e/ethtool.c | 41 ++++++++++++++++++++++++++-
1 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/e1000e/ethtool.c b/drivers/net/ethernet/intel/e1000e/ethtool.c
index 0349e24..2e76f06 100644
--- a/drivers/net/ethernet/intel/e1000e/ethtool.c
+++ b/drivers/net/ethernet/intel/e1000e/ethtool.c
@@ -199,6 +199,11 @@ static int e1000_get_settings(struct net_device *netdev,
else
ecmd->eth_tp_mdix = ETH_TP_MDI_INVALID;
+ if (hw->phy.mdix == AUTO_ALL_MODES)
+ ecmd->eth_tp_mdix_ctrl = ETH_TP_MDI_AUTO;
+ else
+ ecmd->eth_tp_mdix_ctrl = hw->phy.mdix;
+
return 0;
}
@@ -241,6 +246,10 @@ static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u32 spd, u8 dplx)
default:
goto err_inval;
}
+
+ /* clear MDI, MDI(-X) override is only allowed when autoneg enabled */
+ adapter->hw.phy.mdix = AUTO_ALL_MODES;
+
return 0;
err_inval:
@@ -264,6 +273,22 @@ static int e1000_set_settings(struct net_device *netdev,
return -EINVAL;
}
+ /*
+ * MDI setting is only allowed when autoneg enabled because
+ * some hardware doesn't allow MDI setting when speed or
+ * duplex is forced.
+ */
+ if (ecmd->eth_tp_mdix_ctrl) {
+ if (hw->phy.media_type != e1000_media_type_copper)
+ return -EOPNOTSUPP;
+
+ if ((ecmd->eth_tp_mdix_ctrl != ETH_TP_MDI_AUTO) &&
+ (ecmd->autoneg != AUTONEG_ENABLE)) {
+ e_err("forcing MDI/MDI-X state is not supported when link speed and/or duplex are forced\n");
+ return -EINVAL;
+ }
+ }
+
while (test_and_set_bit(__E1000_RESETTING, &adapter->state))
usleep_range(1000, 2000);
@@ -282,20 +307,32 @@ static int e1000_set_settings(struct net_device *netdev,
hw->fc.requested_mode = e1000_fc_default;
} else {
u32 speed = ethtool_cmd_speed(ecmd);
+ /* calling this overrides forced MDI setting */
if (e1000_set_spd_dplx(adapter, speed, ecmd->duplex)) {
clear_bit(__E1000_RESETTING, &adapter->state);
return -EINVAL;
}
}
+ /* MDI-X => 2; MDI => 1; Auto => 3 */
+ if (ecmd->eth_tp_mdix_ctrl) {
+ /*
+ * fix up the value for auto (3 => 0) as zero is mapped
+ * internally to auto
+ */
+ if (ecmd->eth_tp_mdix_ctrl == ETH_TP_MDI_AUTO)
+ hw->phy.mdix = AUTO_ALL_MODES;
+ else
+ hw->phy.mdix = ecmd->eth_tp_mdix_ctrl;
+ }
+
/* reset the link */
if (netif_running(adapter->netdev)) {
e1000e_down(adapter);
e1000e_up(adapter);
- } else {
+ } else
e1000e_reset(adapter);
- }
clear_bit(__E1000_RESETTING, &adapter->state);
return 0;
^ permalink raw reply related
* [RFC NET-NEXT PATCH 1/6] ethtool.h: MDI setting support
From: Jesse Brandeburg @ 2012-07-25 18:00 UTC (permalink / raw)
To: netdev; +Cc: bhutchings, jesse.brandeburg
In-Reply-To: <20120725175430.9995.11370.stgit@jbrandeb-snb.jf.intel.com>
This change modifies the core ethtool struct to allow a driver to
support setting of MDI/MDI-X state for twisted pair wiring. This
change uses a previously reserved u8 and should not change any
binary compatibility of ethtool.
Also as per Ben Hutchings' suggestion, the capabilities are
stored in a separate byte so the driver can report if it supports
changing settings.
see thread: http://kerneltrap.org/mailarchive/linux-netdev/2010/11/17/6289820/thread
see ethtool patches titled:
ethtool: allow setting MDI-X state
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
CC: Ben Hutchings <bhutchings@solarflare.com>
---
include/linux/ethtool.h | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 21eff41..fcb4f8e 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -45,8 +45,10 @@ struct ethtool_cmd {
* bits) in Mbps. Please use
* ethtool_cmd_speed()/_set() to
* access it */
- __u8 eth_tp_mdix;
- __u8 reserved2;
+ __u8 eth_tp_mdix; /* twisted pair MDI-X status */
+ __u8 eth_tp_mdix_ctrl; /* twisted pair MDI-X control, when set,
+ * link should be renegotiated if necessary
+ */
__u32 lp_advertising; /* Features the link partner advertises */
__u32 reserved[2];
};
@@ -1229,10 +1231,13 @@ struct ethtool_ops {
#define AUTONEG_DISABLE 0x00
#define AUTONEG_ENABLE 0x01
-/* Mode MDI or MDI-X */
-#define ETH_TP_MDI_INVALID 0x00
-#define ETH_TP_MDI 0x01
-#define ETH_TP_MDI_X 0x02
+/* MDI or MDI-X status/control - if MDI/MDI_X/AUTO is set then
+ * the driver is required to renegotiate link
+ */
+#define ETH_TP_MDI_INVALID 0x00 /* status: unknown; control: unsupported */
+#define ETH_TP_MDI 0x01 /* status: MDI; control: force MDI */
+#define ETH_TP_MDI_X 0x02 /* status: MDI-X; control: force MDI-X */
+#define ETH_TP_MDI_AUTO 0x03 /* control: auto-select */
/* Wake-On-Lan options. */
#define WAKE_PHY (1 << 0)
^ permalink raw reply related
* [RFC NET-NEXT PATCH 2/6] e1000e: implement 82577/579 MDI setting support
From: Jesse Brandeburg @ 2012-07-25 18:00 UTC (permalink / raw)
To: netdev; +Cc: bhutchings, jesse.brandeburg
In-Reply-To: <20120725175430.9995.11370.stgit@jbrandeb-snb.jf.intel.com>
From: Bruce W Allan <bruce.w.allan@intel.com>
in order for e1000e to support MDI setting support via
ethtool this code is needed to allow setting the MDI state
via software.
This is in regards to the related ethtool patch and
fixes bugzilla.kernel.org bug 11998
Signed-off-by: Bruce W Allan <bruce.w.allan@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
---
drivers/net/ethernet/intel/e1000e/phy.c | 31 +++++++++++++++++++++++++++++--
1 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/e1000e/phy.c b/drivers/net/ethernet/intel/e1000e/phy.c
index b860d4f..fc62a3f 100644
--- a/drivers/net/ethernet/intel/e1000e/phy.c
+++ b/drivers/net/ethernet/intel/e1000e/phy.c
@@ -84,8 +84,9 @@ static const u16 e1000_igp_2_cable_length_table[] = {
#define I82577_PHY_STATUS2_SPEED_1000MBPS 0x0200
/* I82577 PHY Control 2 */
-#define I82577_PHY_CTRL2_AUTO_MDIX 0x0400
-#define I82577_PHY_CTRL2_FORCE_MDI_MDIX 0x0200
+#define I82577_PHY_CTRL2_MANUAL_MDIX 0x0200
+#define I82577_PHY_CTRL2_AUTO_MDI_MDIX 0x0400
+#define I82577_PHY_CTRL2_MDIX_CFG_MASK 0x0600
/* I82577 PHY Diagnostics Status */
#define I82577_DSTATUS_CABLE_LENGTH 0x03FC
@@ -702,6 +703,32 @@ s32 e1000_copper_link_setup_82577(struct e1000_hw *hw)
if (ret_val)
return ret_val;
+ /* Set MDI/MDIX mode */
+ ret_val = e1e_rphy(hw, I82577_PHY_CTRL_2, &phy_data);
+ if (ret_val)
+ return ret_val;
+ phy_data &= ~I82577_PHY_CTRL2_MDIX_CFG_MASK;
+ /*
+ * Options:
+ * 0 - Auto (default)
+ * 1 - MDI mode
+ * 2 - MDI-X mode
+ */
+ switch (hw->phy.mdix) {
+ case 1:
+ break;
+ case 2:
+ phy_data |= I82577_PHY_CTRL2_MANUAL_MDIX;
+ break;
+ case 0:
+ default:
+ phy_data |= I82577_PHY_CTRL2_AUTO_MDI_MDIX;
+ break;
+ }
+ ret_val = e1e_wphy(hw, I82577_PHY_CTRL_2, phy_data);
+ if (ret_val)
+ return ret_val;
+
return e1000_set_master_slave_mode(hw);
}
^ permalink raw reply related
* [RFC NET-NEXT PATCH 3/6] igb: implement 580 MDI setting support
From: Jesse Brandeburg @ 2012-07-25 18:00 UTC (permalink / raw)
To: netdev; +Cc: bhutchings, jesse.brandeburg
In-Reply-To: <20120725175430.9995.11370.stgit@jbrandeb-snb.jf.intel.com>
in order for igb to support MDI setting support via
ethtool this code is needed to allow setting the MDI state
via software.
This is in regards to the related ethtool patch
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
---
drivers/net/ethernet/intel/igb/e1000_phy.c | 29 ++++++++++++++++++++++++++--
drivers/net/ethernet/intel/igb/e1000_phy.h | 5 +++--
2 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.c b/drivers/net/ethernet/intel/igb/e1000_phy.c
index 7be98b6..3404bc7 100644
--- a/drivers/net/ethernet/intel/igb/e1000_phy.c
+++ b/drivers/net/ethernet/intel/igb/e1000_phy.c
@@ -464,6 +464,32 @@ s32 igb_copper_link_setup_82580(struct e1000_hw *hw)
phy_data |= I82580_CFG_ENABLE_DOWNSHIFT;
ret_val = phy->ops.write_reg(hw, I82580_CFG_REG, phy_data);
+ if (ret_val)
+ goto out;
+
+ /* Set MDI/MDIX mode */
+ ret_val = phy->ops.read_reg(hw, I82580_PHY_CTRL_2, &phy_data);
+ if (ret_val)
+ goto out;
+ phy_data &= ~I82580_PHY_CTRL2_MDIX_CFG_MASK;
+ /*
+ * Options:
+ * 0 - Auto (default)
+ * 1 - MDI mode
+ * 2 - MDI-X mode
+ */
+ switch (hw->phy.mdix) {
+ case 1:
+ break;
+ case 2:
+ phy_data |= I82580_PHY_CTRL2_MANUAL_MDIX;
+ break;
+ case 0:
+ default:
+ phy_data |= I82580_PHY_CTRL2_AUTO_MDI_MDIX;
+ break;
+ }
+ ret_val = hw->phy.ops.write_reg(hw, I82580_PHY_CTRL_2, phy_data);
out:
return ret_val;
@@ -2246,8 +2272,7 @@ s32 igb_phy_force_speed_duplex_82580(struct e1000_hw *hw)
if (ret_val)
goto out;
- phy_data &= ~I82580_PHY_CTRL2_AUTO_MDIX;
- phy_data &= ~I82580_PHY_CTRL2_FORCE_MDI_MDIX;
+ phy_data &= ~I82580_PHY_CTRL2_MDIX_CFG_MASK;
ret_val = phy->ops.write_reg(hw, I82580_PHY_CTRL_2, phy_data);
if (ret_val)
diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.h b/drivers/net/ethernet/intel/igb/e1000_phy.h
index 34e4061..6ac3299 100644
--- a/drivers/net/ethernet/intel/igb/e1000_phy.h
+++ b/drivers/net/ethernet/intel/igb/e1000_phy.h
@@ -111,8 +111,9 @@ s32 igb_check_polarity_m88(struct e1000_hw *hw);
#define I82580_PHY_STATUS2_SPEED_100MBPS 0x0100
/* I82580 PHY Control 2 */
-#define I82580_PHY_CTRL2_AUTO_MDIX 0x0400
-#define I82580_PHY_CTRL2_FORCE_MDI_MDIX 0x0200
+#define I82580_PHY_CTRL2_MANUAL_MDIX 0x0200
+#define I82580_PHY_CTRL2_AUTO_MDI_MDIX 0x0400
+#define I82580_PHY_CTRL2_MDIX_CFG_MASK 0x0600
/* I82580 PHY Diagnostics Status */
#define I82580_DSTATUS_CABLE_LENGTH 0x03FC
^ permalink raw reply related
* [RFC NET-NEXT PATCH 4/6] e1000: configure and read MDI settings
From: Jesse Brandeburg @ 2012-07-25 18:00 UTC (permalink / raw)
To: netdev; +Cc: bhutchings, jesse.brandeburg
In-Reply-To: <20120725175430.9995.11370.stgit@jbrandeb-snb.jf.intel.com>
this is the implementation in e1000 to allow ethtool to force
MDI state, allowing users to work around some improperly
behaving switches.
forcing in this driver is for now only allowed when auto-neg is enabled.
to use must have the matching version of ethtool app that supports
this functionality.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
CC: Tushar Dave <tushar.n.dave@intel.com>
---
drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 39 ++++++++++++++++++++++
drivers/net/ethernet/intel/e1000/e1000_main.c | 4 ++
2 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
index 736a7d9..9089d00 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
@@ -174,6 +174,20 @@ static int e1000_get_settings(struct net_device *netdev,
ecmd->autoneg = ((hw->media_type == e1000_media_type_fiber) ||
hw->autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE;
+
+ /* MDI-X => 1; MDI => 0 */
+ if ((hw->media_type == e1000_media_type_copper) &&
+ netif_carrier_ok(netdev))
+ ecmd->eth_tp_mdix = (!!adapter->phy_info.mdix_mode ?
+ ETH_TP_MDI_X :
+ ETH_TP_MDI);
+ else
+ ecmd->eth_tp_mdix = ETH_TP_MDI_INVALID;
+
+ if (hw->mdix == AUTO_ALL_MODES)
+ ecmd->eth_tp_mdix_ctrl = ETH_TP_MDI_AUTO;
+ else
+ ecmd->eth_tp_mdix_ctrl = hw->mdix;
return 0;
}
@@ -183,6 +197,22 @@ static int e1000_set_settings(struct net_device *netdev,
struct e1000_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw;
+ /*
+ * MDI setting is only allowed when autoneg enabled because
+ * some hardware doesn't allow MDI setting when speed or
+ * duplex is forced.
+ */
+ if (ecmd->eth_tp_mdix_ctrl) {
+ if (hw->media_type != e1000_media_type_copper)
+ return -EOPNOTSUPP;
+
+ if ((ecmd->eth_tp_mdix_ctrl != ETH_TP_MDI_AUTO) &&
+ (ecmd->autoneg != AUTONEG_ENABLE)) {
+ e_err(drv, "forcing MDI/MDI-X state is not supported when link speed and/or duplex are forced\n");
+ return -EINVAL;
+ }
+ }
+
while (test_and_set_bit(__E1000_RESETTING, &adapter->flags))
msleep(1);
@@ -199,12 +229,21 @@ static int e1000_set_settings(struct net_device *netdev,
ecmd->advertising = hw->autoneg_advertised;
} else {
u32 speed = ethtool_cmd_speed(ecmd);
+ /* calling this overrides forced MDI setting */
if (e1000_set_spd_dplx(adapter, speed, ecmd->duplex)) {
clear_bit(__E1000_RESETTING, &adapter->flags);
return -EINVAL;
}
}
+ /* MDI-X => 2; MDI => 1; Auto => 3 */
+ if (ecmd->eth_tp_mdix_ctrl) {
+ if (ecmd->eth_tp_mdix_ctrl == ETH_TP_MDI_AUTO)
+ hw->mdix = AUTO_ALL_MODES;
+ else
+ hw->mdix = ecmd->eth_tp_mdix_ctrl;
+ }
+
/* reset the link */
if (netif_running(adapter->netdev)) {
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index 3bfbb8d..0ae2fcf 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -4939,6 +4939,10 @@ int e1000_set_spd_dplx(struct e1000_adapter *adapter, u32 spd, u8 dplx)
default:
goto err_inval;
}
+
+ /* clear MDI, MDI(-X) override is only allowed when autoneg enabled */
+ hw->mdix = AUTO_ALL_MODES;
+
return 0;
err_inval:
^ permalink raw reply related
* [RFC ETHTOOL PATCH 2/2] ethtool: allow setting MDI-X state
From: Jesse Brandeburg @ 2012-07-25 17:53 UTC (permalink / raw)
To: netdev, bhutchings; +Cc: jesse.brandeburg
In-Reply-To: <20120725174351.9839.132.stgit@jbrandeb-snb.jf.intel.com>
A bit ago ethtool added support for reading MDI-X state, this
patch finishes the implementation, adding the complementary write
command.
Add support to ethtool for controlling the MDI-X (crossover)
state of a network port. Most adapters correctly negotiate
MDI-X, but some ill-behaved switches have trouble and end up
picking the wrong MDI setting, which results in complete loss of
link. Usually this error condition can be observed when multiple
ethtool -r ethX are required before link is achieved.
This patch allows the user to override the normal "auto" setting
and force the crossover state to on or off.
The set will fail if the driver doesn't support the get, as
suggested by Ben Hutchings.
# ./ethtool -s p1p1 mdix off
setting MDI not supported
In addition the do_gset output was changed slightly to report the
value set by the user (when the driver supports the set)
old:
MDI-X: on
new:
MDI-X: on (auto)
or
MDI-X: on (forced)
usage is ethtool -s eth0 mdix [auto|on|off]
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
CC: Ben Hutchings <bhutchings@solarflare.com>
---
ethtool.8.in | 8 ++++++++
ethtool.c | 48 +++++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 53 insertions(+), 3 deletions(-)
diff --git a/ethtool.8.in b/ethtool.8.in
index 523b737..fbfb252 100644
--- a/ethtool.8.in
+++ b/ethtool.8.in
@@ -239,6 +239,7 @@ ethtool \- query or control network driver and hardware settings
.BI speed \ N
.B2 duplex half full
.B4 port tp aui bnc mii fibre
+.B3 mdix auto on off
.B2 autoneg on off
.BN advertise
.BN phyad
@@ -518,6 +519,13 @@ Sets full or half duplex mode.
.A4 port tp aui bnc mii fibre
Selects device port.
.TP
+.A3 mdix auto on off
+Selects MDI-X mode for port. May be used to override the automatic detection
+feature of most adapters. Auto means automatic detection of MDI status, on
+forces MDI-X (crossover) mode, while off means MDI (straight through) mode.
+The driver should guarantee that this command takes effect immediately, and
+if necessary may reset the link to cause the change to take effect.
+.TP
.A2 autoneg on off
Specifies whether autonegotiation should be enabled. Autonegotiation
is enabled by default, but in some network devices may have trouble
diff --git a/ethtool.c b/ethtool.c
index f18f611..7b60895 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -18,6 +18,8 @@
* Rx Network Flow Control configuration support <santwona.behera@sun.com>
* Various features by Ben Hutchings <bhutchings@solarflare.com>;
* Copyright 2009, 2010 Solarflare Communications
+ * MDI-X set support by Jesse Brandeburg <jesse.brandeburg@intel.com>
+ * Copyright 2012 Intel Corporation
*
* TODO:
* * show settings for all devices
@@ -559,13 +561,29 @@ static int dump_ecmd(struct ethtool_cmd *ep)
fprintf(stdout, " MDI-X: ");
switch (ep->eth_tp_mdix) {
case ETH_TP_MDI:
- fprintf(stdout, "off\n");
+ fprintf(stdout, "off");
break;
case ETH_TP_MDI_X:
- fprintf(stdout, "on\n");
+ fprintf(stdout, "on");
break;
default:
- fprintf(stdout, "Unknown\n");
+ fprintf(stdout, "Unknown");
+ break;
+ }
+ switch (ep->eth_tp_mdix_ctrl) {
+ case ETH_TP_MDI:
+ case ETH_TP_MDI_X:
+ /* forced via sset */
+ fprintf(stdout, " (forced)\n");
+ break;
+ case ETH_TP_MDI_AUTO:
+ /* not forced */
+ fprintf(stdout, " (auto)\n");
+ break;
+ case ETH_TP_MDI_INVALID:
+ default:
+ /* this interface doesn't support gset MDI-X */
+ fprintf(stdout, "\n");
break;
}
}
@@ -1939,6 +1957,7 @@ static int do_sset(struct cmd_context *ctx)
int speed_wanted = -1;
int duplex_wanted = -1;
int port_wanted = -1;
+ int mdix_wanted = -1;
int autoneg_wanted = -1;
int phyad_wanted = -1;
int xcvr_wanted = -1;
@@ -1999,6 +2018,19 @@ static int do_sset(struct cmd_context *ctx)
port_wanted = PORT_FIBRE;
else
exit_bad_args();
+ } else if (!strcmp(argp[i], "mdix")) {
+ gset_changed = 1;
+ i += 1;
+ if (i >= argc)
+ exit_bad_args();
+ if (!strcmp(argp[i], "auto"))
+ mdix_wanted = ETH_TP_MDI_AUTO;
+ else if (!strcmp(argp[i], "on"))
+ mdix_wanted = ETH_TP_MDI_X;
+ else if (!strcmp(argp[i], "off"))
+ mdix_wanted = ETH_TP_MDI;
+ else
+ exit_bad_args();
} else if (!strcmp(argp[i], "autoneg")) {
i += 1;
if (i >= argc)
@@ -2120,6 +2152,13 @@ static int do_sset(struct cmd_context *ctx)
ecmd.duplex = duplex_wanted;
if (port_wanted != -1)
ecmd.port = port_wanted;
+ if (mdix_wanted != -1) {
+ /* check driver supports MDI-X */
+ if (ecmd.eth_tp_mdix_ctrl != ETH_TP_MDI_INVALID)
+ ecmd.eth_tp_mdix_ctrl = mdix_wanted;
+ else
+ fprintf(stderr, "setting MDI not supported\n");
+ }
if (autoneg_wanted != -1)
ecmd.autoneg = autoneg_wanted;
if (phyad_wanted != -1)
@@ -2179,6 +2218,8 @@ static int do_sset(struct cmd_context *ctx)
fprintf(stderr, " not setting phy_address\n");
if (xcvr_wanted != -1)
fprintf(stderr, " not setting transceiver\n");
+ if (mdix_wanted != -1)
+ fprintf(stderr, " not setting mdix\n");
}
}
@@ -3285,6 +3326,7 @@ static const struct option {
" [ speed %d ]\n"
" [ duplex half|full ]\n"
" [ port tp|aui|bnc|mii|fibre ]\n"
+ " [ mdix auto|on|off ]\n"
" [ autoneg on|off ]\n"
" [ advertise %x ]\n"
" [ phyad %d ]\n"
^ permalink raw reply related
* [RFC NET-NEXT PATCH 6/6] igb: update to allow reading/setting MDI state
From: Jesse Brandeburg @ 2012-07-25 18:00 UTC (permalink / raw)
To: netdev; +Cc: bhutchings, jesse.brandeburg
In-Reply-To: <20120725175430.9995.11370.stgit@jbrandeb-snb.jf.intel.com>
This is the implementation for igb to allow forcing MDI state
via ethtool, allowing users to work around some improperly
behaving switches.
forcing in this driver is for now only allowed when auto-neg is
enabled.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
CC: Carolyn Wyborny <carolyn.wyborny@intel.com>
---
drivers/net/ethernet/intel/igb/igb_ethtool.c | 42 ++++++++++++++++++++++++++
drivers/net/ethernet/intel/igb/igb_main.c | 4 ++
2 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index a19c84c..cf0e9fb 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -198,6 +198,19 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
}
ecmd->autoneg = hw->mac.autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE;
+
+ /* MDI-X => 2; MDI =>1; Invalid =>0 */
+ if (hw->phy.media_type == e1000_media_type_copper)
+ ecmd->eth_tp_mdix = hw->phy.is_mdix ? ETH_TP_MDI_X :
+ ETH_TP_MDI;
+ else
+ ecmd->eth_tp_mdix = ETH_TP_MDI_INVALID;
+
+ if (hw->phy.mdix == AUTO_ALL_MODES)
+ ecmd->eth_tp_mdix_ctrl = ETH_TP_MDI_AUTO;
+ else
+ ecmd->eth_tp_mdix_ctrl = hw->phy.mdix;
+
return 0;
}
@@ -214,6 +227,22 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
return -EINVAL;
}
+ /*
+ * MDI setting is only allowed when autoneg enabled because
+ * some hardware doesn't allow MDI setting when speed or
+ * duplex is forced.
+ */
+ if (ecmd->eth_tp_mdix_ctrl) {
+ if (hw->phy.media_type != e1000_media_type_copper)
+ return -EOPNOTSUPP;
+
+ if ((ecmd->eth_tp_mdix_ctrl != ETH_TP_MDI_AUTO) &&
+ (ecmd->autoneg != AUTONEG_ENABLE)) {
+ dev_err(&adapter->pdev->dev, "forcing MDI/MDI-X state is not supported when link speed and/or duplex are forced\n");
+ return -EINVAL;
+ }
+ }
+
while (test_and_set_bit(__IGB_RESETTING, &adapter->state))
msleep(1);
@@ -227,12 +256,25 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
hw->fc.requested_mode = e1000_fc_default;
} else {
u32 speed = ethtool_cmd_speed(ecmd);
+ /* calling this overrides forced MDI setting */
if (igb_set_spd_dplx(adapter, speed, ecmd->duplex)) {
clear_bit(__IGB_RESETTING, &adapter->state);
return -EINVAL;
}
}
+ /* MDI-X => 2; MDI => 1; Auto => 3 */
+ if (ecmd->eth_tp_mdix_ctrl) {
+ /*
+ * fix up the value for auto (3 => 0) as zero is mapped
+ * internally to auto
+ */
+ if (ecmd->eth_tp_mdix_ctrl == ETH_TP_MDI_AUTO)
+ hw->phy.mdix = AUTO_ALL_MODES;
+ else
+ hw->phy.mdix = ecmd->eth_tp_mdix_ctrl;
+ }
+
/* reset the link */
if (netif_running(adapter->netdev)) {
igb_down(adapter);
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 1050411..447e131 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -6676,6 +6676,10 @@ int igb_set_spd_dplx(struct igb_adapter *adapter, u32 spd, u8 dplx)
default:
goto err_inval;
}
+
+ /* clear MDI, MDI(-X) override is only allowed when autoneg enabled */
+ adapter->hw.phy.mdix = AUTO_ALL_MODES;
+
return 0;
err_inval:
^ permalink raw reply related
* orphan process is causing deadlock in __kernel_vsyscall ()
From: Sri Ram Vemulpali @ 2012-07-25 21:14 UTC (permalink / raw)
To: linux-kernel-mail, linux-newbie, linux-netdev
Hello All,
I am debugging a problem which I do not know how to solve. I know what
is happening, but cannot find solution to it. If anyone has any
suggestions or solution that would be really grateful and I appreciate
it.
Here is the description.
I have a thread which spawns a child process using fork() and in child
context it execv to shell and parent thread waits on waitpid(). This
child process is nothing but a shell /bin/sh, so that from program I
can create shell and run some commands.
In this shell instance, I run tshark for capturing network traffic. I
have really high traffic going, so system is really busy. All is good
so far, but when I send SIGKILL to child process (shell) from another
thread from same application,
child process (shell) gets terminated and tshark is assigned to
init(1) process as orphan. The parent thread which spawned the child
process unblocks from waitpid() after cleaning child instance and
continues it execution.
Here is the problem:
Once the parent thread resumes from waitpid(), it hits fprintf to
print message "exiting from shell" to console. In here the main thread
gets blocked in __kernel_vsyscall () entered from fprintf. Following
is my stack trace from gdb.
But after some more debugging and found that, if I kill from another
shell "tshark" process which is assigned to init(1) as child, the
parent thread unblocks from __kernel_vsyscall ().
Can anyone tell what is going on, is this related to futex spinning
problem where lock is been held by tshark. How would I approach this
problem?
Or is there a way to kill all child process of a process without
making them orphan. Because when a child process is running at the
time parent is exiting, that child process is assigned to init(1) as
orphan process.
Can this behavior be modified. Please let me know any suggestions and
thoughts. Thanks in advance.
--
Regards,
Sri.
(gdb) backtrace
#0 0xffffe424 in __kernel_vsyscall ()
#1 0xb7e6396b in write () from /lib/libc.so.6
#2 0xb7e0c2ef in _IO_new_file_write () from /lib/libc.so.6
#3 0xb7e0bf93 in new_do_write () from /lib/libc.so.6
#4 0xb7e0c296 in _IO_new_do_write () from /lib/libc.so.6
#5 0xb7e0ce20 in _IO_new_file_overflow () from /lib/libc.so.6
#6 0xb7e0c0cd in _IO_new_file_xsputn () from /lib/libc.so.6
#7 0xb7de3634 in vfprintf () from /lib/libc.so.6
#8 0x09ad62a2 in acme_fprintf (stream=0xb7ee2560,
format=0x9f17694 "shell exited. returning to acli\n")
at /home/svemulpali/cc/svemulpali_SCOTTY_main/linux/private/common/src/coutOverride.cpp:42
#9 0x094a9345 in vxShellCmdStartWait (syscmd=0x0)
at /home/svemulpali/cc/svemulpali_SCOTTY_main/linux/private/lib/stub/vxShellLib.cpp:210
^ permalink raw reply
* Re: open sockets preventing unregister_netdevice from completing in linux-next (next-20120724)
From: David Miller @ 2012-07-25 22:17 UTC (permalink / raw)
To: eric.dumazet; +Cc: bjorn, netdev
In-Reply-To: <1343227128.2626.11157.camel@edumazet-glaptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 25 Jul 2012 16:38:48 +0200
> Yes, we miss what was done with rt_cache_flush() : find all cached
> routes and release all dev references...
We can fix this with a two-pronged approach:
1) Walk the FIB info nexthops and invalidate.
2) Entries not cached in the FIB info nexthops go into a
per-netns list which is scanned as well.
I'll try to work on this if nobody beats me to it.
^ permalink raw reply
* Re: [PATCH] mlx4: Add support for EEH error recovery
From: David Miller @ 2012-07-25 22:19 UTC (permalink / raw)
To: shlomop
Cc: or.gerlitz, klebers, netdev, jackm, yevgenyp, ogerlitz, cascardo,
brking
In-Reply-To: <5010070B.5040405@mellanox.com>
From: Shlomo Pongartz <shlomop@mellanox.com>
Date: Wed, 25 Jul 2012 17:47:39 +0300
> Acked-by: Shlomo Pongratz <shlomop@mellanox.com
> <mailto:shlomop@mellanox.com>>
This really isn't how an Acked-by: tag should look, there should
simply be a closing ">" at the end of the first line, but it's somehow
been replaced with a newline and that "<mailto:shlomop@mellanox.com>"
URL instead.
I'll fix it up this time, but in the future I will not and your
ACK will simply get lost.
^ permalink raw reply
* Re: [PATCH RESEND net] net/mlx4_en: Limit the RFS filter IDs to be < RPS_NO_FILTER
From: David Miller @ 2012-07-25 22:23 UTC (permalink / raw)
To: ogerlitz; +Cc: bhutchings, netdev, oren, amirv
In-Reply-To: <50100B03.2020205@mellanox.com>
From: Or Gerlitz <ogerlitz@mellanox.com>
Date: Wed, 25 Jul 2012 18:04:35 +0300
> On 25/07/2012 17:57, Ben Hutchings wrote:
>>> @@ -77,12 +77,8 @@ int mlx4_en_activate_cq(struct mlx4_en_priv *priv,
>>> struct mlx4_en_cq *cq,
>>> struct mlx4_en_dev *mdev = priv->mdev;
>>> int err = 0;
>>> char name[25];
>>> - struct cpu_rmap *rmap =
>>> -#ifdef CONFIG_RFS_ACCEL
>>> - priv->dev->rx_cpu_rmap;
>>> -#else
>>> - NULL;
>>> -#endif
>>> + struct cpu_rmap *rmap = IS_ENABLED(CONFIG_RFS_ACCEL) ?
>>> + priv->dev->rx_cpu_rmap : NULL;
>>
>> This is a separate change.
>
> OK, will send two patches
This change breaks the build.
You can't do this check at run-time, because the reason you need to
check CONFIG_RFS_ACCEL is because if that's disabled then the netdev
structure doesn't even have the ->rx_cpu_rmap member.
^ 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