From: John Greene <hidden> Date: 2012-12-03 16:21:41
The 8139cp driver has a change_mtu function that has not been
enabled since the dawn of the git repository. However, the
generic eth_change_mtu is not used in its place, so that
invalid MTU values can be set on the interface.
Original patch salvages the broken code for the single case of
setting the MTU while the interface is down, which is safe
and also includes the range check. Now enhanced to support up
or down interface.
v2: fix case where rxbufsz isn't changed in the up state case
Original patch from
http://lkml.indiana.edu/hypermail/linux/kernel/1202.2/00770.html
Testing: has been test on virtual 8139cp setup without issue,
have no access real hardware 8139cp, need testing help.
Signed-off-by: "John Greene" <redacted>
CC: "David S. Miller" <davem@davemloft.net>
---
drivers/net/ethernet/realtek/8139cp.c | 23 ++++-------------------
1 file changed, 4 insertions(+), 19 deletions(-)
@@ -1226,12 +1226,9 @@ static void cp_tx_timeout(struct net_device *dev)spin_unlock_irqrestore(&cp->lock,flags);}-#ifdef BROKENstaticintcp_change_mtu(structnet_device*dev,intnew_mtu){structcp_private*cp=netdev_priv(dev);-intrc;-unsignedlongflags;/* check for invalid MTU, according to hardware limits */if(new_mtu<CP_MIN_MTU||new_mtu>CP_MAX_MTU)
@@ -1244,22 +1241,12 @@ static int cp_change_mtu(struct net_device *dev, int new_mtu)return0;}-spin_lock_irqsave(&cp->lock,flags);--cp_stop_hw(cp);/* stop h/w and free rings */-cp_clean_rings(cp);-+/* network IS up, close it, reset MTU, and come up again. */+cp_close(dev);dev->mtu=new_mtu;-cp_set_rxbufsize(cp);/* set new rx buf size */--rc=cp_init_rings(cp);/* realloc and restart h/w */-cp_start_hw(cp);--spin_unlock_irqrestore(&cp->lock,flags);--returnrc;+cp_set_rxbufsize(cp);+returncp_open(dev);}-#endif /* BROKEN */staticconstcharmii_2_8139_map[8]={BasicModeCtrl,
From: David Miller <davem@davemloft.net> Date: 2012-12-03 18:52:02
From: John Greene <redacted>
Date: Mon, 3 Dec 2012 11:19:33 -0500
The 8139cp driver has a change_mtu function that has not been
enabled since the dawn of the git repository. However, the
generic eth_change_mtu is not used in its place, so that
invalid MTU values can be set on the interface.
Original patch salvages the broken code for the single case of
setting the MTU while the interface is down, which is safe
and also includes the range check. Now enhanced to support up
or down interface.
v2: fix case where rxbufsz isn't changed in the up state case
Original patch from
http://lkml.indiana.edu/hypermail/linux/kernel/1202.2/00770.html
Testing: has been test on virtual 8139cp setup without issue,
have no access real hardware 8139cp, need testing help.
Signed-off-by: "John Greene" <redacted>
I've applied this to net-next, if it triggers any problems we have
some time to work it out before 3.8 is released.
I've applied this to net-next, if it triggers any problems we have
some time to work it out before 3.8 is released.
I have bounced the messages to David Woodhouse since he authored the
last 8139cp changes in net-next and owns the hardware to notice
regressions.
My message of two days ago was wrong : it is not possible for the irq
handler to process a Tx event after the rings have been freed. Things
still look racy wrt netpoll though.
Any objection against the patch below ?
(I did not gotoize the dev == NULL test: it is really unlikely and
should go away).
From: David Woodhouse <dwmw2@infradead.org> Date: 2012-12-04 15:45:08
On Mon, 2012-12-03 at 21:46 +0100, Francois Romieu wrote:
David Miller [off-list ref] :
[...]
quoted
I've applied this to net-next, if it triggers any problems we have
some time to work it out before 3.8 is released.
I have bounced the messages to David Woodhouse since he authored the
last 8139cp changes in net-next and owns the hardware to notice
regressions.
Thanks.
This almost works. The patch itself is fine, but the device can't
receive packets larger than 2266 bytes (ping -s 2238). After that, I get
rx_fifo errors. I think the RX FIFO is only 2KiB on the 8139cp, isn't
it? So after that it's dependent on how fast it can shovel it out across
the PCI bus. Which is "not fast" in this case.
Transmit appears to be fine.
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@intel.com Intel Corporation
From: John Greene <hidden> Date: 2012-12-04 19:04:20
On 12/04/2012 10:44 AM, David Woodhouse wrote:
On Mon, 2012-12-03 at 21:46 +0100, Francois Romieu wrote:
quoted
David Miller [off-list ref] :
[...]
quoted
I've applied this to net-next, if it triggers any problems we have
some time to work it out before 3.8 is released.
I have bounced the messages to David Woodhouse since he authored the
last 8139cp changes in net-next and owns the hardware to notice
regressions.
Thanks.
This almost works. The patch itself is fine, but the device can't
receive packets larger than 2266 bytes (ping -s 2238). After that, I get
rx_fifo errors. I think the RX FIFO is only 2KiB on the 8139cp, isn't
it? So after that it's dependent on how fast it can shovel it out across
the PCI bus. Which is "not fast" in this case.
Transmit appears to be fine.
Checked the datasheet (admittedly old v1.5 12/6/2001): yes FIFOs are 2k
on both Rx and Tx. I need to check this on the emulator again, but it
didn't fail with pings up to nearly 9000 bytes, apparently a difference
of real vs. virtual hardware (perhaps an interesting science experiment
to adjust MTU to what the underlying hardware does, but not today ;)
Still, this does fix reported problem that driver could be set to huge
MTU erroneously, and now rejects really weird values as it should.
Thanks for the test, David.
Anything to add/subtract?
Francois: I noted your follow on patch, find merit in it as well. I
need to digest it more fully and expect it should be a follow up to this
barring any other issues from me: appreciate your help also!
--
John Greene
jogreene@redhat.com
From: John Greene <hidden> Date: 2012-12-05 19:42:04
On 12/03/2012 03:46 PM, Francois Romieu wrote:
quoted hunk
David Miller [off-list ref] :
[...]
quoted
I've applied this to net-next, if it triggers any problems we have
some time to work it out before 3.8 is released.
I have bounced the messages to David Woodhouse since he authored the
last 8139cp changes in net-next and owns the hardware to notice
regressions.
My message of two days ago was wrong : it is not possible for the irq
handler to process a Tx event after the rings have been freed. Things
still look racy wrt netpoll though.
Any objection against the patch below ?
(I did not gotoize the dev == NULL test: it is really unlikely and
should go away).
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
I think this is a good change, interesting it isn't in already or
causing more issues on multi-processor boxes already. (perhaps it is?).
So do you think these patches need to go together? I could make a case
either way.
Is this upstream yet?
--
John Greene
jogreene@redhat.com
From: David Woodhouse <dwmw2@infradead.org> Date: 2012-12-06 01:34:26
On Tue, 2012-12-04 at 14:04 -0500, John Greene wrote:
Still, this does fix reported problem that driver could be set to huge
MTU erroneously, and now rejects really weird values as it should.
Yes, absolutely. As long as the caveat is understood, feel free to add
Tested-by: David Woodhouse <redacted>
I did look through the datasheet to see if there's anything we can do to
improve reception of large packets. We could try to reduce the Rx Fifo
threshold, which we currently set at 512 bytes... but it isn't going to
get us much further on this particular hardware. Might be nice to have
it tunable though.
There's a v1.6 datasheet at http://realtek.info/pdf/rtl8139cp.pdf btw.
--
dwmw2
From: John Greene <hidden> Date: 2012-12-13 19:56:53
On 12/03/2012 03:46 PM, Francois Romieu wrote:
quoted hunk
David Miller [off-list ref] :
[...]
quoted
I've applied this to net-next, if it triggers any problems we have
some time to work it out before 3.8 is released.
I have bounced the messages to David Woodhouse since he authored the
last 8139cp changes in net-next and owns the hardware to notice
regressions.
My message of two days ago was wrong : it is not possible for the irq
handler to process a Tx event after the rings have been freed. Things
still look racy wrt netpoll though.
Any objection against the patch below ?
(I did not gotoize the dev == NULL test: it is really unlikely and
should go away).
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Francois,
Have incorporated this and test it on virtual hardware with on top of
cb64edb6b89491edfdbae52ba7db9a8b8391d339 (my original work now
upstream). I plan to submit your work herein upstream as well, with
attribution to you, if that's ok?
--
John Greene
jogreene@redhat.com
Have incorporated this and test it on virtual hardware with on top of
cb64edb6b89491edfdbae52ba7db9a8b8391d339 (my original work now
upstream). I plan to submit your work herein upstream as well, with
attribution to you, if that's ok?
Sure, go ahead.
I have a nasty 8110s (old netgear) bug to keep me busy.
--
Ueimor