net: stmmac: Enable CRC clipping bit

When the bit is set the last four bytes of the ethernet
packet type is stripped and dropped before forwarding.

Change-Id: I740a513c90a85e3a390984602fd12539e567fc11
Acked-by: Abhishek Chauhan <abchauha@qti.qualcomm.com>
Signed-off-by: Sunil Paidimarri <hisunil@codeaurora.org>
tirimbino
Sunil Paidimarri 5 years ago
parent f20d9cb7b8
commit 2e860bb6fc
  1. 4
      Documentation/devicetree/bindings/net/stmmac.txt
  2. 1
      drivers/net/ethernet/stmicro/stmmac/common.h
  3. 1
      drivers/net/ethernet/stmicro/stmmac/dwmac4.h
  4. 5
      drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
  5. 1
      drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
  6. 2
      drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
  7. 1
      include/linux/stmmac.h

@ -116,6 +116,10 @@ Optional properties:
- snps,high_credit: max write outstanding req. limit
- snps,low_credit: max read outstanding req. limit
- snps,priority: TX queue priority (Range: 0x0 to 0xF)
- snps,crc_strip: this enables the CRC stripping feature in the hardware and the
last four bytes of the ethernet packet type is stripped and
dropped before forwarding.
Examples:
stmmac_axi_setup: stmmac-axi-config {

@ -600,6 +600,7 @@ struct mac_device_info {
unsigned int pcs;
unsigned int pmt;
unsigned int ps;
unsigned int crc_strip_en;
};
struct stmmac_rx_routing {

@ -148,6 +148,7 @@ enum power_event {
/* MAC config */
#define GMAC_CONFIG_IPC BIT(27)
#define GMAC_CONFIG_2K BIT(22)
#define GMAC_CONFIG_CRC BIT(21)
#define GMAC_CONFIG_ACS BIT(20)
#define GMAC_CONFIG_BE BIT(18)
#define GMAC_CONFIG_JD BIT(17)

@ -35,10 +35,13 @@ static void dwmac4_core_init(struct mac_device_info *hw,
if (mtu > 2000)
value |= GMAC_CONFIG_JE;
if (hw->crc_strip_en)
value |= GMAC_CONFIG_CRC;
if (hw->ps) {
value |= GMAC_CONFIG_TE;
value &= hw->link.speed_mask;
value &= ~(hw->link.speed_mask);
switch (hw->ps) {
case SPEED_1000:
value |= hw->link.speed1000;

@ -2624,6 +2624,7 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
priv->hw->ps = 0;
}
}
priv->hw->crc_strip_en = priv->plat->crc_strip_en;
/* Initialize the MAC Core */
priv->hw->mac->core_init(priv->hw, dev);

@ -391,6 +391,8 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
if (of_property_read_u32(np, "max-speed", &plat->max_speed))
plat->max_speed = -1;
plat->crc_strip_en = of_property_read_bool(np, "snps,crc_strip");
plat->bus_id = of_alias_get_id(np, "ethernet");
if (plat->bus_id < 0)
plat->bus_id = 0;

@ -199,5 +199,6 @@ struct plat_stmmacenet_data {
unsigned int (*get_plat_tx_coal_frames)
(struct sk_buff *skb);
bool early_eth;
bool crc_strip_en;
};
#endif

Loading…
Cancel
Save