* [PATCH 4/4] pch_gbe: vlan skb len fix
@ 2012-07-16 20:05 Andy Cress
0 siblings, 0 replies; 4+ messages in thread
From: Andy Cress @ 2012-07-16 20:05 UTC (permalink / raw)
To: netdev
Author: Veaceslav Falico <vfalico@redhat.com>
Date: Tue Apr 10 08:14:17 2012 +0200
pch_gbe_xmit_frame skb->len verification was incorrect in vlan case
causing bogus transfer length errors. One correction could be:
offset = skb->protocol == htons(ETH_P_8021Q) ? 0 : 4;
if (unlikely(skb->len > (adapter->hw.mac.max_frame_size - offset)))
However, this verification is not necessary, so remove it.
Merged-by: Andy Cress <andy.cress@us.kontron.com>
Signed-off-by: Andy Cress <andy.cress@us.kontron.com>
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 2ccdca6..5eaac7f 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
@@ -2160,13 +2160,6 @@ static int pch_gbe_xmit_frame(struct sk_buff
*skb, struct net_device *netdev)
struct pch_gbe_tx_ring *tx_ring = adapter->tx_ring;
unsigned long flags;
- if (unlikely(skb->len > (adapter->hw.mac.max_frame_size - 4))) {
- pr_err("Transfer length Error: skb len: %d > max: %d\n",
- skb->len, adapter->hw.mac.max_frame_size);
- dev_kfree_skb_any(skb);
- adapter->stats.tx_length_errors++;
- return NETDEV_TX_OK;
- }
if (!spin_trylock_irqsave(&tx_ring->tx_lock, flags)) {
/* Collision - tell upper layer to requeue */
return NETDEV_TX_LOCKED;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH 4/4] pch_gbe: vlan skb len fix
2012-07-09 20:33 ` Ben Hutchings
@ 2012-07-10 15:25 ` Andy Cress
0 siblings, 0 replies; 4+ messages in thread
From: Andy Cress @ 2012-07-10 15:25 UTC (permalink / raw)
To: Ben Hutchings; +Cc: netdev
That's a good idea. Removing the check is simpler, simpler is better.
Yes, apparently I do need to resubmit with a different email client.
Andy
-----Original Message-----
From: Ben Hutchings [mailto:bhutchings@solarflare.com]
Sent: Monday, July 09, 2012 4:33 PM
To: Andy Cress
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 4/4] pch_gbe: vlan skb len fix
On Mon, 2012-07-09 at 06:30 -0700, Andy Cress wrote:
> Author: Veaceslav Falico <vfalico@redhat.com>
> Date: Tue Apr 10 08:14:17 2012 +0200
>
> pch_gbe: correctly verify skb->len in vlan case
> to avoid bogus transfer length errors.
This check shouldn't be necessary at all. Maybe you should remove it
instead of correcting the check?
Also, these patches are word-wrapped, and would not be applicable in
this form. See Documentation/email-clients.txt.
Ben.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 4/4] pch_gbe: vlan skb len fix
2012-07-09 13:30 Andy Cress
@ 2012-07-09 20:33 ` Ben Hutchings
2012-07-10 15:25 ` Andy Cress
0 siblings, 1 reply; 4+ messages in thread
From: Ben Hutchings @ 2012-07-09 20:33 UTC (permalink / raw)
To: Andy Cress; +Cc: netdev
On Mon, 2012-07-09 at 06:30 -0700, Andy Cress wrote:
> Author: Veaceslav Falico <vfalico@redhat.com>
> Date: Tue Apr 10 08:14:17 2012 +0200
>
> pch_gbe: correctly verify skb->len in vlan case
> to avoid bogus transfer length errors.
This check shouldn't be necessary at all. Maybe you should remove it
instead of correcting the check?
Also, these patches are word-wrapped, and would not be applicable in
this form. See Documentation/email-clients.txt.
Ben.
> Signed-off-by: Andy Cress <andy.cress@us.kontron.com>
>
> 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 30ef285..04b0e49 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
> @@ -2158,8 +2158,10 @@ static int pch_gbe_xmit_frame(struct sk_buff
> *skb, struct net_device *netdev)
> struct pch_gbe_adapter *adapter = netdev_priv(netdev);
> struct pch_gbe_tx_ring *tx_ring = adapter->tx_ring;
> unsigned long flags;
> + int offset;
>
> - if (unlikely(skb->len > (adapter->hw.mac.max_frame_size - 4))) {
> + offset = skb->protocol == htons(ETH_P_8021Q) ? 0 : 4;
> + if (unlikely(skb->len > (adapter->hw.mac.max_frame_size -
> offset))) {
> pr_err("Transfer length Error: skb len: %d > max: %d\n",
> skb->len, adapter->hw.mac.max_frame_size);
> dev_kfree_skb_any(skb);
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 4/4] pch_gbe: vlan skb len fix
@ 2012-07-09 13:30 Andy Cress
2012-07-09 20:33 ` Ben Hutchings
0 siblings, 1 reply; 4+ messages in thread
From: Andy Cress @ 2012-07-09 13:30 UTC (permalink / raw)
To: netdev
Author: Veaceslav Falico <vfalico@redhat.com>
Date: Tue Apr 10 08:14:17 2012 +0200
pch_gbe: correctly verify skb->len in vlan case
to avoid bogus transfer length errors.
Signed-off-by: Andy Cress <andy.cress@us.kontron.com>
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 30ef285..04b0e49 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
@@ -2158,8 +2158,10 @@ static int pch_gbe_xmit_frame(struct sk_buff
*skb, struct net_device *netdev)
struct pch_gbe_adapter *adapter = netdev_priv(netdev);
struct pch_gbe_tx_ring *tx_ring = adapter->tx_ring;
unsigned long flags;
+ int offset;
- if (unlikely(skb->len > (adapter->hw.mac.max_frame_size - 4))) {
+ offset = skb->protocol == htons(ETH_P_8021Q) ? 0 : 4;
+ if (unlikely(skb->len > (adapter->hw.mac.max_frame_size -
offset))) {
pr_err("Transfer length Error: skb len: %d > max: %d\n",
skb->len, adapter->hw.mac.max_frame_size);
dev_kfree_skb_any(skb);
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-07-16 20:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-16 20:05 [PATCH 4/4] pch_gbe: vlan skb len fix Andy Cress
-- strict thread matches above, loose matches on Subject: below --
2012-07-09 13:30 Andy Cress
2012-07-09 20:33 ` Ben Hutchings
2012-07-10 15:25 ` Andy Cress
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).