bnxt_en: Support IFF_SUPP_NOFCS feature to transmit without ethernet FCS.
If firmware is capable, set the IFF_SUPP_NOFCS flag to support the sockets option to transmit packets without FCS. This is mainly used for testing. Reviewed-by: Edwin Peer <edwin.peer@broadcom.com Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
7fbf359bb2
commit
dade5e15fa
@ -375,6 +375,7 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
struct pci_dev *pdev = bp->pdev;
|
||||
struct bnxt_tx_ring_info *txr;
|
||||
struct bnxt_sw_tx_bd *tx_buf;
|
||||
__le32 lflags = 0;
|
||||
|
||||
i = skb_get_queue_mapping(skb);
|
||||
if (unlikely(i >= bp->tx_nr_rings)) {
|
||||
@ -416,6 +417,11 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
vlan_tag_flags |= 1 << TX_BD_CFA_META_TPID_SHIFT;
|
||||
}
|
||||
|
||||
if (unlikely(skb->no_fcs)) {
|
||||
lflags |= cpu_to_le32(TX_BD_FLAGS_NO_CRC);
|
||||
goto normal_tx;
|
||||
}
|
||||
|
||||
if (free_size == bp->tx_ring_size && length <= bp->tx_push_thresh) {
|
||||
struct tx_push_buffer *tx_push_buf = txr->tx_push;
|
||||
struct tx_push_bd *tx_push = &tx_push_buf->push_bd;
|
||||
@ -517,7 +523,7 @@ normal_tx:
|
||||
txbd1 = (struct tx_bd_ext *)
|
||||
&txr->tx_desc_ring[TX_RING(prod)][TX_IDX(prod)];
|
||||
|
||||
txbd1->tx_bd_hsize_lflags = 0;
|
||||
txbd1->tx_bd_hsize_lflags = lflags;
|
||||
if (skb_is_gso(skb)) {
|
||||
u32 hdr_len;
|
||||
|
||||
@ -529,14 +535,14 @@ normal_tx:
|
||||
hdr_len = skb_transport_offset(skb) +
|
||||
tcp_hdrlen(skb);
|
||||
|
||||
txbd1->tx_bd_hsize_lflags = cpu_to_le32(TX_BD_FLAGS_LSO |
|
||||
txbd1->tx_bd_hsize_lflags |= cpu_to_le32(TX_BD_FLAGS_LSO |
|
||||
TX_BD_FLAGS_T_IPID |
|
||||
(hdr_len << (TX_BD_HSIZE_SHIFT - 1)));
|
||||
length = skb_shinfo(skb)->gso_size;
|
||||
txbd1->tx_bd_mss = cpu_to_le32(length);
|
||||
length += hdr_len;
|
||||
} else if (skb->ip_summed == CHECKSUM_PARTIAL) {
|
||||
txbd1->tx_bd_hsize_lflags =
|
||||
txbd1->tx_bd_hsize_lflags |=
|
||||
cpu_to_le32(TX_BD_FLAGS_TCP_UDP_CHKSUM);
|
||||
txbd1->tx_bd_mss = 0;
|
||||
}
|
||||
@ -12460,6 +12466,10 @@ static int bnxt_probe_phy(struct bnxt *bp, bool fw_dflt)
|
||||
rc);
|
||||
return rc;
|
||||
}
|
||||
if (bp->phy_flags & BNXT_PHY_FL_NO_FCS)
|
||||
bp->dev->priv_flags |= IFF_SUPP_NOFCS;
|
||||
else
|
||||
bp->dev->priv_flags &= ~IFF_SUPP_NOFCS;
|
||||
if (!fw_dflt)
|
||||
return 0;
|
||||
|
||||
|
@ -2015,6 +2015,7 @@ struct bnxt {
|
||||
#define BNXT_PHY_FL_PORT_STATS_NO_RESET PORT_PHY_QCAPS_RESP_FLAGS_CUMULATIVE_COUNTERS_ON_RESET
|
||||
#define BNXT_PHY_FL_NO_PHY_LPBK PORT_PHY_QCAPS_RESP_FLAGS_LOCAL_LPBK_NOT_SUPPORTED
|
||||
#define BNXT_PHY_FL_FW_MANAGED_LKDN PORT_PHY_QCAPS_RESP_FLAGS_FW_MANAGED_LINK_DOWN
|
||||
#define BNXT_PHY_FL_NO_FCS PORT_PHY_QCAPS_RESP_FLAGS_NO_FCS
|
||||
|
||||
u8 num_tests;
|
||||
struct bnxt_test_info *test_info;
|
||||
|
Loading…
x
Reference in New Issue
Block a user