mlxsw: Strip FCS from incoming packets
authorJiri Pirko <jiri@mellanox.com>
Thu, 6 Aug 2015 14:41:55 +0000 (16:41 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 10 Aug 2015 05:54:10 +0000 (22:54 -0700)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/pci.c
drivers/net/ethernet/mellanox/mlxsw/pci.h

index 298ead5b42ca4b588f78a872f46e1a19ea679379..3ec52ea10f83dc5b1a979c1b82b535f3c8156b04 100644 (file)
@@ -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:
index 887af8459149e34be3a7dda26efc0edc141d4b84..1ef9664b451255bdc7c2d08a1fabffe91256c9aa 100644 (file)
@@ -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.
  */