netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: David Lamparter <equinox@diac24.net>,
	jeffrey.t.kirsher@intel.com, netdev <netdev@vger.kernel.org>
Subject: Re: e100 + VLANs?
Date: Tue, 11 Oct 2011 13:25:22 +0200	[thread overview]
Message-ID: <CAL4WiiphpyizVaNkvOdJp1+UK53TkGw9RXnC-vzH7fTNpBAAEA@mail.gmail.com> (raw)
In-Reply-To: <4E941198.9000307@msgid.tls.msk.ru>

[-- Attachment #1: Type: text/plain, Size: 1976 bytes --]

> So, is that a hardware limitation?

Its a driver bug

This comes from fact that sizeof(struct rfd) = 16

and VLAN_ETH_FRAME_LEN is 1518

driver mixes VLAN_ETH_FRAME_LEN and 1500+4+sizeof(struct rfd)   (1520, not 1518)

It therefore misses 2 bytes for large frames (VLAN tagged)

Fix is to remove VLAN_ETH_FRAME_LEN references for good...

diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index c1352c6..3287d31 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -435,6 +435,7 @@ struct rfd {
        __le16 actual_size;
        __le16 size;
 };
+#define RFD_BUF_LEN (sizeof(struct rfd) + ETH_DATA_LEN + VLAN_HLEN)

 struct rx {
        struct rx *next, *prev;
@@ -1075,7 +1076,7 @@ static void e100_get_defaults(struct nic *nic)
        /* Template for a freshly allocated RFD */
        nic->blank_rfd.command = 0;
        nic->blank_rfd.rbd = cpu_to_le32(0xFFFFFFFF);
-       nic->blank_rfd.size = cpu_to_le16(VLAN_ETH_FRAME_LEN);
+       nic->blank_rfd.size = cpu_to_le16(RFD_BUF_LEN);

        /* MII setup */
        nic->mii.phy_id_mask = 0x1F;
@@ -1881,7 +1882,6 @@ static inline void e100_start_receiver(struct
nic *nic, struct rx *rx)
        }
 }

-#define RFD_BUF_LEN (sizeof(struct rfd) + VLAN_ETH_FRAME_LEN)
 static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx)
 {
        if (!(rx->skb = netdev_alloc_skb_ip_align(nic->netdev, RFD_BUF_LEN)))
@@ -2058,7 +2058,7 @@ static void e100_rx_clean(struct nic *nic,
unsigned int *work_done,
                pci_dma_sync_single_for_device(nic->pdev,
                        old_before_last_rx->dma_addr, sizeof(struct rfd),
                        PCI_DMA_BIDIRECTIONAL);
-               old_before_last_rfd->size = cpu_to_le16(VLAN_ETH_FRAME_LEN);
+               old_before_last_rfd->size = cpu_to_le16(RFD_BUF_LEN);
                pci_dma_sync_single_for_device(nic->pdev,
                        old_before_last_rx->dma_addr, sizeof(struct rfd),
                        PCI_DMA_BIDIRECTIONAL);

[-- Attachment #2: patch --]
[-- Type: application/octet-stream, Size: 1434 bytes --]

diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index c1352c6..3287d31 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -435,6 +435,7 @@ struct rfd {
 	__le16 actual_size;
 	__le16 size;
 };
+#define RFD_BUF_LEN (sizeof(struct rfd) + ETH_DATA_LEN + VLAN_HLEN)
 
 struct rx {
 	struct rx *next, *prev;
@@ -1075,7 +1076,7 @@ static void e100_get_defaults(struct nic *nic)
 	/* Template for a freshly allocated RFD */
 	nic->blank_rfd.command = 0;
 	nic->blank_rfd.rbd = cpu_to_le32(0xFFFFFFFF);
-	nic->blank_rfd.size = cpu_to_le16(VLAN_ETH_FRAME_LEN);
+	nic->blank_rfd.size = cpu_to_le16(RFD_BUF_LEN);
 
 	/* MII setup */
 	nic->mii.phy_id_mask = 0x1F;
@@ -1881,7 +1882,6 @@ static inline void e100_start_receiver(struct nic *nic, struct rx *rx)
 	}
 }
 
-#define RFD_BUF_LEN (sizeof(struct rfd) + VLAN_ETH_FRAME_LEN)
 static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx)
 {
 	if (!(rx->skb = netdev_alloc_skb_ip_align(nic->netdev, RFD_BUF_LEN)))
@@ -2058,7 +2058,7 @@ static void e100_rx_clean(struct nic *nic, unsigned int *work_done,
 		pci_dma_sync_single_for_device(nic->pdev,
 			old_before_last_rx->dma_addr, sizeof(struct rfd),
 			PCI_DMA_BIDIRECTIONAL);
-		old_before_last_rfd->size = cpu_to_le16(VLAN_ETH_FRAME_LEN);
+		old_before_last_rfd->size = cpu_to_le16(RFD_BUF_LEN);
 		pci_dma_sync_single_for_device(nic->pdev,
 			old_before_last_rx->dma_addr, sizeof(struct rfd),
 			PCI_DMA_BIDIRECTIONAL);

  reply	other threads:[~2011-10-11 11:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-08 10:08 e100 + VLANs? Michael Tokarev
2011-10-08 16:24 ` Eric Dumazet
2011-10-08 18:34   ` Jeff Kirsher
2011-10-10 10:19     ` David Lamparter
2011-10-10 14:57       ` Michael Tokarev
2011-10-10 15:05         ` Eric Dumazet
2011-10-10 15:13           ` David Lamparter
2011-10-10 15:23             ` Eric Dumazet
2011-10-10 15:28               ` David Lamparter
2011-10-10 15:50                 ` Eric Dumazet
2011-10-10 16:51             ` Michael Tokarev
     [not found]             ` <4E932278.8010802@tls.msk.ru>
2011-10-11  9:51               ` Michael Tokarev
2011-10-11 11:25                 ` Eric Dumazet [this message]
2011-10-11 11:59                   ` Michael Tokarev
2011-10-11 12:04                     ` Eric Dumazet
2011-10-11 12:56                       ` Michael Tokarev
2011-10-11 15:29                         ` David Lamparter
2011-10-11 23:38                           ` Jesse Brandeburg
2011-10-13  9:22                             ` Michael Tokarev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAL4WiiphpyizVaNkvOdJp1+UK53TkGw9RXnC-vzH7fTNpBAAEA@mail.gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=equinox@diac24.net \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=mjt@tls.msk.ru \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).