Skip to content

Commit 7b7b9cf

Browse files
jpirkodavem330
authored andcommitted
mlxsw: Strip FCS from incoming packets
FCS of incoming packets is already checked by HW. Just strip it out. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 74ed207 commit 7b7b9cf

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

drivers/net/ethernet/mellanox/mlxsw/pci.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,7 @@ static void mlxsw_pci_cqe_rdq_handle(struct mlxsw_pci *mlxsw_pci,
667667
char *wqe;
668668
struct sk_buff *skb;
669669
struct mlxsw_rx_info rx_info;
670+
u16 byte_count;
670671
int err;
671672

672673
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,
686687
rx_info.sys_port = mlxsw_pci_cqe_system_port_get(cqe);
687688
rx_info.trap_id = mlxsw_pci_cqe_trap_id_get(cqe);
688689

689-
skb_put(skb, mlxsw_pci_cqe_byte_count_get(cqe));
690+
byte_count = mlxsw_pci_cqe_byte_count_get(cqe);
691+
if (mlxsw_pci_cqe_crc_get(cqe))
692+
byte_count -= ETH_FCS_LEN;
693+
skb_put(skb, byte_count);
690694
mlxsw_core_skb_receive(mlxsw_pci->core, skb, &rx_info);
691695

692696
put_new_skb:

drivers/net/ethernet/mellanox/mlxsw/pci.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ MLXSW_ITEM32(pci, cqe, byte_count, 0x04, 0, 14);
155155
*/
156156
MLXSW_ITEM32(pci, cqe, trap_id, 0x08, 0, 8);
157157

158+
/* pci_cqe_crc
159+
* Length include CRC. Indicates the length field includes
160+
* the packet's CRC.
161+
*/
162+
MLXSW_ITEM32(pci, cqe, crc, 0x0C, 8, 1);
163+
158164
/* pci_cqe_e
159165
* CQE with Error.
160166
*/

0 commit comments

Comments
 (0)