From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, idosch@mellanox.com, eladr@mellanox.com,
ogerlitz@mellanox.com, Jiri Pirko <jiri@mellanox.com>
Subject: [patch net-next 4/7] mlxsw: Strip FCS from incoming packets
Date: Thu, 6 Aug 2015 16:41:55 +0200 [thread overview]
Message-ID: <1438872118-16869-5-git-send-email-jiri@resnulli.us> (raw)
In-Reply-To: <1438872118-16869-1-git-send-email-jiri@resnulli.us>
From: Jiri Pirko <jiri@mellanox.com>
FCS of incoming packets is already checked by HW. Just strip it out.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/pci.c | 6 +++++-
drivers/net/ethernet/mellanox/mlxsw/pci.h | 6 ++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c
index 298ead5..3ec52ea 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/pci.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c
@@ -667,6 +667,7 @@ static void mlxsw_pci_cqe_rdq_handle(struct mlxsw_pci *mlxsw_pci,
char *wqe;
struct sk_buff *skb;
struct mlxsw_rx_info rx_info;
+ u16 byte_count;
int err;
elem_info = mlxsw_pci_queue_elem_info_consumer_get(q);
@@ -686,7 +687,10 @@ static void mlxsw_pci_cqe_rdq_handle(struct mlxsw_pci *mlxsw_pci,
rx_info.sys_port = mlxsw_pci_cqe_system_port_get(cqe);
rx_info.trap_id = mlxsw_pci_cqe_trap_id_get(cqe);
- skb_put(skb, mlxsw_pci_cqe_byte_count_get(cqe));
+ byte_count = mlxsw_pci_cqe_byte_count_get(cqe);
+ if (mlxsw_pci_cqe_crc_get(cqe))
+ byte_count -= ETH_FCS_LEN;
+ skb_put(skb, byte_count);
mlxsw_core_skb_receive(mlxsw_pci->core, skb, &rx_info);
put_new_skb:
diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.h b/drivers/net/ethernet/mellanox/mlxsw/pci.h
index 887af84..1ef9664 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/pci.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/pci.h
@@ -155,6 +155,12 @@ MLXSW_ITEM32(pci, cqe, byte_count, 0x04, 0, 14);
*/
MLXSW_ITEM32(pci, cqe, trap_id, 0x08, 0, 8);
+/* pci_cqe_crc
+ * Length include CRC. Indicates the length field includes
+ * the packet's CRC.
+ */
+MLXSW_ITEM32(pci, cqe, crc, 0x0C, 8, 1);
+
/* pci_cqe_e
* CQE with Error.
*/
--
1.9.3
next prev parent reply other threads:[~2015-08-06 14:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-06 14:41 [patch net-next 0/7] mlxsw: Couple of fixes/adjustments Jiri Pirko
2015-08-06 14:41 ` [patch net-next 1/7] mlxsw: Call free_netdev when removing port Jiri Pirko
2015-08-06 14:41 ` [patch net-next 2/7] mlxsw: Make system port to local port mapping explicit Jiri Pirko
2015-08-06 14:41 ` [patch net-next 3/7] mlxsw: Make pci module dependent on HAS_DMA and HAS_IOMEM Jiri Pirko
2015-08-06 14:41 ` Jiri Pirko [this message]
2015-08-06 14:41 ` [patch net-next 5/7] mlxsw: Simplify mlxsw_sx_port_xmit function Jiri Pirko
2015-08-06 14:41 ` [patch net-next 6/7] mlxsw: Use correct skb length when dumping payload Jiri Pirko
2015-08-06 14:41 ` [patch net-next 7/7] mlxsw: Fix use-after-free bug in mlxsw_sx_port_xmit Jiri Pirko
2015-08-10 5:54 ` [patch net-next 0/7] mlxsw: Couple of fixes/adjustments 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=1438872118-16869-5-git-send-email-jiri@resnulli.us \
--to=jiri@resnulli.us \
--cc=davem@davemloft.net \
--cc=eladr@mellanox.com \
--cc=idosch@mellanox.com \
--cc=jiri@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=ogerlitz@mellanox.com \
/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).