From: Piotr Warpechowski Enhance protocol extraction in stmmac_has_ip_ethertype() by introducing MAC offset parameter and changing: __vlan_get_protocol() -> __vlan_get_protocol_offset() Add correct header length for VLAN tags, which enable Generic Receive Offload (GRO) in VLAN. Co-developed-by: Karol Jurczenia Signed-off-by: Karol Jurczenia Reviewed-by: Konrad Leszczynski Reviewed-by: Sebastian Basierski Reviewed-by: Cezary Rojewski Signed-off-by: Piotr Warpechowski --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index fa3d26c28502..4df967500cd3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4566,13 +4566,14 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) */ static bool stmmac_has_ip_ethertype(struct sk_buff *skb) { - int depth = 0; + int depth = 0, hlen; __be16 proto; - proto = __vlan_get_protocol(skb, eth_header_parse_protocol(skb), - &depth); + proto = __vlan_get_protocol_offset(skb, skb->protocol, + skb_mac_offset(skb), &depth); + hlen = eth_type_vlan(skb->protocol) ? VLAN_ETH_HLEN : ETH_HLEN; - return (depth <= ETH_HLEN) && + return (depth <= hlen) && (proto == htons(ETH_P_IP) || proto == htons(ETH_P_IPV6)); } -- 2.34.1 From: Karol Jurczenia Add missing Traffic Control (TC) offload for flower filters matching the IP EtherType (ETH_P_IP). Reviewed-by: Konrad Leszczynski Reviewed-by: Sebastian Basierski Reviewed-by: Cezary Rojewski Signed-off-by: Karol Jurczenia --- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 + .../net/ethernet/stmicro/stmmac/stmmac_tc.c | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 78d6b3737a26..77f900a328aa 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -206,6 +206,7 @@ enum stmmac_rfs_type { STMMAC_RFS_T_VLAN, STMMAC_RFS_T_LLDP, STMMAC_RFS_T_1588, + STMMAC_RFS_T_IP, STMMAC_RFS_T_MAX, }; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c index 694d6ee14381..c5577652d6ed 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -239,6 +239,7 @@ static int tc_rfs_init(struct stmmac_priv *priv) priv->rfs_entries_max[STMMAC_RFS_T_VLAN] = 8; priv->rfs_entries_max[STMMAC_RFS_T_LLDP] = 1; priv->rfs_entries_max[STMMAC_RFS_T_1588] = 1; + priv->rfs_entries_max[STMMAC_RFS_T_IP] = 32; for (i = 0; i < STMMAC_RFS_T_MAX; i++) priv->rfs_entries_total += priv->rfs_entries_max[i]; @@ -777,6 +778,17 @@ static int tc_add_ethtype_flow(struct stmmac_priv *priv, stmmac_rx_queue_routing(priv, priv->hw, PACKET_PTPQ, tc); break; + case ETH_P_IP: + if (priv->rfs_entries_cnt[STMMAC_RFS_T_IP] >= + priv->rfs_entries_max[STMMAC_RFS_T_IP]) + return -ENOENT; + + entry->type = STMMAC_RFS_T_IP; + priv->rfs_entries_cnt[STMMAC_RFS_T_IP]++; + + stmmac_rx_queue_routing(priv, priv->hw, + PACKET_UPQ, tc); + break; default: netdev_err(priv->dev, "EthType(0x%x) is not supported", etype); return -EINVAL; @@ -800,7 +812,7 @@ static int tc_del_ethtype_flow(struct stmmac_priv *priv, if (!entry || !entry->in_use || entry->type < STMMAC_RFS_T_LLDP || - entry->type > STMMAC_RFS_T_1588) + entry->type > STMMAC_RFS_T_IP) return -ENOENT; switch (entry->etype) { @@ -814,6 +826,11 @@ static int tc_del_ethtype_flow(struct stmmac_priv *priv, PACKET_PTPQ, 0); priv->rfs_entries_cnt[STMMAC_RFS_T_1588]--; break; + case ETH_P_IP: + stmmac_rx_queue_routing(priv, priv->hw, + PACKET_UPQ, 0); + priv->rfs_entries_cnt[STMMAC_RFS_T_IP]--; + break; default: netdev_err(priv->dev, "EthType(0x%x) is not supported", entry->etype); -- 2.34.1 From: Piotr Warpechowski It was observed that extended descriptors are not printed out fully and enhanced descriptors are completely omitted in stmmac_rings_status_show(). Correct printing according to documentation and other existing prints in the driver. Reviewed-by: Konrad Leszczynski Reviewed-by: Sebastian Basierski Reviewed-by: Cezary Rojewski Signed-off-by: Piotr Warpechowski --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 4df967500cd3..38f130cb0c9f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -6355,14 +6355,25 @@ static void sysfs_display_ring(void *head, int size, int extend_desc, desc_size = extend_desc ? sizeof(*ep) : sizeof(*p); for (i = 0; i < size; i++) { dma_addr = dma_phy_addr + i * desc_size; - seq_printf(seq, "%d [%pad]: 0x%x 0x%x 0x%x 0x%x\n", - i, &dma_addr, - le32_to_cpu(p->des0), le32_to_cpu(p->des1), - le32_to_cpu(p->des2), le32_to_cpu(p->des3)); - if (extend_desc) - p = &(++ep)->basic; - else + if (extend_desc) { + seq_printf(seq, "%d [%pad]: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", + i, &dma_addr, + le32_to_cpu(ep->basic.des0), + le32_to_cpu(ep->basic.des1), + le32_to_cpu(ep->basic.des2), + le32_to_cpu(ep->basic.des3), + le32_to_cpu(ep->des4), + le32_to_cpu(ep->des5), + le32_to_cpu(ep->des6), + le32_to_cpu(ep->des7)); + ep++; + } else { + seq_printf(seq, "%d [%pad]: 0x%x 0x%x 0x%x 0x%x\n", + i, &dma_addr, + le32_to_cpu(p->des0), le32_to_cpu(p->des1), + le32_to_cpu(p->des2), le32_to_cpu(p->des3)); p++; + } } } @@ -6402,7 +6413,11 @@ static int stmmac_rings_status_show(struct seq_file *seq, void *v) seq_printf(seq, "Extended descriptor ring:\n"); sysfs_display_ring((void *)tx_q->dma_etx, priv->dma_conf.dma_tx_size, 1, seq, tx_q->dma_tx_phy); - } else if (!(tx_q->tbs & STMMAC_TBS_AVAIL)) { + } else if (tx_q->tbs & STMMAC_TBS_AVAIL) { + seq_printf(seq, "Enhanced descriptor ring:\n"); + sysfs_display_ring((void *)tx_q->dma_entx, + priv->dma_conf.dma_tx_size, 1, seq, tx_q->dma_tx_phy); + } else { seq_printf(seq, "Descriptor ring:\n"); sysfs_display_ring((void *)tx_q->dma_tx, priv->dma_conf.dma_tx_size, 0, seq, tx_q->dma_tx_phy); -- 2.34.1