netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: greearb@candelatech.com
To: netdev@vger.kernel.org
Cc: Ben Greear <greearb@candelatech.com>
Subject: [PATCH v2 06/10] e1000e:  Support sending custom Ethernet CRC.
Date: Wed,  8 Feb 2012 11:54:41 -0800	[thread overview]
Message-ID: <1328730885-10941-7-git-send-email-greearb@candelatech.com> (raw)
In-Reply-To: <1328730885-10941-1-git-send-email-greearb@candelatech.com>

From: Ben Greear <greearb@candelatech.com>

This can aid with testing the RX logic for bad
CRCs.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 e3eefda... 2f9434c... M	drivers/net/ethernet/intel/e1000e/netdev.c
 drivers/net/ethernet/intel/e1000e/netdev.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index e3eefda..2f9434c 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -4618,6 +4618,7 @@ link_up:
 #define E1000_TX_FLAGS_VLAN		0x00000002
 #define E1000_TX_FLAGS_TSO		0x00000004
 #define E1000_TX_FLAGS_IPV4		0x00000008
+#define E1000_TX_FLAGS_NO_FCS		0x00000010
 #define E1000_TX_FLAGS_VLAN_MASK	0xffff0000
 #define E1000_TX_FLAGS_VLAN_SHIFT	16
 
@@ -4877,6 +4878,9 @@ static void e1000_tx_queue(struct e1000_ring *tx_ring, int tx_flags, int count)
 		txd_upper |= (tx_flags & E1000_TX_FLAGS_VLAN_MASK);
 	}
 
+	if (unlikely(tx_flags & E1000_TX_FLAGS_NO_FCS))
+		txd_lower &= ~(E1000_TXD_CMD_IFCS);
+
 	i = tx_ring->next_to_use;
 
 	do {
@@ -4894,6 +4898,10 @@ static void e1000_tx_queue(struct e1000_ring *tx_ring, int tx_flags, int count)
 
 	tx_desc->lower.data |= cpu_to_le32(adapter->txd_cmd);
 
+	/* txd_cmd re-enables FCS, so we'll re-disable it here as desired. */
+	if (unlikely(tx_flags & E1000_TX_FLAGS_NO_FCS))
+		tx_desc->lower.data &= ~(cpu_to_le32(E1000_TXD_CMD_IFCS));
+
 	/*
 	 * Force memory writes to complete before letting h/w
 	 * know there are new descriptors to fetch.  (Only
@@ -5099,6 +5107,9 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
 	if (skb->protocol == htons(ETH_P_IP))
 		tx_flags |= E1000_TX_FLAGS_IPV4;
 
+	if (unlikely(skb->no_fcs))
+		tx_flags |= E1000_TX_FLAGS_NO_FCS;
+
 	/* if count is 0 then mapping error has occurred */
 	count = e1000_tx_map(tx_ring, skb, first, max_per_txd, nr_frags, mss);
 	if (count) {
@@ -6226,6 +6237,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
 	/* Set user-changeable features (subset of all device features) */
 	netdev->hw_features = netdev->features;
 	netdev->hw_features |= NETIF_F_RXFCS;
+	netdev->priv_flags |= IFF_SUPP_NOFCS;
 
 	if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER)
 		netdev->features |= NETIF_F_HW_VLAN_FILTER;
-- 
1.7.3.4

  parent reply	other threads:[~2012-02-08 19:56 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-08 19:54 [PATCH v2 00/10] Low-level Ethernet debugging features greearb
2012-02-08 19:54 ` [PATCH v2 01/10] net: Support RXFCS feature flag greearb
2012-02-08 19:54 ` [PATCH v2 02/10] e100: " greearb
2012-02-10 22:56   ` Michał Mirosław
2012-02-11  0:17     ` Ben Greear
2012-02-08 19:54 ` [PATCH v2 03/10] e1000e: " greearb
2012-02-10 22:46   ` Michał Mirosław
2012-02-10 22:57     ` Ben Greear
2012-02-10 23:09       ` Michał Mirosław
2012-02-11  0:06         ` Ben Greear
2012-02-08 19:54 ` [PATCH v2 04/10] net: Add framework to allow sending packets with customized CRC greearb
2012-02-08 19:54 ` [PATCH v2 05/10] e100: Support sending custom Ethernet CRC greearb
2012-02-08 19:54 ` greearb [this message]
2012-02-08 19:54 ` [PATCH v2 07/10] net: Support RX-ALL feature flag greearb
2012-02-08 19:54 ` [PATCH v2 08/10] e1000e: Support RXALL " greearb
2012-02-08 19:54 ` [PATCH v2 09/10] e100: " greearb
2012-02-08 19:54 ` [PATCH v2 10/10] e1000: Support sending custom Ethernet CRC greearb
2012-02-10  4:31 ` [PATCH v2 00/10] Low-level Ethernet debugging features Jeff Kirsher
2012-02-10  5:42   ` Ben Greear
2012-02-10  5:52     ` Jeff Kirsher
2012-02-10 13:25     ` Eric Dumazet
2012-02-10 13:45       ` David Laight
2012-02-10 13:51         ` Eric Dumazet
2012-02-10 14:09           ` Eric Dumazet
2012-02-10 17:18       ` Ben Greear
2012-02-10 20:43   ` David Miller

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=1328730885-10941-7-git-send-email-greearb@candelatech.com \
    --to=greearb@candelatech.com \
    --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).