net: stmmac: Misc improvements for XGMAC
Subsystems (4)
PATCH 7/26 net: stmmac: selftests: Add RSS test
In reply to Jose AbreuAdd a test for RSS in the stmmac selftests.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- .../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +19 -0
@@ -700,6 +700,21 @@ static int stmmac_test_flowctrl(struct stmmac_priv *priv)return ret; } +static int stmmac_test_rss (struct stmmac_priv *priv) +{ +struct stmmac_packet_attrs attr = { }; + +if (!priv->dma_cap.rssen || !priv->rss.enable) +return -EOPNOTSUPP ; + + attr.dst = priv->dev->dev_addr; + attr.exp_hash = true; + attr.sport =0x321 ; + attr.dport =0x123 ; + +return __stmmac_test_loopback (priv, &attr); +} +#define STMMAC_LOOPBACK_NONE 0#define STMMAC_LOOPBACK_MAC 1#define STMMAC_LOOPBACK_PHY 2
@@ -745,6 +760,10 @@ static const struct stmmac_test { .name = "Flow Control ", .lb = STMMAC_LOOPBACK_PHY, .fn = stmmac_test_flowctrl, + }, { + .name = "RSS ", + .lb = STMMAC_LOOPBACK_PHY, + .fn = stmmac_test_rss, }, };
Signature · 1 line
2.7.4
PATCH 15/26 net: stmmac: Prepare to add Split Header support
In reply to Jose AbreuIn order to add Split Header support, stmmac_rx() needs to take into account that packet may be split accross multiple descriptors.
Refactor the logic of this function in order to support this scenario.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 6 + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 149 +++++++++++++--------- 2 files changed, 95 insertions(+), 60 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac.h +6 -0
@@ -74,6 +74,12 @@ struct stmmac_rx_queue {u32 rx_zeroc_thresh;dma_addr_t dma_rx_phy;u32 rx_tail_addr; +unsigned int state_saved; +struct { +struct sk_buff *skb; +unsigned int len; +unsigned int error; + } state; };struct stmmac_channel {
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +89 -60
192 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 3/26 net: stmmac: Fix issues when number of Queues >= 4
In reply to Jose AbreuWhen queues >= 4 we use different registers but we were not subtracting the offset of 4. Fix this.
Found out by Coverity.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 4 ++++ drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 4 ++++ 2 files changed, 8 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +4 -0
@@ -85,6 +85,8 @@ static void dwmac4_rx_queue_priority(struct mac_device_info *hw,u32 value; base_register = (queue <4 ) ?GMAC_RXQ_CTRL2 :GMAC_RXQ_CTRL3 ; +if (queue >=4 ) + queue -=4 ; value =readl (ioaddr + base_register);
@@ -102,6 +104,8 @@ static void dwmac4_tx_queue_priority(struct mac_device_info *hw,u32 value; base_register = (queue <4 ) ?GMAC_TXQ_PRTY_MAP0 :GMAC_TXQ_PRTY_MAP1 ; +if (queue >=4 ) + queue -=4 ; value =readl (ioaddr + base_register);
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +4 -0
@@ -108,6 +108,8 @@ static void dwxgmac2_rx_queue_prio(struct mac_device_info *hw, u32 prio,u32 value, reg; reg = (queue <4 ) ?XGMAC_RXQ_CTRL2 :XGMAC_RXQ_CTRL3 ; +if (queue >=4 ) + queue -=4 ; value =readl (ioaddr + reg); value &= ~XGMAC_PSRQ (queue);
@@ -171,6 +173,8 @@ static void dwxgmac2_map_mtl_to_dma(struct mac_device_info *hw, u32 queue,u32 value, reg; reg = (queue <4 ) ?XGMAC_MTL_RXQ_DMA_MAP0 :XGMAC_MTL_RXQ_DMA_MAP1 ; +if (queue >=4 ) + queue -=4 ; value =readl (ioaddr + reg); value &= ~XGMAC_QxMDMACH (queue);
Signature · 1 line
2.7.4
PATCH 26/26 net: stmmac: selftests: Return proper error code to userspace
In reply to Jose AbreuWe can do better than just return 1 to userspace. Lets return a proper Linux error code.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- .../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +11 -11
@@ -316,7 +316,7 @@ static int __stmmac_test_loopback(struct stmmac_priv *priv, attr->timeout =STMMAC_LB_TIMEOUT ;wait_for_completion_timeout (&tpriv->comp, attr->timeout); - ret = !tpriv->ok; + ret = tpriv->ok ?0 : -ETIMEDOUT ; cleanup:dev_remove_pack (&tpriv->pt);
@@ -477,7 +477,7 @@ static int stmmac_test_hfilt(struct stmmac_priv *priv)/* Shall NOT receive packet */ ret =__stmmac_test_loopback (priv, &attr); - ret = !ret; + ret = ret ?0 : -EINVAL ; cleanup:dev_mc_del (priv->dev, gd_addr);
@@ -509,7 +509,7 @@ static int stmmac_test_pfilt(struct stmmac_priv *priv)/* Shall NOT receive packet */ ret =__stmmac_test_loopback (priv, &attr); - ret = !ret; + ret = ret ?0 : -EINVAL ; cleanup:dev_uc_del (priv->dev, gd_addr);
@@ -559,7 +559,7 @@ static int stmmac_test_mcfilt(struct stmmac_priv *priv)/* Shall NOT receive packet */ ret =__stmmac_test_loopback (priv, &attr); - ret = !ret; + ret = ret ?0 : -EINVAL ; cleanup:dev_uc_del (priv->dev, uc_addr);
@@ -597,7 +597,7 @@ static int stmmac_test_ucfilt(struct stmmac_priv *priv)/* Shall NOT receive packet */ ret =__stmmac_test_loopback (priv, &attr); - ret = !ret; + ret = ret ?0 : -EINVAL ; cleanup:dev_mc_del (priv->dev, mc_addr);
@@ -696,7 +696,7 @@ static int stmmac_test_flowctrl(struct stmmac_priv *priv) }wait_for_completion_timeout (&tpriv->comp,STMMAC_LB_TIMEOUT ); - ret = !tpriv->ok; + ret = tpriv->ok ?0 : -ETIMEDOUT ; cleanup:dev_mc_del (priv->dev, paddr);
@@ -830,11 +830,11 @@ static int stmmac_test_vlanfilt(struct stmmac_priv *priv) goto vlan_del;wait_for_completion_timeout (&tpriv->comp,STMMAC_LB_TIMEOUT ); - ret = !tpriv->ok; + ret = tpriv->ok ?0 : -ETIMEDOUT ;if (ret && !i) { goto vlan_del; }else if (!ret && i) { - ret =-1 ; + ret = -EINVAL ; goto vlan_del; }else { ret =0 ;
@@ -906,11 +906,11 @@ static int stmmac_test_dvlanfilt(struct stmmac_priv *priv) goto vlan_del;wait_for_completion_timeout (&tpriv->comp,STMMAC_LB_TIMEOUT ); - ret = !tpriv->ok; + ret = tpriv->ok ?0 : -ETIMEDOUT ;if (ret && !i) { goto vlan_del; }else if (!ret && i) { - ret =-1 ; + ret = -EINVAL ; goto vlan_del; }else { ret =0 ;
@@ -995,7 +995,7 @@ static int stmmac_test_rxp(struct stmmac_priv *priv) attr.src = addr; ret =__stmmac_test_loopback (priv, &attr); - ret = !ret;/* Shall NOT receive packet */ + ret = ret ?0 : -EINVAL ;/* Shall NOT receive packet */ cls_u32.command =TC_CLSU32_DELETE_KNODE ;stmmac_tc_setup_cls_u32 (priv, priv, &cls_u32);
Signature · 1 line
2.7.4
PATCH 5/26 net: stmmac: xgmac: Implement tx_queue_prio()
In reply to Jose AbreuImplement the TX Queue Priority callback in XGMAC core.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 4 ++++ drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +4 -0
@@ -127,6 +127,10 @@#define XGMAC_MTL_RXQ_DMA_MAP1 0x00001034#define XGMAC_QxMDMACH (x) GENMASK((x) * 8 + 3, (x) * 8)#define XGMAC_QxMDMACH_SHIFT (x) ((x) * 8) +#define XGMAC_TC_PRTY_MAP0 0x00001040 +#define XGMAC_TC_PRTY_MAP1 0x00001044 +#define XGMAC_PSTC (x) GENMASK((x) * 8 + 7, (x) * 8) +#define XGMAC_PSTC_SHIFT (x) ((x) * 8)#define XGMAC_MTL_TXQ_OPMODE (x) (0x00001100 + (0x80 * (x)))#define XGMAC_TQS GENMASK(25, 16)#define XGMAC_TQS_SHIFT 16
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +18 -1
@@ -118,6 +118,23 @@ static void dwxgmac2_rx_queue_prio(struct mac_device_info *hw, u32 prio,writel (value, ioaddr + reg); } +static void dwxgmac2_tx_queue_prio (struct mac_device_info *hw,u32 prio, +u32 queue) +{ +void __iomem *ioaddr = hw->pcsr; +u32 value, reg; + + reg = (queue <4 ) ?XGMAC_TC_PRTY_MAP0 :XGMAC_TC_PRTY_MAP1 ; +if (queue >=4 ) + queue -=4 ; + + value =readl (ioaddr + reg); + value &= ~XGMAC_PSTC (queue); + value |= (prio <<XGMAC_PSTC_SHIFT (queue)) &XGMAC_PSTC (queue); + +writel (value, ioaddr + reg); +} +static void dwxgmac2_prog_mtl_rx_algorithms (struct mac_device_info *hw,u32 rx_alg) {
@@ -428,7 +445,7 @@ const struct stmmac_ops dwxgmac210_ops = { .rx_ipc = dwxgmac2_rx_ipc, .rx_queue_enable = dwxgmac2_rx_queue_enable, .rx_queue_prio = dwxgmac2_rx_queue_prio, - .tx_queue_prio = NULL, + .tx_queue_prio = dwxgmac2_tx_queue_prio, .rx_queue_routing = NULL, .prog_mtl_rx_algorithms = dwxgmac2_prog_mtl_rx_algorithms, .prog_mtl_tx_algorithms = dwxgmac2_prog_mtl_tx_algorithms,
Signature · 1 line
2.7.4
PATCH 13/26 net: stmmac: selftests: Add a selftest for Flexible RX Parser
In reply to Jose AbreuAdd a selftest for the Flexible RX Parser feature.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- .../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 98 +++++++++++++++++++++- 1 file changed, 97 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +97 -1
@@ -11,8 +11,10 @@#include <linux/ip.h> #include <linux/phy.h> #include <linux/udp.h> +#include <net/pkt_cls.h> #include <net/tcp.h> #include <net/udp.h> +#include <net/tc_act/tc_gact.h> #include "stmmac.h" struct stmmachdr {
@@ -229,7 +231,7 @@ static int stmmac_test_loopback_validate(struct sk_buff *skb, goto out; }if (tpriv->packet->src) { -if (!ether_addr_equal (ehdr->h_source, orig_ndev->dev_addr)) +if (!ether_addr_equal (ehdr->h_source, tpriv->packet->src)) goto out; }
@@ -912,6 +914,96 @@ static int stmmac_test_dvlanfilt(struct stmmac_priv *priv)return ret; } +#ifdef CONFIG_NET_CLS_ACT +static int stmmac_test_rxp (struct stmmac_priv *priv) +{ +unsigned char addr[ETH_ALEN ] = {0xde ,0xad ,0xbe ,0xef ,0x00 ,0x00 }; +struct tc_cls_u32_offload cls_u32 = { }; +struct stmmac_packet_attrs attr = { }; +struct tc_action **actions, *act; +struct tc_u32_sel *sel; +struct tcf_exts *exts; +int ret, i, nk =1 ; + +if (!tc_can_offload (priv->dev)) +return -EOPNOTSUPP ; +if (!priv->dma_cap.frpsel) +return -EOPNOTSUPP ; + + sel =kzalloc (sizeof (*sel) + nk *sizeof (struct tc_u32_key ),GFP_KERNEL ); +if (!sel) +return -ENOMEM ; + + exts =kzalloc (sizeof (*exts),GFP_KERNEL ); +if (!exts) { + ret = -ENOMEM ; + goto cleanup_sel; + } + + actions =kzalloc (nk *sizeof (*actions),GFP_KERNEL ); +if (!actions) { + ret = -ENOMEM ; + goto cleanup_exts; + } + + act =kzalloc (nk *sizeof (*act),GFP_KERNEL ); +if (!act) { + ret = -ENOMEM ; + goto cleanup_actions; + } + + cls_u32.command =TC_CLSU32_NEW_KNODE ; + cls_u32.common.chain_index =0 ; + cls_u32.common.protocol =htons (ETH_P_ALL ); + cls_u32.knode.exts = exts; + cls_u32.knode.sel = sel; + cls_u32.knode.handle =0x123 ; + + exts->nr_actions = nk; + exts->actions = actions; +for (i =0 ; i < nk; i++) { +struct tcf_gact *gact =to_gact (&act[i]); + + actions[i] = &act[i]; + gact->tcf_action =TC_ACT_SHOT ; + } + + sel->nkeys = nk; + sel->offshift =0 ; + sel->keys[0 ].off =6 ; + sel->keys[0 ].val =htonl (0xdeadbeef ); + sel->keys[0 ].mask = ~0x0 ; + + ret =stmmac_tc_setup_cls_u32 (priv, priv, &cls_u32); +if (ret) + goto cleanup_act; + + attr.dst = priv->dev->dev_addr; + attr.src = addr; + + ret =__stmmac_test_loopback (priv, &attr); + ret = !ret;/* Shall NOT receive packet */ + + cls_u32.command =TC_CLSU32_DELETE_KNODE ; +stmmac_tc_setup_cls_u32 (priv, priv, &cls_u32); + +cleanup_act: +kfree (act); +cleanup_actions: +kfree (actions); +cleanup_exts: +kfree (exts); +cleanup_sel: +kfree (sel); +return ret; +} +#else +static int stmmac_test_rxp (struct stmmac_priv *priv) +{ +return -EOPNOTSUPP ; +} +#endif +#define STMMAC_LOOPBACK_NONE 0#define STMMAC_LOOPBACK_MAC 1#define STMMAC_LOOPBACK_PHY 2
@@ -969,6 +1061,10 @@ static const struct stmmac_test { .name = "Double VLAN Filtering", .lb = STMMAC_LOOPBACK_PHY, .fn = stmmac_test_dvlanfilt, + }, { + .name = "Flexible RX Parser ", + .lb = STMMAC_LOOPBACK_PHY, + .fn = stmmac_test_rxp, }, };
Signature · 7 lines
2.7.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 20/26 net: stmmac: Add a counter for Split Header packets
In reply to Jose AbreuAdd a counter that increments each time a packet with split header is received.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/common.h | 1 + drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 1 + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 ++ 3 files changed, 4 insertions(+)
drivers/net/ethernet/stmicro/stmmac/common.h +1 -0
@@ -75,6 +75,7 @@ struct stmmac_extra_stats {unsigned long rx_missed_cntr;unsigned long rx_overflow_cntr;unsigned long rx_vlan; +unsigned long rx_split_hdr_pkt_n;/* Tx/Rx IRQ error info */ unsigned long tx_undeflow_irq;unsigned long tx_process_stopped_irq;
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +1 -0
@@ -67,6 +67,7 @@ static const struct stmmac_stats stmmac_gstrings_stats[] = {STMMAC_STAT (rx_missed_cntr),STMMAC_STAT (rx_overflow_cntr),STMMAC_STAT (rx_vlan), +STMMAC_STAT (rx_split_hdr_pkt_n),/* Tx/Rx IRQ error info */ STMMAC_STAT (tx_undeflow_irq), STMMAC_STAT(tx_process_stopped_irq),
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -0
@@ -3504,6 +3504,8 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)if (!(status & rx_not_ls)) sec_len = sec_len - hlen; len = hlen; + + priv->xstats.rx_split_hdr_pkt_n++; } skb =netdev_alloc_skb_ip_align (priv->dev, len);
Signature · 7 lines
2.7.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 23/26 net: stmmac: xgmac: Add EEE support
In reply to Jose AbreuAdd support for EEE in XGMAC cores by implementing the necessary callbacks.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 12 ++++ .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 75 ++++++++++++++++++++-- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 1 + 3 files changed, 83 insertions(+), 5 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +12 -0
@@ -71,6 +71,7 @@#define XGMAC_PSRQ (x) GENMASK((x) * 8 + 7, (x) * 8)#define XGMAC_PSRQ_SHIFT (x) ((x) * 8)#define XGMAC_INT_STATUS 0x000000b0 +#define XGMAC_LPIIS BIT(5)#define XGMAC_PMTIS BIT(4)#define XGMAC_INT_EN 0x000000b4#define XGMAC_TSIE BIT(12)
@@ -88,10 +89,21 @@#define XGMAC_RWKPKTEN BIT(2)#define XGMAC_MGKPKTEN BIT(1)#define XGMAC_PWRDWN BIT(0) +#define XGMAC_LPI_CTRL 0x000000d0 +#define XGMAC_TXCGE BIT(21) +#define XGMAC_LPITXA BIT(19) +#define XGMAC_PLS BIT(17) +#define XGMAC_LPITXEN BIT(16) +#define XGMAC_RLPIEX BIT(3) +#define XGMAC_RLPIEN BIT(2) +#define XGMAC_TLPIEX BIT(1) +#define XGMAC_TLPIEN BIT(0) +#define XGMAC_LPI_TIMER_CTRL 0x000000d4#define XGMAC_HW_FEATURE0 0x0000011c#define XGMAC_HWFEAT_SAVLANINS BIT(27)#define XGMAC_HWFEAT_RXCOESEL BIT(16)#define XGMAC_HWFEAT_TXCOESEL BIT(14) +#define XGMAC_HWFEAT_EEESEL BIT(13)#define XGMAC_HWFEAT_TSSEL BIT(12)#define XGMAC_HWFEAT_AVSEL BIT(11)#define XGMAC_HWFEAT_RAVSEL BIT(10)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +70 -5
99 lines not on this page · raw message
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +1 -0
@@ -361,6 +361,7 @@ static void dwxgmac2_get_hw_feature(void __iomem *ioaddr, hw_cap =readl (ioaddr +XGMAC_HW_FEATURE0 ); dma_cap->rx_coe = (hw_cap &XGMAC_HWFEAT_RXCOESEL ) >>16 ; dma_cap->tx_coe = (hw_cap &XGMAC_HWFEAT_TXCOESEL ) >>14 ; + dma_cap->eee = (hw_cap &XGMAC_HWFEAT_EEESEL ) >>13 ; dma_cap->atime_stamp = (hw_cap &XGMAC_HWFEAT_TSSEL ) >>12 ; dma_cap->av = (hw_cap &XGMAC_HWFEAT_AVSEL ) >>11 ; dma_cap->av &= (hw_cap &XGMAC_HWFEAT_RAVSEL ) >>10 ;
Signature · 1 line
2.7.4
PATCH 24/26 net: stmmac: Add support for VLAN Insertion Offload
In reply to Jose AbreuAdds the logic to insert a given VLAN ID in a packet. This is offloaded to HW and its descriptor based. For now, only XGMAC implements the necessary callbacks.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/common.h | 8 ++++ drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 15 +++++++ .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 13 ++++++ .../net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | 36 ++++++++++++++++ drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 2 + drivers/net/ethernet/stmicro/stmmac/hwif.h | 10 +++++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 49 +++++++++++++++++++++- 7 files changed, 132 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/common.h +8 -0
@@ -358,6 +358,8 @@ struct dma_features {unsigned int rssen;unsigned int vlhash;unsigned int sphen; +unsigned int vlins; +unsigned int dvlan; };/* GMAC TX FIFO is 8K, Rx FIFO is 16K */
@@ -389,6 +391,12 @@ struct dma_features {#define STMMAC_RSS_HASH_KEY_SIZE 40#define STMMAC_RSS_MAX_TABLE_SIZE 256 +/* VLAN */ +#define STMMAC_VLAN_NONE 0x0 +#define STMMAC_VLAN_REMOVE 0x1 +#define STMMAC_VLAN_INSERT 0x2 +#define STMMAC_VLAN_REPLACE 0x3 +extern const struct stmmac_desc_ops enh_desc_ops;extern const struct stmmac_desc_ops ndesc_ops;
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +15 -0
@@ -63,6 +63,11 @@#define XGMAC_VLAN_ETV BIT(16)#define XGMAC_VLAN_VID GENMASK(15, 0)#define XGMAC_VLAN_HASH_TABLE 0x00000058 +#define XGMAC_VLAN_INCL 0x00000060 +#define XGMAC_VLAN_VLTI BIT(20) +#define XGMAC_VLAN_CSVL BIT(19) +#define XGMAC_VLAN_VLC GENMASK(17, 16) +#define XGMAC_VLAN_VLC_SHIFT 16#define XGMAC_RXQ_CTRL0 0x000000a0#define XGMAC_RXQEN (x) GENMASK((x) * 2 + 1, (x) * 2)#define XGMAC_RXQEN_SHIFT (x) ((x) * 2)
@@ -128,6 +133,7 @@#define XGMAC_HWFEAT_RXQCNT GENMASK(3, 0)#define XGMAC_HW_FEATURE3 0x00000128#define XGMAC_HWFEAT_ASP GENMASK(15, 14) +#define XGMAC_HWFEAT_DVLAN BIT(13)#define XGMAC_HWFEAT_FRPES GENMASK(12, 11)#define XGMAC_HWFEAT_FRPPB GENMASK(10, 9)#define XGMAC_HWFEAT_FRPSEL BIT(3)
@@ -337,10 +343,14 @@#define XGMAC_REGSIZE ((0x0000317c + (0x80 * 15)) / 4)/* Descriptors */ +#define XGMAC_TDES2_IVT GENMASK(31, 16) +#define XGMAC_TDES2_IVT_SHIFT 16#define XGMAC_TDES2_IOC BIT(31)#define XGMAC_TDES2_TTSE BIT(30)#define XGMAC_TDES2_B2L GENMASK(29, 16)#define XGMAC_TDES2_B2L_SHIFT 16 +#define XGMAC_TDES2_VTIR GENMASK(15, 14) +#define XGMAC_TDES2_VTIR_SHIFT 14#define XGMAC_TDES2_B1L GENMASK(13, 0)#define XGMAC_TDES3_OWN BIT(31)#define XGMAC_TDES3_CTXT BIT(30)
@@ -353,10 +363,15 @@#define XGMAC_TDES3_SAIC_SHIFT 23#define XGMAC_TDES3_THL GENMASK(22, 19)#define XGMAC_TDES3_THL_SHIFT 19 +#define XGMAC_TDES3_IVTIR GENMASK(19, 18) +#define XGMAC_TDES3_IVTIR_SHIFT 18#define XGMAC_TDES3_TSE BIT(18) +#define XGMAC_TDES3_IVLTV BIT(17)#define XGMAC_TDES3_CIC GENMASK(17, 16)#define XGMAC_TDES3_CIC_SHIFT 16#define XGMAC_TDES3_TPL GENMASK(17, 0) +#define XGMAC_TDES3_VLTV BIT(16) +#define XGMAC_TDES3_VT GENMASK(15, 0)#define XGMAC_TDES3_FL GENMASK(14, 0)#define XGMAC_RDES2_HL GENMASK(9, 0)#define XGMAC_RDES3_OWN BIT(31)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +13 -0
@@ -1157,6 +1157,18 @@ static void dwxgmac2_sarc_configure(void __iomem *ioaddr, int val)writel (value, ioaddr +XGMAC_TX_CONFIG ); } +static void dwxgmac2_enable_vlan (struct mac_device_info *hw,u32 type) +{ +void __iomem *ioaddr = hw->pcsr; +u32 value; + + value =readl (ioaddr +XGMAC_VLAN_INCL ); + value |=XGMAC_VLAN_VLTI ; + value &= ~XGMAC_VLAN_VLC ; + value |= (type <<XGMAC_VLAN_VLC_SHIFT ) &XGMAC_VLAN_VLC ; +writel (value, ioaddr +XGMAC_VLAN_INCL ); +} +const struct stmmac_ops dwxgmac210_ops = { .core_init = dwxgmac2_core_init, .set_mac = dwxgmac2_set_mac,
@@ -1196,6 +1208,7 @@ const struct stmmac_ops dwxgmac210_ops = { .get_mac_tx_timestamp = dwxgmac2_get_mac_tx_timestamp, .flex_pps_config = dwxgmac2_flex_pps_config, .sarc_configure = dwxgmac2_sarc_configure, + .enable_vlan = dwxgmac2_enable_vlan, };int dwxgmac2_setup (struct stmmac_priv *priv)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c +36 -0
@@ -306,6 +306,40 @@ static void dwxgmac2_set_sarc(struct dma_desc *p, u32 sarc_type) p->des3 |=cpu_to_le32 (sarc_type &XGMAC_TDES3_SAIC ); } +static void dwxgmac2_set_vlan_tag (struct dma_desc *p,u16 tag,u16 inner_tag, +u32 inner_type) +{ + p->des0 =0 ; + p->des1 =0 ; +if (inner_tag) { +u32 des = inner_tag <<XGMAC_TDES2_IVT_SHIFT ; + + des &=XGMAC_TDES2_IVT ; + p->des2 =cpu_to_le32 (des); + + des = inner_type <<XGMAC_TDES3_IVTIR_SHIFT ; + des &=XGMAC_TDES3_IVTIR ; + p->des3 =cpu_to_le32 (des |XGMAC_TDES3_IVLTV ); + }else { + p->des2 =0 ; + p->des3 =0 ; + } + +if (tag) { + p->des3 =cpu_to_le32 ((tag &XGMAC_TDES3_VT ) |XGMAC_TDES3_VLTV ); + }else { + p->des3 =0 ; + } + + p->des3 |=cpu_to_le32 (XGMAC_TDES3_CTXT ); +} + +static void dwxgmac2_set_vlan (struct dma_desc *p,u32 type) +{ + type <<=XGMAC_TDES2_VTIR_SHIFT ; + p->des2 |=cpu_to_le32 (type &XGMAC_TDES2_VTIR ); +} +const struct stmmac_desc_ops dwxgmac210_desc_ops = { .tx_status = dwxgmac2_get_tx_status, .rx_status = dwxgmac2_get_rx_status,
@@ -333,4 +367,6 @@ const struct stmmac_desc_ops dwxgmac210_desc_ops = { .get_rx_header_len = dwxgmac2_get_rx_header_len, .set_sec_addr = dwxgmac2_set_sec_addr, .set_sarc = dwxgmac2_set_sarc, + .set_vlan_tag = dwxgmac2_set_vlan_tag, + .set_vlan = dwxgmac2_set_vlan, };
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +2 -0
@@ -359,6 +359,7 @@ static void dwxgmac2_get_hw_feature(void __iomem *ioaddr,/* MAC HW feature 0 */ hw_cap =readl (ioaddr +XGMAC_HW_FEATURE0 ); + dma_cap->vlins = (hw_cap &XGMAC_HWFEAT_SAVLANINS ) >>27 ; dma_cap->rx_coe = (hw_cap &XGMAC_HWFEAT_RXCOESEL ) >>16 ; dma_cap->tx_coe = (hw_cap &XGMAC_HWFEAT_TXCOESEL ) >>14 ; dma_cap->eee = (hw_cap &XGMAC_HWFEAT_EEESEL ) >>13 ;
@@ -413,6 +414,7 @@ static void dwxgmac2_get_hw_feature(void __iomem *ioaddr,/* MAC HW feature 3 */ hw_cap =readl (ioaddr +XGMAC_HW_FEATURE3 ); dma_cap->asp = (hw_cap &XGMAC_HWFEAT_ASP ) >>14 ; + dma_cap->dvlan = (hw_cap &XGMAC_HWFEAT_DVLAN ) >>13 ; dma_cap->frpes = (hw_cap &XGMAC_HWFEAT_FRPES ) >>11 ; dma_cap->frpbs = (hw_cap &XGMAC_HWFEAT_FRPPB ) >>9 ; dma_cap->frpsel = (hw_cap &XGMAC_HWFEAT_FRPSEL ) >>3 ;
drivers/net/ethernet/stmicro/stmmac/hwif.h +10 -0
@@ -92,6 +92,9 @@ struct stmmac_desc_ops {int (*get_rx_header_len)(struct dma_desc *p,unsigned int *len);void (*set_sec_addr)(struct dma_desc *p,dma_addr_t addr);void (*set_sarc)(struct dma_desc *p,u32 sarc_type); +void (*set_vlan_tag)(struct dma_desc *p,u16 tag,u16 inner_tag, +u32 inner_type); +void (*set_vlan)(struct dma_desc *p,u32 type); }; #define stmmac_init_rx_desc(__priv, __args...) \
@@ -150,6 +153,10 @@ struct stmmac_desc_ops { stmmac_do_void_callback(__priv, desc, set_sec_addr, __args) #define stmmac_set_desc_sarc(__priv, __args...) \ stmmac_do_void_callback(__priv, desc, set_sarc, __args) +#define stmmac_set_desc_vlan_tag(__priv, __args...) \ + stmmac_do_void_callback(__priv, desc, set_vlan_tag, __args) +#define stmmac_set_desc_vlan(__priv, __args...) \ + stmmac_do_void_callback(__priv, desc, set_vlan, __args)struct stmmac_dma_cfg ;struct dma_features ;
@@ -351,6 +358,7 @@ struct stmmac_ops {/* VLAN */ void (*update_vlan_hash)(struct mac_device_info *hw,u32 hash,bool is_double); +void (*enable_vlan)(struct mac_device_info *hw,u32 type);/* TX Timestamp */ int (*get_mac_tx_timestamp)(struct mac_device_info *hw,u64 *ts);/* Source Address Insertion / Replacement */
@@ -429,6 +437,8 @@ struct stmmac_ops { stmmac_do_callback(__priv, mac, rss_configure, __args) #define stmmac_update_vlan_hash(__priv, __args...) \ stmmac_do_void_callback(__priv, mac, update_vlan_hash, __args) +#define stmmac_enable_vlan(__priv, __args...) \ + stmmac_do_void_callback(__priv, mac, enable_vlan, __args) #define stmmac_get_mac_tx_timestamp(__priv, __args...) \ stmmac_do_callback(__priv, mac, get_mac_tx_timestamp, __args) #define stmmac_sarc_configure(__priv, __args...) \
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +48 -1
102 lines not on this page · raw message
Signature · 1 line
2.7.4
cover net: stmmac: Misc improvements for XGMAC
[ This series depend on 3caa61c20875 ("net: stmmac: Sync RX Buffer upon allocation") which is already in -net but not -next ]
Misc improvements for -next which adds new features in XGMAC cores.
More info in commit logs.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
Jose Abreu (26):
net: stmmac: xgmac: Fix XGMAC selftests
net: stmmac: xgmac: Implement MMC counters
net: stmmac: Fix issues when number of Queues >= 4
net: stmmac: xgmac: Implement set_mtl_tx_queue_weight()
net: stmmac: xgmac: Implement tx_queue_prio()
net: stmmac: Implement RSS and enable it in XGMAC core
net: stmmac: selftests: Add RSS test
net: stmmac: Implement VLAN Hash Filtering in XGMAC
net: stmmac: selftests: Add test for VLAN and Double VLAN Filtering
net: stmmac: Implement Safety Features in XGMAC core
net: stmmac: Add Flexible RX Parser support in XGMAC
net: stmmac: tc: Do not return a fragment entry
net: stmmac: selftests: Add a selftest for Flexible RX Parser
net: stmmac: Get correct timestamp values from XGMAC
net: stmmac: Prepare to add Split Header support
net: stmmac: xgmac: Correctly return that RX descriptor is not last
one
net: stmmac: Add Split Header support and enable it in XGMAC cores
net: stmmac: dwxgmac: Add Flexible PPS support
net: stmmac: Add ethtool register dump for XGMAC cores
net: stmmac: Add a counter for Split Header packets
net: stmmac: Add support for SA Insertion/Replacement in XGMAC cores
net: stmmac: selftests: Add tests for SA Insertion/Replacement
net: stmmac: xgmac: Add EEE support
net: stmmac: Add support for VLAN Insertion Offload
net: stmmac: selftests: Add selftest for VLAN TX Offload
net: stmmac: selftests: Return proper error code to userspace
drivers/net/ethernet/stmicro/stmmac/common.h | 16 + drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 4 + drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 135 +++- .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 880 ++++++++++++++++++++- .../net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | 118 ++- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 41 +- drivers/net/ethernet/stmicro/stmmac/hwif.c | 4 +- drivers/net/ethernet/stmicro/stmmac/hwif.h | 47 ++ drivers/net/ethernet/stmicro/stmmac/mmc.h | 9 + drivers/net/ethernet/stmicro/stmmac/mmc_core.c | 192 +++++ drivers/net/ethernet/stmicro/stmmac/stmmac.h | 21 + .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 106 ++- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 380 +++++++-- .../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 513 +++++++++++- drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 2 +- include/linux/stmmac.h | 1 + 16 files changed, 2361 insertions(+), 108 deletions(-)
Signature · 1 line
2.7.4
PATCH 25/26 net: stmmac: selftests: Add selftest for VLAN TX Offload
Add 2 new selftests for VLAN Insertion offloading. Tests are for inner and outer VLAN offloading.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- .../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 81 ++++++++++++++++++++++ 1 file changed, 81 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +81 -0
@@ -731,6 +731,9 @@ static int stmmac_test_vlan_validate(struct sk_buff *skb,struct ethhdr *ehdr;struct udphdr *uhdr;struct iphdr *ihdr; +u16 proto; + + proto = tpriv->double_vlan ?ETH_P_8021AD :ETH_P_8021Q ; skb =skb_unshare (skb,GFP_ATOMIC );if (!skb)
@@ -740,6 +743,12 @@ static int stmmac_test_vlan_validate(struct sk_buff *skb, goto out;if (skb_headlen (skb) < (STMMAC_TEST_PKT_SIZE -ETH_HLEN )) goto out; +if (tpriv->vlan_id) { +if (skb->vlan_proto !=htons (proto)) + goto out; +if (skb->vlan_tci != tpriv->vlan_id) + goto out; + } ehdr = (struct ethhdr *)skb_mac_header (skb);if (!ether_addr_equal (ehdr->h_dest, tpriv->packet->dst))
@@ -1084,6 +1093,70 @@ static int stmmac_test_reg_sar(struct stmmac_priv *priv)return ret; } +static int stmmac_test_vlanoff_common (struct stmmac_priv *priv,bool svlan) +{ +struct stmmac_packet_attrs attr = { }; +struct stmmac_test_priv *tpriv; +struct sk_buff *skb =NULL ; +int ret =0 ; +u16 proto; + +if (!priv->dma_cap.vlins) +return -EOPNOTSUPP ; + + tpriv =kzalloc (sizeof (*tpriv),GFP_KERNEL ); +if (!tpriv) +return -ENOMEM ; + + proto = svlan ?ETH_P_8021AD :ETH_P_8021Q ; + + tpriv->ok = false; + tpriv->double_vlan = svlan; +init_completion (&tpriv->comp); + + tpriv->pt.type =htons (ETH_P_IP ); + tpriv->pt.func = stmmac_test_vlan_validate; + tpriv->pt.dev = priv->dev; + tpriv->pt.af_packet_priv = tpriv; + tpriv->packet = &attr; + tpriv->vlan_id =0x123 ; +dev_add_pack (&tpriv->pt); + + ret =vlan_vid_add (priv->dev,htons (proto), tpriv->vlan_id); +if (ret) + goto cleanup; + + attr.dst = priv->dev->dev_addr; + + skb =stmmac_test_get_udp_skb (priv, &attr); +if (!skb) { + ret = -ENOMEM ; + goto vlan_del; + } + +__vlan_hwaccel_put_tag (skb,htons (proto), tpriv->vlan_id); + ret =__stmmac_test_loopback (priv, &attr); + +vlan_del: +vlan_vid_del (priv->dev,htons (proto), tpriv->vlan_id); +cleanup: +dev_remove_pack (&tpriv->pt); +kfree (tpriv); +return ret; +} + +static int stmmac_test_vlanoff (struct stmmac_priv *priv) +{ +return stmmac_test_vlanoff_common (priv, false); +} + +static int stmmac_test_svlanoff (struct stmmac_priv *priv) +{ +if (!priv->dma_cap.dvlan) +return -EOPNOTSUPP ; +return stmmac_test_vlanoff_common (priv, true); +} +#define STMMAC_LOOPBACK_NONE 0#define STMMAC_LOOPBACK_MAC 1#define STMMAC_LOOPBACK_PHY 2
@@ -1161,6 +1234,14 @@ static const struct stmmac_test { .name = "SA Replacement (reg)", .lb = STMMAC_LOOPBACK_PHY, .fn = stmmac_test_reg_sar, + }, { + .name = "VLAN TX Insertion ", + .lb = STMMAC_LOOPBACK_PHY, + .fn = stmmac_test_vlanoff, + }, { + .name = "SVLAN TX Insertion ", + .lb = STMMAC_LOOPBACK_PHY, + .fn = stmmac_test_svlanoff, }, };
Signature · 1 line
2.7.4
PATCH 8/26 net: stmmac: Implement VLAN Hash Filtering in XGMAC
In reply to Jose AbreuImplement the VLAN Hash Filtering feature in XGMAC core.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/common.h | 1 + drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 10 +++ .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 41 +++++++++++ drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 1 + drivers/net/ethernet/stmicro/stmmac/hwif.h | 5 ++ drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 79 ++++++++++++++++++++++ 7 files changed, 139 insertions(+)
drivers/net/ethernet/stmicro/stmmac/common.h +1 -0
@@ -355,6 +355,7 @@ struct dma_features {unsigned int frpes;unsigned int addr64;unsigned int rssen; +unsigned int vlhash; };/* GMAC TX FIFO is 8K, Rx FIFO is 16K */
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +10 -0
@@ -44,6 +44,7 @@#define XGMAC_CORE_INIT_RX 0#define XGMAC_PACKET_FILTER 0x00000008#define XGMAC_FILTER_RA BIT(31) +#define XGMAC_FILTER_VTFE BIT(16)#define XGMAC_FILTER_HPF BIT(10)#define XGMAC_FILTER_PCF BIT(7)#define XGMAC_FILTER_PM BIT(4)
@@ -51,6 +52,14 @@#define XGMAC_FILTER_PR BIT(0)#define XGMAC_HASH_TABLE (x) (0x00000010 + (x) * 4)#define XGMAC_MAX_HASH_TABLE 8 +#define XGMAC_VLAN_TAG 0x00000050 +#define XGMAC_VLAN_EDVLP BIT(26) +#define XGMAC_VLAN_VTHM BIT(25) +#define XGMAC_VLAN_DOVLTC BIT(20) +#define XGMAC_VLAN_ESVL BIT(18) +#define XGMAC_VLAN_ETV BIT(16) +#define XGMAC_VLAN_VID GENMASK(15, 0) +#define XGMAC_VLAN_HASH_TABLE 0x00000058#define XGMAC_RXQ_CTRL0 0x000000a0#define XGMAC_RXQEN (x) GENMASK((x) * 2 + 1, (x) * 2)#define XGMAC_RXQEN_SHIFT (x) ((x) * 2)
@@ -87,6 +96,7 @@#define XGMAC_HWFEAT_MMCSEL BIT(8)#define XGMAC_HWFEAT_MGKSEL BIT(7)#define XGMAC_HWFEAT_RWKSEL BIT(6) +#define XGMAC_HWFEAT_VLHASH BIT(4)#define XGMAC_HWFEAT_GMIISEL BIT(1)#define XGMAC_HW_FEATURE1 0x00000120#define XGMAC_HWFEAT_RSSEN BIT(20)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +41 -0
53 lines not on this page · raw message
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +1 -0
@@ -359,6 +359,7 @@ static void dwxgmac2_get_hw_feature(void __iomem *ioaddr, dma_cap->rmon = (hw_cap &XGMAC_HWFEAT_MMCSEL ) >>8 ; dma_cap->pmt_magic_frame = (hw_cap &XGMAC_HWFEAT_MGKSEL ) >>7 ; dma_cap->pmt_remote_wake_up = (hw_cap &XGMAC_HWFEAT_RWKSEL ) >>6 ; + dma_cap->vlhash = (hw_cap &XGMAC_HWFEAT_VLHASH ) >>4 ; dma_cap->mbps_1000 = (hw_cap &XGMAC_HWFEAT_GMIISEL ) >>1 ;/* MAC HW feature 1 */
drivers/net/ethernet/stmicro/stmmac/hwif.h +5 -0
@@ -336,6 +336,9 @@ struct stmmac_ops {/* RSS */ int (*rss_configure)(struct mac_device_info *hw,struct stmmac_rss *cfg,u32 num_rxq); +/* VLAN */ +void (*update_vlan_hash)(struct mac_device_info *hw,u32 hash, +bool is_double); }; #define stmmac_core_init(__priv, __args...) \
@@ -408,6 +411,8 @@ struct stmmac_ops { stmmac_do_void_callback(__priv, mac, set_mac_loopback, __args) #define stmmac_rss_configure(__priv, __args...) \ stmmac_do_callback(__priv, mac, rss_configure, __args) +#define stmmac_update_vlan_hash(__priv, __args...) \ + stmmac_do_void_callback(__priv, mac, update_vlan_hash, __args)/* PTP and HW Timer helpers */ struct stmmac_hwtimestamp {
drivers/net/ethernet/stmicro/stmmac/stmmac.h +2 -0
@@ -13,6 +13,7 @@#define DRV_MODULE_VERSION "Jan_2016"#include <linux/clk.h> +#include <linux/if_vlan.h> #include <linux/stmmac.h> #include <linux/phylink.h> #include <linux/pci.h>
@@ -191,6 +192,7 @@ struct stmmac_priv {spinlock_t ptp_lock;void __iomem *mmcaddr;void __iomem *ptpaddr; +unsigned long active_vlans[BITS_TO_LONGS (VLAN_N_VID )];#ifdef CONFIG_DEBUG_FS struct dentry *dbgfs_dir;
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +79 -0
97 lines not on this page · raw message
Signature · 7 lines
2.7.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 4/26 net: stmmac: xgmac: Implement set_mtl_tx_queue_weight()
In reply to Jose AbreuImplement the TX Queue Weight callback. In order for this to be active we also need to set ETS algorithm when configuring Queue.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +21 -1
@@ -144,7 +144,9 @@ static void dwxgmac2_prog_mtl_tx_algorithms(struct mac_device_info *hw, u32 tx_alg) {void __iomem *ioaddr = hw->pcsr; +bool ets = true;u32 value; +int i; value =readl (ioaddr +XGMAC_MTL_OPMODE ); value &= ~XGMAC_ETSALG ;
@@ -160,10 +162,28 @@ static void dwxgmac2_prog_mtl_tx_algorithms(struct mac_device_info *hw, value |=XGMAC_DWRR ;break ;default : + ets = false;break ; }writel (value, ioaddr +XGMAC_MTL_OPMODE ); + +/* Set ETS if desired */ +for (i =0 ; i <MTL_MAX_TX_QUEUES ; i++) { + value =readl (ioaddr +XGMAC_MTL_TCx_ETS_CONTROL (i)); + value &= ~XGMAC_TSA ; +if (ets) + value |=XGMAC_ETS ; +writel (value, ioaddr +XGMAC_MTL_TCx_ETS_CONTROL (i)); + } +} + +static void dwxgmac2_set_mtl_tx_queue_weight (struct mac_device_info *hw, +u32 weight,u32 queue) +{ +void __iomem *ioaddr = hw->pcsr; + +writel (weight, ioaddr +XGMAC_MTL_TCx_QUANTUM_WEIGHT (queue)); } static void dwxgmac2_map_mtl_to_dma(struct mac_device_info *hw, u32 queue,
@@ -412,7 +432,7 @@ const struct stmmac_ops dwxgmac210_ops = { .rx_queue_routing = NULL, .prog_mtl_rx_algorithms = dwxgmac2_prog_mtl_rx_algorithms, .prog_mtl_tx_algorithms = dwxgmac2_prog_mtl_tx_algorithms, - .set_mtl_tx_queue_weight = NULL, + .set_mtl_tx_queue_weight = dwxgmac2_set_mtl_tx_queue_weight, .map_mtl_to_dma = dwxgmac2_map_mtl_to_dma, .config_cbs = dwxgmac2_config_cbs, .dump_regs = NULL,
Signature · 1 line
2.7.4
PATCH 22/26 net: stmmac: selftests: Add tests for SA Insertion/Replacement
In reply to Jose AbreuAdd 4 new tests:
- SA Insertion (register based)
- SA Insertion (descriptor based)
- SA Replacament (register based)
- SA Replacement (descriptor based)
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- .../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 98 +++++++++++++++++++++- 1 file changed, 97 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +97 -1
@@ -45,6 +45,7 @@ struct stmmac_packet_attrs {int size;int remove_sa;u8 id; +int sarc; };static u8 stmmac_test_next_id;
@@ -230,7 +231,10 @@ static int stmmac_test_loopback_validate(struct sk_buff *skb,if (!ether_addr_equal (ehdr->h_dest, tpriv->packet->dst)) goto out; } -if (tpriv->packet->src) { +if (tpriv->packet->sarc) { +if (!ether_addr_equal (ehdr->h_source, ehdr->h_dest)) + goto out; + }else if (tpriv->packet->src) {if (!ether_addr_equal (ehdr->h_source, tpriv->packet->src)) goto out; }
@@ -1004,6 +1008,82 @@ static int stmmac_test_rxp(struct stmmac_priv *priv) }#endif +static int stmmac_test_desc_sai (struct stmmac_priv *priv) +{ +unsigned char src[ETH_ALEN ] = {0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 }; +struct stmmac_packet_attrs attr = { }; +int ret; + + attr.remove_sa = true; + attr.sarc = true; + attr.src = src; + attr.dst = priv->dev->dev_addr; + + priv->sarc_type =0x1 ; + + ret =__stmmac_test_loopback (priv, &attr); + + priv->sarc_type =0x0 ; +return ret; +} + +static int stmmac_test_desc_sar (struct stmmac_priv *priv) +{ +unsigned char src[ETH_ALEN ] = {0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 }; +struct stmmac_packet_attrs attr = { }; +int ret; + + attr.sarc = true; + attr.src = src; + attr.dst = priv->dev->dev_addr; + + priv->sarc_type =0x2 ; + + ret =__stmmac_test_loopback (priv, &attr); + + priv->sarc_type =0x0 ; +return ret; +} + +static int stmmac_test_reg_sai (struct stmmac_priv *priv) +{ +unsigned char src[ETH_ALEN ] = {0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 }; +struct stmmac_packet_attrs attr = { }; +int ret; + + attr.remove_sa = true; + attr.sarc = true; + attr.src = src; + attr.dst = priv->dev->dev_addr; + +if (stmmac_sarc_configure (priv, priv->ioaddr,0x2 )) +return -EOPNOTSUPP ; + + ret =__stmmac_test_loopback (priv, &attr); + +stmmac_sarc_configure (priv, priv->ioaddr,0x0 ); +return ret; +} + +static int stmmac_test_reg_sar (struct stmmac_priv *priv) +{ +unsigned char src[ETH_ALEN ] = {0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 }; +struct stmmac_packet_attrs attr = { }; +int ret; + + attr.sarc = true; + attr.src = src; + attr.dst = priv->dev->dev_addr; + +if (stmmac_sarc_configure (priv, priv->ioaddr,0x3 )) +return -EOPNOTSUPP ; + + ret =__stmmac_test_loopback (priv, &attr); + +stmmac_sarc_configure (priv, priv->ioaddr,0x0 ); +return ret; +} +#define STMMAC_LOOPBACK_NONE 0#define STMMAC_LOOPBACK_MAC 1#define STMMAC_LOOPBACK_PHY 2
@@ -1065,6 +1145,22 @@ static const struct stmmac_test { .name = "Flexible RX Parser ", .lb = STMMAC_LOOPBACK_PHY, .fn = stmmac_test_rxp, + }, { + .name = "SA Insertion (desc) ", + .lb = STMMAC_LOOPBACK_PHY, + .fn = stmmac_test_desc_sai, + }, { + .name = "SA Replacement (desc)", + .lb = STMMAC_LOOPBACK_PHY, + .fn = stmmac_test_desc_sar, + }, { + .name = "SA Insertion (reg) ", + .lb = STMMAC_LOOPBACK_PHY, + .fn = stmmac_test_reg_sai, + }, { + .name = "SA Replacement (reg)", + .lb = STMMAC_LOOPBACK_PHY, + .fn = stmmac_test_reg_sar, }, };
Signature · 1 line
2.7.4
PATCH 17/26 net: stmmac: Add Split Header support and enable it in XGMAC cores
In reply to Jose AbreuAdd the support for Split Header feature in the RX path and enable it in XGMAC cores.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/common.h | 1 + drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 6 ++ .../net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | 18 +++++- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 18 ++++++ drivers/net/ethernet/stmicro/stmmac/hwif.h | 9 +++ drivers/net/ethernet/stmicro/stmmac/stmmac.h | 3 + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 68 +++++++++++++++++++++- 7 files changed, 121 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/common.h +1 -0
@@ -356,6 +356,7 @@ struct dma_features {unsigned int addr64;unsigned int rssen;unsigned int vlhash; +unsigned int sphen; };/* GMAC TX FIFO is 8K, Rx FIFO is 16K */
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +6 -0
@@ -32,6 +32,9 @@#define XGMAC_CONFIG_ARPEN BIT(31)#define XGMAC_CONFIG_GPSL GENMASK(29, 16)#define XGMAC_CONFIG_GPSL_SHIFT 16 +#define XGMAC_CONFIG_HDSMS GENMASK(14, 12) +#define XGMAC_CONFIG_HDSMS_SHIFT 12 +#define XGMAC_CONFIG_HDSMS_256 (0x2 << XGMAC_CONFIG_HDSMS_SHIFT)#define XGMAC_CONFIG_S2KP BIT(11)#define XGMAC_CONFIG_LM BIT(10)#define XGMAC_CONFIG_IPC BIT(9)
@@ -101,6 +104,7 @@#define XGMAC_HW_FEATURE1 0x00000120#define XGMAC_HWFEAT_RSSEN BIT(20)#define XGMAC_HWFEAT_TSOEN BIT(18) +#define XGMAC_HWFEAT_SPHEN BIT(17)#define XGMAC_HWFEAT_ADDR64 GENMASK(15, 14)#define XGMAC_HWFEAT_TXFIFOSIZE GENMASK(10, 6)#define XGMAC_HWFEAT_RXFIFOSIZE GENMASK(4, 0)
@@ -258,6 +262,7 @@#define XGMAC_TCEIE BIT(0)#define XGMAC_DMA_ECC_INT_STATUS 0x0000306c#define XGMAC_DMA_CH_CONTROL (x) (0x00003100 + (0x80 * (x))) +#define XGMAC_SPH BIT(24)#define XGMAC_PBLx8 BIT(16)#define XGMAC_DMA_CH_TX_CONTROL (x) (0x00003104 + (0x80 * (x)))#define XGMAC_TxPBL GENMASK(21, 16)
@@ -318,6 +323,7 @@#define XGMAC_TDES3_CIC_SHIFT 16#define XGMAC_TDES3_TPL GENMASK(17, 0)#define XGMAC_TDES3_FL GENMASK(14, 0) +#define XGMAC_RDES2_HL GENMASK(9, 0)#define XGMAC_RDES3_OWN BIT(31)#define XGMAC_RDES3_CTXT BIT(30)#define XGMAC_RDES3_IOC BIT(30)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c +17 -1
@@ -29,6 +29,8 @@ static int dwxgmac2_get_rx_status(void *data, struct stmmac_extra_stats *x,if (unlikely (rdes3 &XGMAC_RDES3_OWN ))return dma_own; +if (unlikely (rdes3 &XGMAC_RDES3_CTXT )) +return discard_frame;if (likely (!(rdes3 &XGMAC_RDES3_LD )))return rx_not_ls;if (unlikely ((rdes3 &XGMAC_RDES3_ES ) && (rdes3 &XGMAC_RDES3_LD )))
@@ -54,7 +56,7 @@ static void dwxgmac2_set_tx_owner(struct dma_desc *p)static void dwxgmac2_set_rx_owner (struct dma_desc *p,int disable_rx_ic) { - p->des3 =cpu_to_le32 (XGMAC_RDES3_OWN ); + p->des3 |=cpu_to_le32 (XGMAC_RDES3_OWN );if (!disable_rx_ic) p->des3 |=cpu_to_le32 (XGMAC_RDES3_IOC );
@@ -285,6 +287,18 @@ static int dwxgmac2_get_rx_hash(struct dma_desc *p, u32 *hash,return -EINVAL ; } +static int dwxgmac2_get_rx_header_len (struct dma_desc *p,unsigned int *len) +{ + *len =le32_to_cpu (p->des2) &XGMAC_RDES2_HL ; +return 0 ; +} + +static void dwxgmac2_set_sec_addr (struct dma_desc *p,dma_addr_t addr) +{ + p->des2 =cpu_to_le32 (lower_32_bits (addr)); + p->des3 =cpu_to_le32 (upper_32_bits (addr)); +} +const struct stmmac_desc_ops dwxgmac210_desc_ops = { .tx_status = dwxgmac2_get_tx_status, .rx_status = dwxgmac2_get_rx_status,
@@ -309,4 +323,6 @@ const struct stmmac_desc_ops dwxgmac210_desc_ops = { .set_addr = dwxgmac2_set_addr, .clear = dwxgmac2_clear, .get_rx_hash = dwxgmac2_get_rx_hash, + .get_rx_header_len = dwxgmac2_get_rx_header_len, + .set_sec_addr = dwxgmac2_set_sec_addr, };
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +18 -0
@@ -366,6 +366,7 @@ static void dwxgmac2_get_hw_feature(void __iomem *ioaddr, hw_cap =readl (ioaddr +XGMAC_HW_FEATURE1 ); dma_cap->rssen = (hw_cap &XGMAC_HWFEAT_RSSEN ) >>20 ; dma_cap->tsoen = (hw_cap &XGMAC_HWFEAT_TSOEN ) >>18 ; + dma_cap->sphen = (hw_cap &XGMAC_HWFEAT_SPHEN ) >>17 ; dma_cap->addr64 = (hw_cap &XGMAC_HWFEAT_ADDR64 ) >>14 ;switch (dma_cap->addr64) {
@@ -472,6 +473,22 @@ static void dwxgmac2_set_bfsize(void __iomem *ioaddr, int bfsize, u32 chan)writel (value, ioaddr +XGMAC_DMA_CH_RX_CONTROL (chan)); } +static void dwxgmac2_enable_sph (void __iomem *ioaddr,bool en,u32 chan) +{ +u32 value =readl (ioaddr +XGMAC_RX_CONFIG ); + + value &= ~XGMAC_CONFIG_HDSMS ; + value |=XGMAC_CONFIG_HDSMS_256 ;/* Segment max 256 bytes */ +writel (value, ioaddr +XGMAC_RX_CONFIG ); + + value =readl (ioaddr +XGMAC_DMA_CH_CONTROL (chan)); +if (en) + value |=XGMAC_SPH ; +else + value &= ~XGMAC_SPH ; +writel (value, ioaddr +XGMAC_DMA_CH_CONTROL (chan)); +} +const struct stmmac_dma_ops dwxgmac210_dma_ops = { .reset = dwxgmac2_dma_reset, .init = dwxgmac2_dma_init,
@@ -498,4 +515,5 @@ const struct stmmac_dma_ops dwxgmac210_dma_ops = { .enable_tso = dwxgmac2_enable_tso, .qmode = dwxgmac2_qmode, .set_bfsize = dwxgmac2_set_bfsize, + .enable_sph = dwxgmac2_enable_sph, };
drivers/net/ethernet/stmicro/stmmac/hwif.h +9 -0
@@ -89,6 +89,8 @@ struct stmmac_desc_ops {/* RSS */ int (*get_rx_hash)(struct dma_desc *p,u32 *hash,enum pkt_hash_types *type); +int (*get_rx_header_len)(struct dma_desc *p,unsigned int *len); +void (*set_sec_addr)(struct dma_desc *p,dma_addr_t addr); }; #define stmmac_init_rx_desc(__priv, __args...) \
@@ -141,6 +143,10 @@ struct stmmac_desc_ops { stmmac_do_void_callback(__priv, desc, clear, __args) #define stmmac_get_rx_hash(__priv, __args...) \ stmmac_do_callback(__priv, desc, get_rx_hash, __args) +#define stmmac_get_rx_header_len(__priv, __args...) \ + stmmac_do_callback(__priv, desc, get_rx_header_len, __args) +#define stmmac_set_desc_sec_addr(__priv, __args...) \ + stmmac_do_void_callback(__priv, desc, set_sec_addr, __args)struct stmmac_dma_cfg ;struct dma_features ;
@@ -191,6 +197,7 @@ struct stmmac_dma_ops {void (*enable_tso)(void __iomem *ioaddr,bool en,u32 chan);void (*qmode)(void __iomem *ioaddr,u32 channel,u8 qmode);void (*set_bfsize)(void __iomem *ioaddr,int bfsize,u32 chan); +void (*enable_sph)(void __iomem *ioaddr,bool en,u32 chan); }; #define stmmac_reset(__priv, __args...) \
@@ -247,6 +254,8 @@ struct stmmac_dma_ops { stmmac_do_void_callback(__priv, dma, qmode, __args) #define stmmac_set_dma_bfsize(__priv, __args...) \ stmmac_do_void_callback(__priv, dma, set_bfsize, __args) +#define stmmac_enable_sph(__priv, __args...) \ + stmmac_do_void_callback(__priv, dma, enable_sph, __args)struct mac_device_info ;struct net_device ;
drivers/net/ethernet/stmicro/stmmac/stmmac.h +3 -0
@@ -58,7 +58,9 @@ struct stmmac_tx_queue {struct stmmac_rx_buffer {struct page *page; +struct page *sec_page;dma_addr_t addr; +dma_addr_t sec_addr; };struct stmmac_rx_queue {
@@ -136,6 +138,7 @@ struct stmmac_priv {int hwts_tx_en;bool tx_path_in_lpi_mode;bool tso; +int sph;unsigned int dma_buf_sz;unsigned int rx_copybreak;
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +67 -1
143 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 21/26 net: stmmac: Add support for SA Insertion/Replacement in XGMAC cores
In reply to Jose AbreuAdd the support for Source Address Insertion and Replacement in XGMAC cores. Two methods are supported: Descriptor based and register based.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 2 ++ drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 11 +++++++++++ drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | 10 +++++++++- drivers/net/ethernet/stmicro/stmmac/hwif.h | 7 +++++++ drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 ++++++ 6 files changed, 36 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +2 -0
@@ -337,6 +337,8 @@#define XGMAC_TDES3_CPC GENMASK(27, 26)#define XGMAC_TDES3_CPC_SHIFT 26#define XGMAC_TDES3_TCMSSV BIT(26) +#define XGMAC_TDES3_SAIC GENMASK(25, 23) +#define XGMAC_TDES3_SAIC_SHIFT 23#define XGMAC_TDES3_THL GENMASK(22, 19)#define XGMAC_TDES3_THL_SHIFT 19#define XGMAC_TDES3_TSE BIT(18)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +11 -0
@@ -1082,6 +1082,16 @@ static int dwxgmac2_flex_pps_config(void __iomem *ioaddr, int index,return 0 ; } +static void dwxgmac2_sarc_configure (void __iomem *ioaddr,int val) +{ +u32 value =readl (ioaddr +XGMAC_TX_CONFIG ); + + value &= ~XGMAC_CONFIG_SARC ; + value |= val <<XGMAC_CONFIG_SARC_SHIFT ; + +writel (value, ioaddr +XGMAC_TX_CONFIG ); +} +const struct stmmac_ops dwxgmac210_ops = { .core_init = dwxgmac2_core_init, .set_mac = dwxgmac2_set_mac,
@@ -1120,6 +1130,7 @@ const struct stmmac_ops dwxgmac210_ops = { .rxp_config = dwxgmac3_rxp_config, .get_mac_tx_timestamp = dwxgmac2_get_mac_tx_timestamp, .flex_pps_config = dwxgmac2_flex_pps_config, + .sarc_configure = dwxgmac2_sarc_configure, };int dwxgmac2_setup (struct stmmac_priv *priv)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c +9 -1
@@ -149,7 +149,7 @@ static void dwxgmac2_prepare_tx_desc(struct dma_desc *p, int is_fs, int len, p->des2 |=cpu_to_le32 (len &XGMAC_TDES2_B1L ); - tdes3 = tot_pkt_len &XGMAC_TDES3_FL ; + tdes3 |= tot_pkt_len &XGMAC_TDES3_FL ;if (is_fs) tdes3 |=XGMAC_TDES3_FD ;else
@@ -299,6 +299,13 @@ static void dwxgmac2_set_sec_addr(struct dma_desc *p, dma_addr_t addr) p->des3 =cpu_to_le32 (upper_32_bits (addr)); } +static void dwxgmac2_set_sarc (struct dma_desc *p,u32 sarc_type) +{ + sarc_type <<=XGMAC_TDES3_SAIC_SHIFT ; + + p->des3 |=cpu_to_le32 (sarc_type &XGMAC_TDES3_SAIC ); +} +const struct stmmac_desc_ops dwxgmac210_desc_ops = { .tx_status = dwxgmac2_get_tx_status, .rx_status = dwxgmac2_get_rx_status,
@@ -325,4 +332,5 @@ const struct stmmac_desc_ops dwxgmac210_desc_ops = { .get_rx_hash = dwxgmac2_get_rx_hash, .get_rx_header_len = dwxgmac2_get_rx_header_len, .set_sec_addr = dwxgmac2_set_sec_addr, + .set_sarc = dwxgmac2_set_sarc, };
drivers/net/ethernet/stmicro/stmmac/hwif.h +7 -0
@@ -91,6 +91,7 @@ struct stmmac_desc_ops { enum pkt_hash_types *type);int (*get_rx_header_len)(struct dma_desc *p,unsigned int *len);void (*set_sec_addr)(struct dma_desc *p,dma_addr_t addr); +void (*set_sarc)(struct dma_desc *p,u32 sarc_type); }; #define stmmac_init_rx_desc(__priv, __args...) \
@@ -147,6 +148,8 @@ struct stmmac_desc_ops { stmmac_do_callback(__priv, desc, get_rx_header_len, __args) #define stmmac_set_desc_sec_addr(__priv, __args...) \ stmmac_do_void_callback(__priv, desc, set_sec_addr, __args) +#define stmmac_set_desc_sarc(__priv, __args...) \ + stmmac_do_void_callback(__priv, desc, set_sarc, __args)struct stmmac_dma_cfg ;struct dma_features ;
@@ -350,6 +353,8 @@ struct stmmac_ops { bool is_double);/* TX Timestamp */ int (*get_mac_tx_timestamp)(struct mac_device_info *hw,u64 *ts); +/* Source Address Insertion / Replacement */ +void (*sarc_configure)(void __iomem *ioaddr,int val); }; #define stmmac_core_init(__priv, __args...) \
@@ -426,6 +431,8 @@ struct stmmac_ops { stmmac_do_void_callback(__priv, mac, update_vlan_hash, __args) #define stmmac_get_mac_tx_timestamp(__priv, __args...) \ stmmac_do_callback(__priv, mac, get_mac_tx_timestamp, __args) +#define stmmac_sarc_configure(__priv, __args...) \ + stmmac_do_void_callback(__priv, mac, sarc_configure, __args)/* PTP and HW Timer helpers */ struct stmmac_hwtimestamp {
drivers/net/ethernet/stmicro/stmmac/stmmac.h +1 -0
@@ -139,6 +139,7 @@ struct stmmac_priv {bool tx_path_in_lpi_mode;bool tso;int sph; +u32 sarc_type;unsigned int dma_buf_sz;unsigned int rx_copybreak;
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +6 -0
@@ -3010,6 +3010,9 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) priv->xstats.tx_set_ic_bit++; } +if (priv->sarc_type) +stmmac_set_desc_sarc (priv, first, priv->sarc_type); +skb_tx_timestamp (skb); if (unlikely((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
@@ -3223,6 +3226,9 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) priv->xstats.tx_set_ic_bit++; } +if (priv->sarc_type) +stmmac_set_desc_sarc (priv, first, priv->sarc_type); +skb_tx_timestamp (skb);/* Ready to fill the first descriptor and set the OWN bit w/o any
Signature · 1 line
2.7.4
PATCH 19/26 net: stmmac: Add ethtool register dump for XGMAC cores
In reply to Jose AbreuAdd the ethtool interface to dump the register map in XGMAC cores.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 2 ++ .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 11 +++++++++- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 10 ++++++++- .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 24 ++++++++++++++++------ 4 files changed, 39 insertions(+), 8 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +2 -0
@@ -244,6 +244,7 @@#define XGMAC_RXOVFIS BIT(16)#define XGMAC_ABPSIS BIT(1)#define XGMAC_TXUNFIS BIT(0) +#define XGMAC_MAC_REGSIZE (XGMAC_MTL_QINT_STATUS(15) / 4)/* DMA Registers */ #define XGMAC_DMA_MODE 0x00003000
@@ -321,6 +322,7 @@#define XGMAC_TBU BIT(2)#define XGMAC_TPS BIT(1)#define XGMAC_TI BIT(0) +#define XGMAC_REGSIZE ((0x0000317c + (0x80 * 15)) / 4)/* Descriptors */ #define XGMAC_TDES2_IOC BIT(31)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +10 -1
@@ -239,6 +239,15 @@ static void dwxgmac2_config_cbs(struct mac_device_info *hw,writel (value, ioaddr +XGMAC_MTL_TCx_ETS_CONTROL (queue)); } +static void dwxgmac2_dump_regs (struct mac_device_info *hw,u32 *reg_space) +{ +void __iomem *ioaddr = hw->pcsr; +int i; + +for (i =0 ; i <XGMAC_MAC_REGSIZE ; i++) + reg_space[i] =readl (ioaddr + i *4 ); +} +static int dwxgmac2_host_irq_status (struct mac_device_info *hw,struct stmmac_extra_stats *x) {
@@ -1086,7 +1095,7 @@ const struct stmmac_ops dwxgmac210_ops = { .set_mtl_tx_queue_weight = dwxgmac2_set_mtl_tx_queue_weight, .map_mtl_to_dma = dwxgmac2_map_mtl_to_dma, .config_cbs = dwxgmac2_config_cbs, - .dump_regs = NULL, + .dump_regs = dwxgmac2_dump_regs, .host_irq_status = dwxgmac2_host_irq_status, .host_mtl_irq_status = dwxgmac2_host_mtl_irq_status, .flow_ctrl = dwxgmac2_flow_ctrl,
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +9 -1
@@ -128,6 +128,14 @@ static void dwxgmac2_dma_axi(void __iomem *ioaddr, struct stmmac_axi *axi)writel (XGMAC_RDPS , ioaddr +XGMAC_RX_EDMA_CTRL ); } +static void dwxgmac2_dma_dump_regs (void __iomem *ioaddr,u32 *reg_space) +{ +int i; + +for (i = (XGMAC_DMA_MODE /4 ); i <XGMAC_REGSIZE ; i++) + reg_space[i] =readl (ioaddr + i *4 ); +} +static void dwxgmac2_dma_rx_mode (void __iomem *ioaddr,int mode,u32 channel,int fifosz,u8 qmode) {
@@ -496,7 +504,7 @@ const struct stmmac_dma_ops dwxgmac210_dma_ops = { .init_rx_chan = dwxgmac2_dma_init_rx_chan, .init_tx_chan = dwxgmac2_dma_init_tx_chan, .axi = dwxgmac2_dma_axi, - .dump_regs = NULL, + .dump_regs = dwxgmac2_dma_dump_regs, .dma_rx_mode = dwxgmac2_dma_rx_mode, .dma_tx_mode = dwxgmac2_dma_tx_mode, .enable_dma_irq = dwxgmac2_enable_dma_irq,
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +18 -6
@@ -18,10 +18,12 @@#include "stmmac.h" #include "dwmac_dma.h" +#include "dwxgmac2.h" #define REG_SPACE_SIZE 0x1060#define MAC100_ETHTOOL_NAME "st_mac100"#define GMAC_ETHTOOL_NAME "st_gmac" +#define XGMAC_ETHTOOL_NAME "st_xgmac"#define ETHTOOL_DMA_OFFSET 55
@@ -259,6 +261,8 @@ static void stmmac_ethtool_getdrvinfo(struct net_device *dev,if (priv->plat->has_gmac || priv->plat->has_gmac4)strlcpy (info->driver,GMAC_ETHTOOL_NAME ,sizeof (info->driver)); +else if (priv->plat->has_xgmac) +strlcpy (info->driver,XGMAC_ETHTOOL_NAME ,sizeof (info->driver));else strlcpy (info->driver,MAC100_ETHTOOL_NAME ,sizeof (info->driver));
@@ -404,23 +408,31 @@ static int stmmac_check_if_running(struct net_device *dev)static int stmmac_ethtool_get_regs_len (struct net_device *dev) { +struct stmmac_priv *priv =netdev_priv (dev); + +if (priv->plat->has_xgmac) +return XGMAC_REGSIZE *4 ;return REG_SPACE_SIZE ; }static void stmmac_ethtool_gregs (struct net_device *dev,struct ethtool_regs *regs,void *space) { -u32 *reg_space = (u32 *) space; -struct stmmac_priv *priv =netdev_priv (dev); +int size =stmmac_ethtool_get_regs_len (dev); +u32 *reg_space = (u32 *) space; -memset (reg_space,0x0 ,REG_SPACE_SIZE ); +memset (reg_space,0x0 , size);stmmac_dump_mac_regs (priv, priv->hw, reg_space);stmmac_dump_dma_regs (priv, priv->ioaddr, reg_space); -/* Copy DMA registers to where ethtool expects them */ -memcpy (®_space[ETHTOOL_DMA_OFFSET ], ®_space[DMA_BUS_MODE /4 ], -NUM_DWMAC1000_DMA_REGS *4 ); + +if (!priv->plat->has_xgmac) { +/* Copy DMA registers to where ethtool expects them */ +memcpy (®_space[ETHTOOL_DMA_OFFSET ], + ®_space[DMA_BUS_MODE /4 ], +NUM_DWMAC1000_DMA_REGS *4 ); + } }static int stmmac_nway_reset (struct net_device *dev)
Signature · 1 line
2.7.4
PATCH 1/26 net: stmmac: xgmac: Fix XGMAC selftests
In reply to Jose AbreuFixup the XGMAC selftests by correctly finishing the implementation of set_filter callback.
Result:
$ ethtool -t enp4s0 The test result is PASS The test extra info: 1. MAC Loopback 0 2. PHY Loopback -95 3. MMC Counters -95 4. EEE -95 5. Hash Filter MC 0 6. Perfect Filter UC 0 7. MC Filter 0 8. UC Filter 0 9. Flow Control 0
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 7 +- .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 83 +++++++++++++++++++--- 2 files changed, 79 insertions(+), 11 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +5 -2
@@ -44,11 +44,13 @@#define XGMAC_CORE_INIT_RX 0#define XGMAC_PACKET_FILTER 0x00000008#define XGMAC_FILTER_RA BIT(31) +#define XGMAC_FILTER_HPF BIT(10)#define XGMAC_FILTER_PCF BIT(7)#define XGMAC_FILTER_PM BIT(4)#define XGMAC_FILTER_HMC BIT(2)#define XGMAC_FILTER_PR BIT(0)#define XGMAC_HASH_TABLE (x) (0x00000010 + (x) * 4) +#define XGMAC_MAX_HASH_TABLE 8#define XGMAC_RXQ_CTRL0 0x000000a0#define XGMAC_RXQEN (x) GENMASK((x) * 2 + 1, (x) * 2)#define XGMAC_RXQEN_SHIFT (x) ((x) * 2)
@@ -99,11 +101,12 @@#define XGMAC_MDIO_ADDR 0x00000200#define XGMAC_MDIO_DATA 0x00000204#define XGMAC_MDIO_C22P 0x00000220 -#define XGMAC_ADDR0_HIGH 0x00000300 +#define XGMAC_ADDRx_HIGH (x) (0x00000300 + (x) * 0x8) +#define XGMAC_ADDR_MAX 32#define XGMAC_AE BIT(31)#define XGMAC_DCS GENMASK(19, 16)#define XGMAC_DCS_SHIFT 16 -#define XGMAC_ADDR0_LOW 0x00000304 +#define XGMAC_ADDRx_LOW (x) (0x00000304 + (x) * 0x8)#define XGMAC_ARP_ADDR 0x00000c10#define XGMAC_TIMESTAMP_STATUS 0x00000d20#define XGMAC_TXTSC BIT(15)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +74 -9
117 lines not on this page · raw message
Signature · 7 lines
2.7.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 6/26 net: stmmac: Implement RSS and enable it in XGMAC core
In reply to Jose AbreuImplement the RSS functionality and add the corresponding callbacks in XGMAC core.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/common.h | 5 ++ drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 18 +++++- .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 52 +++++++++++++++ .../net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | 29 +++++++++ drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 1 + drivers/net/ethernet/stmicro/stmmac/hwif.h | 11 ++++ drivers/net/ethernet/stmicro/stmmac/stmmac.h | 9 +++ .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 75 ++++++++++++++++++++++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 38 ++++++++++- include/linux/stmmac.h | 1 + 10 files changed, 236 insertions(+), 3 deletions(-)
drivers/net/ethernet/stmicro/stmmac/common.h +5 -0
@@ -354,6 +354,7 @@ struct dma_features {unsigned int frpbs;unsigned int frpes;unsigned int addr64; +unsigned int rssen; };/* GMAC TX FIFO is 8K, Rx FIFO is 16K */
@@ -381,6 +382,10 @@ struct dma_features {#define JUMBO_LEN 9000 +/* Receive Side Scaling */ +#define STMMAC_RSS_HASH_KEY_SIZE 40 +#define STMMAC_RSS_MAX_TABLE_SIZE 256 +extern const struct stmmac_desc_ops enh_desc_ops;extern const struct stmmac_desc_ops ndesc_ops;
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +17 -1
@@ -89,6 +89,7 @@#define XGMAC_HWFEAT_RWKSEL BIT(6)#define XGMAC_HWFEAT_GMIISEL BIT(1)#define XGMAC_HW_FEATURE1 0x00000120 +#define XGMAC_HWFEAT_RSSEN BIT(20)#define XGMAC_HWFEAT_TSOEN BIT(18)#define XGMAC_HWFEAT_ADDR64 GENMASK(15, 14)#define XGMAC_HWFEAT_TXFIFOSIZE GENMASK(10, 6)
@@ -109,6 +110,17 @@#define XGMAC_DCS_SHIFT 16#define XGMAC_ADDRx_LOW (x) (0x00000304 + (x) * 0x8)#define XGMAC_ARP_ADDR 0x00000c10 +#define XGMAC_RSS_CTRL 0x00000c80 +#define XGMAC_UDP4TE BIT(3) +#define XGMAC_TCP4TE BIT(2) +#define XGMAC_IP2TE BIT(1) +#define XGMAC_RSSE BIT(0) +#define XGMAC_RSS_ADDR 0x00000c88 +#define XGMAC_RSSIA_SHIFT 8 +#define XGMAC_ADDRT BIT(2) +#define XGMAC_CT BIT(1) +#define XGMAC_OB BIT(0) +#define XGMAC_RSS_DATA 0x00000c8c#define XGMAC_TIMESTAMP_STATUS 0x00000d20#define XGMAC_TXTSC BIT(15)#define XGMAC_TXTIMESTAMP_NSEC 0x00000d30
@@ -125,8 +137,9 @@#define XGMAC_MTL_INT_STATUS 0x00001020#define XGMAC_MTL_RXQ_DMA_MAP0 0x00001030#define XGMAC_MTL_RXQ_DMA_MAP1 0x00001034 -#define XGMAC_QxMDMACH (x) GENMASK((x) * 8 + 3, (x) * 8) +#define XGMAC_QxMDMACH (x) GENMASK((x) * 8 + 7, (x) * 8)#define XGMAC_QxMDMACH_SHIFT (x) ((x) * 8) +#define XGMAC_QDDMACH BIT(7)#define XGMAC_TC_PRTY_MAP0 0x00001040#define XGMAC_TC_PRTY_MAP1 0x00001044#define XGMAC_PSTC (x) GENMASK((x) * 8 + 7, (x) * 8)
@@ -261,6 +274,9 @@#define XGMAC_RDES3_IOC BIT(30)#define XGMAC_RDES3_LD BIT(28)#define XGMAC_RDES3_CDA BIT(27) +#define XGMAC_RDES3_RSV BIT(26) +#define XGMAC_RDES3_L34T GENMASK(23, 20) +#define XGMAC_RDES3_L34T_SHIFT 20#define XGMAC_RDES3_ES BIT(15)#define XGMAC_RDES3_PL GENMASK(13, 0)#define XGMAC_RDES3_TSD BIT(6)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +52 -0
70 lines not on this page · raw message
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c +29 -0
@@ -254,6 +254,34 @@ static void dwxgmac2_clear(struct dma_desc *p) p->des3 =0 ; } +static int dwxgmac2_get_rx_hash (struct dma_desc *p,u32 *hash, +enum pkt_hash_types *type) +{ +unsigned int rdes3 =le32_to_cpu (p->des3); +u32 ptype; + +if (rdes3 &XGMAC_RDES3_RSV ) { + ptype = (rdes3 &XGMAC_RDES3_L34T ) >>XGMAC_RDES3_L34T_SHIFT ; + +switch (ptype) { +case 0x1 : +case 0x2 : +case 0x9 : +case 0xA : + *type =PKT_HASH_TYPE_L4 ; +break ; +default : + *type =PKT_HASH_TYPE_L3 ; +break ; + } + + *hash =le32_to_cpu (p->des1); +return 0 ; + } + +return -EINVAL ; +} +const struct stmmac_desc_ops dwxgmac210_desc_ops = { .tx_status = dwxgmac2_get_tx_status, .rx_status = dwxgmac2_get_rx_status,
@@ -277,4 +305,5 @@ const struct stmmac_desc_ops dwxgmac210_desc_ops = { .get_addr = dwxgmac2_get_addr, .set_addr = dwxgmac2_set_addr, .clear = dwxgmac2_clear, + .get_rx_hash = dwxgmac2_get_rx_hash, };
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +1 -0
@@ -363,6 +363,7 @@ static void dwxgmac2_get_hw_feature(void __iomem *ioaddr,/* MAC HW feature 1 */ hw_cap =readl (ioaddr +XGMAC_HW_FEATURE1 ); + dma_cap->rssen = (hw_cap &XGMAC_HWFEAT_RSSEN ) >>20 ; dma_cap->tsoen = (hw_cap &XGMAC_HWFEAT_TSOEN ) >>18 ; dma_cap->addr64 = (hw_cap &XGMAC_HWFEAT_ADDR64 ) >>14 ;
drivers/net/ethernet/stmicro/stmmac/hwif.h +11 -0
@@ -86,6 +86,9 @@ struct stmmac_desc_ops {void (*set_addr)(struct dma_desc *p,dma_addr_t addr);/* clear descriptor */ void (*clear)(struct dma_desc *p); +/* RSS */ +int (*get_rx_hash)(struct dma_desc *p,u32 *hash, +enum pkt_hash_types *type); }; #define stmmac_init_rx_desc(__priv, __args...) \
@@ -136,6 +139,8 @@ struct stmmac_desc_ops { stmmac_do_void_callback(__priv, desc, set_addr, __args) #define stmmac_clear_desc(__priv, __args...) \ stmmac_do_void_callback(__priv, desc, clear, __args) +#define stmmac_get_rx_hash(__priv, __args...) \ + stmmac_do_callback(__priv, desc, get_rx_hash, __args)struct stmmac_dma_cfg ;struct dma_features ;
@@ -249,6 +254,7 @@ struct rgmii_adv;struct stmmac_safety_stats ;struct stmmac_tc_entry ;struct stmmac_pps_cfg ; +struct stmmac_rss ;/* Helpers to program the MAC core */ struct stmmac_ops {
@@ -327,6 +333,9 @@ struct stmmac_ops { u32 sub_second_inc, u32 systime_flags);/* Loopback for selftests */ void (*set_mac_loopback)(void __iomem *ioaddr,bool enable); +/* RSS */ +int (*rss_configure)(struct mac_device_info *hw, +struct stmmac_rss *cfg,u32 num_rxq); }; #define stmmac_core_init(__priv, __args...) \
@@ -397,6 +406,8 @@ struct stmmac_ops { stmmac_do_callback(__priv, mac, flex_pps_config, __args) #define stmmac_set_mac_loopback(__priv, __args...) \ stmmac_do_void_callback(__priv, mac, set_mac_loopback, __args) +#define stmmac_rss_configure(__priv, __args...) \ + stmmac_do_callback(__priv, mac, rss_configure, __args)/* PTP and HW Timer helpers */ struct stmmac_hwtimestamp {
drivers/net/ethernet/stmicro/stmmac/stmmac.h +9 -0
@@ -113,6 +113,12 @@ struct stmmac_pps_cfg {struct timespec64 period; }; +struct stmmac_rss { +int enable; +u8 key[STMMAC_RSS_HASH_KEY_SIZE ]; +u32 table[STMMAC_RSS_MAX_TABLE_SIZE ]; +}; +struct stmmac_priv {/* Frequently used values are kept adjacent for cache effect */ u32 tx_coal_frames;
@@ -203,6 +209,9 @@ struct stmmac_priv {/* Pulse Per Second output */ struct stmmac_pps_cfg pps[STMMAC_PPS_MAX ]; + +/* Receive Side Scaling */ +struct stmmac_rss rss; };enum stmmac_state {
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +75 -0
87 lines not on this page · raw message
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +36 -2
@@ -2423,6 +2423,22 @@ static void stmmac_mac_config_rx_queues_routing(struct stmmac_priv *priv) } } +static void stmmac_mac_config_rss (struct stmmac_priv *priv) +{ +if (!priv->dma_cap.rssen || !priv->plat->rss_en) { + priv->rss.enable = false; +return ; + } + +if (priv->dev->features &NETIF_F_RXHASH ) + priv->rss.enable = true; +else + priv->rss.enable = false; + +stmmac_rss_configure (priv, priv->hw, &priv->rss, + priv->plat->rx_queues_to_use); +} +/** * stmmac_mtl_configuration - Configure MTL * @priv: driver private structure
@@ -2467,6 +2483,10 @@ static void stmmac_mtl_configuration(struct stmmac_priv *priv)/* Set RX routing */ if (rx_queues_count >1 )stmmac_mac_config_rx_queues_routing (priv); + +/* Receive Side Scaling */ +if (rx_queues_count >1 ) +stmmac_mac_config_rss (priv); }static void stmmac_safety_feat_configuration (struct stmmac_priv *priv)
@@ -3391,9 +3411,11 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) priv->dev->stats.rx_errors++; buf->page =NULL ; }else { +enum pkt_hash_types hash_type;struct sk_buff *skb; -int frame_len;unsigned int des; +int frame_len; +u32 hash;stmmac_get_desc_addr (priv, p, &des); frame_len =stmmac_get_rx_frame_len (priv, p, coe);
@@ -3458,6 +3480,10 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)else skb->ip_summed =CHECKSUM_UNNECESSARY ; +if (!stmmac_get_rx_hash (priv, p, &hash, &hash_type)) +skb_set_hash (skb, hash, hash_type); + +skb_record_rx_queue (skb, queue);napi_gro_receive (&ch->rx_napi, skb);/* Data payload copied into SKB, page ready for recycle */
@@ -4182,7 +4208,7 @@ int stmmac_dvr_probe(struct device *device,struct net_device *ndev =NULL ;struct stmmac_priv *priv;u32 queue, maxq; -int ret =0 ; +int i, ret =0 ; ndev =devm_alloc_etherdev_mqs (device,sizeof (struct stmmac_priv ),MTL_MAX_TX_QUEUES ,MTL_MAX_RX_QUEUES );
@@ -4290,6 +4316,14 @@ int stmmac_dvr_probe(struct device *device,#endif priv->msg_enable =netif_msg_init (debug, default_msg_level); +/* Initialize RSS */ +netdev_rss_key_fill (priv->rss.key,sizeof (priv->rss.key)); +for (i =0 ; i <ARRAY_SIZE (priv->rss.table); i++) + priv->rss.table[i] = i % priv->plat->rx_queues_to_use; + +if (priv->dma_cap.rssen && priv->plat->rss_en) + ndev->features |=NETIF_F_RXHASH ; +/* MTU range: 46 - hw-specific max */ ndev->min_mtu =ETH_ZLEN -ETH_HLEN ;if ((priv->plat->enh_desc) || (priv->synopsys_id >=DWMAC_CORE_4_00 ))
include/linux/stmmac.h +1 -0
@@ -173,6 +173,7 @@ struct plat_stmmacenet_data {int has_gmac4;bool has_sun8i;bool tso_en; +int rss_en;int mac_port_sel_speed;bool en_tx_lpi_clockgating;int has_xgmac;
Signature · 1 line
2.7.4
PATCH 18/26 net: stmmac: dwxgmac: Add Flexible PPS support
In reply to Jose AbreuAdd the support for Flexible PPS in XGMAC cores.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 19 ++++++++ .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 56 ++++++++++++++++++++++ 2 files changed, 75 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +19 -0
@@ -149,6 +149,25 @@#define XGMAC_TXTIMESTAMP_NSEC 0x00000d30#define XGMAC_TXTSSTSLO GENMASK(30, 0)#define XGMAC_TXTIMESTAMP_SEC 0x00000d34 +#define XGMAC_PPS_CONTROL 0x00000d70 +#define XGMAC_PPS_MAXIDX (x) ((((x) + 1) * 8) - 1) +#define XGMAC_PPS_MINIDX (x) ((x) * 8) +#define XGMAC_PPSx_MASK (x) \ + GENMASK(XGMAC_PPS_MAXIDX(x), XGMAC_PPS_MINIDX(x)) +#define XGMAC_TRGTMODSELx (x, val) \ + GENMASK(XGMAC_PPS_MAXIDX(x) - 1, XGMAC_PPS_MAXIDX(x) - 2) & \ + ((val) << (XGMAC_PPS_MAXIDX(x) - 2)) +#define XGMAC_PPSCMDx (x, val) \ + GENMASK(XGMAC_PPS_MINIDX(x) + 3, XGMAC_PPS_MINIDX(x)) & \ + ((val) << XGMAC_PPS_MINIDX(x)) +#define XGMAC_PPSCMD_START 0x2 +#define XGMAC_PPSCMD_STOP 0x5 +#define XGMAC_PPSEN0 BIT(4) +#define XGMAC_PPSx_TARGET_TIME_SEC (x) (0x00000d80 + (x) * 0x10) +#define XGMAC_PPSx_TARGET_TIME_NSEC (x) (0x00000d84 + (x) * 0x10) +#define XGMAC_TRGTBUSY0 BIT(31) +#define XGMAC_PPSx_INTERVAL (x) (0x00000d88 + (x) * 0x10) +#define XGMAC_PPSx_WIDTH (x) (0x00000d8c + (x) * 0x10)/* MTL Registers */ #define XGMAC_MTL_OPMODE 0x00001000
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +56 -0
74 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 16/26 net: stmmac: xgmac: Correctly return that RX descriptor is not last one
In reply to Jose AbreuReturn the correct value when RX descriptor is not the last one.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c +3 -4
@@ -26,16 +26,15 @@ static int dwxgmac2_get_rx_status(void *data, struct stmmac_extra_stats *x, struct dma_desc *p) {unsigned int rdes3 =le32_to_cpu (p->des3); -int ret = good_frame;if (unlikely (rdes3 &XGMAC_RDES3_OWN ))return dma_own;if (likely (!(rdes3 &XGMAC_RDES3_LD ))) +return rx_not_ls; +if (unlikely ((rdes3 &XGMAC_RDES3_ES ) && (rdes3 &XGMAC_RDES3_LD )))return discard_frame; -if (unlikely (rdes3 &XGMAC_RDES3_ES )) - ret = discard_frame; -return ret; +return good_frame; }static int dwxgmac2_get_tx_len (struct dma_desc *p)
Signature · 7 lines
2.7.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 14/26 net: stmmac: Get correct timestamp values from XGMAC
In reply to Jose AbreuTX Timestamp in XGMAC comes from MAC instead of descriptors. Implement this in a new callback.
Also, RX Timestamp in XGMAC must be cheked against corruption and we need a barrier to make sure that descriptor fields are read correctly.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 22 ++++++++++++++++++++++ .../net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | 18 +++++++++++------- drivers/net/ethernet/stmicro/stmmac/hwif.h | 4 ++++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 ++++++--- 4 files changed, 43 insertions(+), 10 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +22 -0
@@ -997,6 +997,27 @@ static int dwxgmac3_rxp_config(void __iomem *ioaddr,return ret; } +static int dwxgmac2_get_mac_tx_timestamp (struct mac_device_info *hw,u64 *ts) +{ +void __iomem *ioaddr = hw->pcsr; +int count =0 ; +u32 value; + +do { +if (readl_poll_timeout_atomic (ioaddr +XGMAC_TIMESTAMP_STATUS , + value, value &XGMAC_TXTSC , +100 ,10000 )) +break ; + + *ts =readl (ioaddr +XGMAC_TXTIMESTAMP_NSEC ) &XGMAC_TXTSSTSLO ; + *ts +=readl (ioaddr +XGMAC_TXTIMESTAMP_SEC ) *1000000000ULL ; + }while (count++); + +if (count) +return 0 ; +return -EBUSY ; +} +const struct stmmac_ops dwxgmac210_ops = { .core_init = dwxgmac2_core_init, .set_mac = dwxgmac2_set_mac,
@@ -1033,6 +1054,7 @@ const struct stmmac_ops dwxgmac210_ops = { .rss_configure = dwxgmac2_rss_configure, .update_vlan_hash = dwxgmac2_update_vlan_hash, .rxp_config = dwxgmac3_rxp_config, + .get_mac_tx_timestamp = dwxgmac2_get_mac_tx_timestamp, };int dwxgmac2_setup (struct stmmac_priv *priv)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c +11 -7
@@ -98,11 +98,17 @@ static int dwxgmac2_rx_check_timestamp(void *desc)unsigned int rdes3 =le32_to_cpu (p->des3);bool desc_valid, ts_valid; +dma_rmb (); + desc_valid = !(rdes3 &XGMAC_RDES3_OWN ) && (rdes3 &XGMAC_RDES3_CTXT ); ts_valid = !(rdes3 &XGMAC_RDES3_TSD ) && (rdes3 &XGMAC_RDES3_TSA ); -if (likely (desc_valid && ts_valid)) +if (likely (desc_valid && ts_valid)) { +if ((p->des0 ==0xffffffff ) && (p->des1 ==0xffffffff )) +return -EINVAL ;return 0 ; + } +return -EINVAL ; }
@@ -113,13 +119,11 @@ static int dwxgmac2_get_rx_timestamp_status(void *desc, void *next_desc,unsigned int rdes3 =le32_to_cpu (p->des3);int ret = -EBUSY ; -if (likely (rdes3 &XGMAC_RDES3_CDA )) { +if (likely (rdes3 &XGMAC_RDES3_CDA )) ret =dwxgmac2_rx_check_timestamp (next_desc); -if (ret) -return ret; - } - -return ret; +if (!ret) +return 1 ; +return 0 ; } static void dwxgmac2_init_rx_desc(struct dma_desc *p, int disable_rx_ic,
drivers/net/ethernet/stmicro/stmmac/hwif.h +4 -0
@@ -339,6 +339,8 @@ struct stmmac_ops {/* VLAN */ void (*update_vlan_hash)(struct mac_device_info *hw,u32 hash,bool is_double); +/* TX Timestamp */ +int (*get_mac_tx_timestamp)(struct mac_device_info *hw,u64 *ts); }; #define stmmac_core_init(__priv, __args...) \
@@ -413,6 +415,8 @@ struct stmmac_ops { stmmac_do_callback(__priv, mac, rss_configure, __args) #define stmmac_update_vlan_hash(__priv, __args...) \ stmmac_do_void_callback(__priv, mac, update_vlan_hash, __args) +#define stmmac_get_mac_tx_timestamp(__priv, __args...) \ + stmmac_do_callback(__priv, mac, get_mac_tx_timestamp, __args)/* PTP and HW Timer helpers */ struct stmmac_hwtimestamp {
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +6 -3
@@ -432,6 +432,7 @@ static void stmmac_get_tx_hwtstamp(struct stmmac_priv *priv, struct dma_desc *p, struct sk_buff *skb) { struct skb_shared_hwtstamps shhwtstamp; +bool found = false;u64 ns =0 ;if (!priv->hwts_tx_en)
@@ -443,9 +444,13 @@ static void stmmac_get_tx_hwtstamp(struct stmmac_priv *priv,/* check tx tstamp status */ if (stmmac_get_tx_timestamp_status (priv, p)) { -/* get the valid tstamp */ stmmac_get_timestamp (priv, p, priv->adv_ts, &ns); + found = true; + }else if (!stmmac_get_mac_tx_timestamp (priv, priv->hw, &ns)) { + found = true; + } +if (found) {memset (&shhwtstamp,0 ,sizeof (struct skb_shared_hwtstamps )); shhwtstamp.hwtstamp =ns_to_ktime (ns);
@@ -453,8 +458,6 @@ static void stmmac_get_tx_hwtstamp(struct stmmac_priv *priv,/* pass tstamp to stack */ skb_tstamp_tx (skb, &shhwtstamp); } - -return ; }/* stmmac_get_rx_hwtstamp - get HW RX timestamps
Signature · 1 line
2.7.4
PATCH 10/26 net: stmmac: Implement Safety Features in XGMAC core
In reply to Jose AbreuXGMAC also supports Safety Features. This patch implements the configuration and handling of this feature in XGMAC core.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 26 ++ .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 281 +++++++++++++++++++++ drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 4 + 3 files changed, 311 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +26 -0
@@ -110,6 +110,12 @@#define XGMAC_HWFEAT_RXCHCNT GENMASK(15, 12)#define XGMAC_HWFEAT_TXQCNT GENMASK(9, 6)#define XGMAC_HWFEAT_RXQCNT GENMASK(3, 0) +#define XGMAC_HW_FEATURE3 0x00000128 +#define XGMAC_HWFEAT_ASP GENMASK(15, 14) +#define XGMAC_MAC_DPP_FSM_INT_STATUS 0x00000150 +#define XGMAC_MAC_FSM_CONTROL 0x00000158 +#define XGMAC_PRTYEN BIT(1) +#define XGMAC_TMOUTEN BIT(0)#define XGMAC_MDIO_ADDR 0x00000200#define XGMAC_MDIO_DATA 0x00000204#define XGMAC_MDIO_C22P 0x00000220
@@ -154,6 +160,16 @@#define XGMAC_TC_PRTY_MAP1 0x00001044#define XGMAC_PSTC (x) GENMASK((x) * 8 + 7, (x) * 8)#define XGMAC_PSTC_SHIFT (x) ((x) * 8) +#define XGMAC_MTL_ECC_CONTROL 0x000010c0 +#define XGMAC_MTL_SAFETY_INT_STATUS 0x000010c4 +#define XGMAC_MEUIS BIT(1) +#define XGMAC_MECIS BIT(0) +#define XGMAC_MTL_ECC_INT_ENABLE 0x000010c8 +#define XGMAC_RPCEIE BIT(12) +#define XGMAC_ECEIE BIT(8) +#define XGMAC_RXCEIE BIT(4) +#define XGMAC_TXCEIE BIT(0) +#define XGMAC_MTL_ECC_INT_STATUS 0x000010cc#define XGMAC_MTL_TXQ_OPMODE (x) (0x00001100 + (0x80 * (x)))#define XGMAC_TQS GENMASK(25, 16)#define XGMAC_TQS_SHIFT 16
@@ -218,6 +234,16 @@#define XGMAC_TDPS GENMASK(29, 0)#define XGMAC_RX_EDMA_CTRL 0x00003044#define XGMAC_RDPS GENMASK(29, 0) +#define XGMAC_DMA_SAFETY_INT_STATUS 0x00003064 +#define XGMAC_MCSIS BIT(31) +#define XGMAC_MSUIS BIT(29) +#define XGMAC_MSCIS BIT(28) +#define XGMAC_DEUIS BIT(1) +#define XGMAC_DECIS BIT(0) +#define XGMAC_DMA_ECC_INT_ENABLE 0x00003068 +#define XGMAC_DCEIE BIT(1) +#define XGMAC_TCEIE BIT(0) +#define XGMAC_DMA_ECC_INT_STATUS 0x0000306c#define XGMAC_DMA_CH_CONTROL (x) (0x00003100 + (0x80 * (x)))#define XGMAC_PBLx8 BIT(16)#define XGMAC_DMA_CH_TX_CONTROL (x) (0x00003104 + (0x80 * (x)))
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +281 -0
293 lines not on this page · raw message
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +4 -0
@@ -399,6 +399,10 @@ static void dwxgmac2_get_hw_feature(void __iomem *ioaddr, ((hw_cap &XGMAC_HWFEAT_TXQCNT ) >>6 ) +1 ; dma_cap->number_rx_queues = ((hw_cap &XGMAC_HWFEAT_RXQCNT ) >>0 ) +1 ; + +/* MAC HW feature 3 */ + hw_cap =readl (ioaddr +XGMAC_HW_FEATURE3 ); + dma_cap->asp = (hw_cap &XGMAC_HWFEAT_ASP ) >>14 ; }static void dwxgmac2_rx_watchdog (void __iomem *ioaddr,u32 riwt,u32 nchan)
Signature · 1 line
2.7.4
PATCH 9/26 net: stmmac: selftests: Add test for VLAN and Double VLAN Filtering
In reply to Jose AbreuAdd a selftest for VLAN and Double VLAN Filtering in stmmac.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- .../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 205 +++++++++++++++++++++ 1 file changed, 205 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +205 -0
@@ -715,6 +715,203 @@ static int stmmac_test_rss(struct stmmac_priv *priv)return __stmmac_test_loopback (priv, &attr); } +static int stmmac_test_vlan_validate (struct sk_buff *skb, +struct net_device *ndev, +struct packet_type *pt, +struct net_device *orig_ndev) +{ +struct stmmac_test_priv *tpriv = pt->af_packet_priv; +struct stmmachdr *shdr; +struct ethhdr *ehdr; +struct udphdr *uhdr; +struct iphdr *ihdr; + + skb =skb_unshare (skb,GFP_ATOMIC ); +if (!skb) + goto out; + +if (skb_linearize (skb)) + goto out; +if (skb_headlen (skb) < (STMMAC_TEST_PKT_SIZE -ETH_HLEN )) + goto out; + + ehdr = (struct ethhdr *)skb_mac_header (skb); +if (!ether_addr_equal (ehdr->h_dest, tpriv->packet->dst)) + goto out; + + ihdr =ip_hdr (skb); +if (tpriv->double_vlan) + ihdr = (struct iphdr *)(skb_network_header (skb) +4 ); +if (ihdr->protocol !=IPPROTO_UDP ) + goto out; + + uhdr = (struct udphdr *)((u8 *)ihdr +4 * ihdr->ihl); +if (uhdr->dest !=htons (tpriv->packet->dport)) + goto out; + + shdr = (struct stmmachdr *)((u8 *)uhdr +sizeof (*uhdr)); +if (shdr->magic !=cpu_to_be64 (STMMAC_TEST_PKT_MAGIC )) + goto out; + + tpriv->ok = true; +complete (&tpriv->comp); + +out: +kfree_skb (skb); +return 0 ; +} + +static int stmmac_test_vlanfilt (struct stmmac_priv *priv) +{ +struct stmmac_packet_attrs attr = { }; +struct stmmac_test_priv *tpriv; +struct sk_buff *skb =NULL ; +int ret =0 , i; + +if (!priv->dma_cap.vlhash) +return -EOPNOTSUPP ; + + tpriv =kzalloc (sizeof (*tpriv),GFP_KERNEL ); +if (!tpriv) +return -ENOMEM ; + + tpriv->ok = false; +init_completion (&tpriv->comp); + + tpriv->pt.type =htons (ETH_P_IP ); + tpriv->pt.func = stmmac_test_vlan_validate; + tpriv->pt.dev = priv->dev; + tpriv->pt.af_packet_priv = tpriv; + tpriv->packet = &attr; + +/* +* As we use HASH filtering, false positives may appear. This is a +* specially chosen ID so that adjacent IDs (+4) have different +* HASH values. +*/ + tpriv->vlan_id =0x123 ; +dev_add_pack (&tpriv->pt); + + ret =vlan_vid_add (priv->dev,htons (ETH_P_8021Q ), tpriv->vlan_id); +if (ret) + goto cleanup; + +for (i =0 ; i <4 ; i++) { + attr.vlan =1 ; + attr.vlan_id_out = tpriv->vlan_id + i; + attr.dst = priv->dev->dev_addr; + attr.sport =9 ; + attr.dport =9 ; + + skb =stmmac_test_get_udp_skb (priv, &attr); +if (!skb) { + ret = -ENOMEM ; + goto vlan_del; + } + +skb_set_queue_mapping (skb,0 ); + ret =dev_queue_xmit (skb); +if (ret) + goto vlan_del; + +wait_for_completion_timeout (&tpriv->comp,STMMAC_LB_TIMEOUT ); + ret = !tpriv->ok; +if (ret && !i) { + goto vlan_del; + }else if (!ret && i) { + ret =-1 ; + goto vlan_del; + }else { + ret =0 ; + } + + tpriv->ok = false; + } + +vlan_del: +vlan_vid_del (priv->dev,htons (ETH_P_8021Q ), tpriv->vlan_id); +cleanup: +dev_remove_pack (&tpriv->pt); +kfree (tpriv); +return ret; +} + +static int stmmac_test_dvlanfilt (struct stmmac_priv *priv) +{ +struct stmmac_packet_attrs attr = { }; +struct stmmac_test_priv *tpriv; +struct sk_buff *skb =NULL ; +int ret =0 , i; + +if (!priv->dma_cap.vlhash) +return -EOPNOTSUPP ; + + tpriv =kzalloc (sizeof (*tpriv),GFP_KERNEL ); +if (!tpriv) +return -ENOMEM ; + + tpriv->ok = false; + tpriv->double_vlan = true; +init_completion (&tpriv->comp); + + tpriv->pt.type =htons (ETH_P_8021Q ); + tpriv->pt.func = stmmac_test_vlan_validate; + tpriv->pt.dev = priv->dev; + tpriv->pt.af_packet_priv = tpriv; + tpriv->packet = &attr; + +/* +* As we use HASH filtering, false positives may appear. This is a +* specially chosen ID so that adjacent IDs (+4) have different +* HASH values. +*/ + tpriv->vlan_id =0x123 ; +dev_add_pack (&tpriv->pt); + + ret =vlan_vid_add (priv->dev,htons (ETH_P_8021AD ), tpriv->vlan_id); +if (ret) + goto cleanup; + +for (i =0 ; i <4 ; i++) { + attr.vlan =2 ; + attr.vlan_id_out = tpriv->vlan_id + i; + attr.dst = priv->dev->dev_addr; + attr.sport =9 ; + attr.dport =9 ; + + skb =stmmac_test_get_udp_skb (priv, &attr); +if (!skb) { + ret = -ENOMEM ; + goto vlan_del; + } + +skb_set_queue_mapping (skb,0 ); + ret =dev_queue_xmit (skb); +if (ret) + goto vlan_del; + +wait_for_completion_timeout (&tpriv->comp,STMMAC_LB_TIMEOUT ); + ret = !tpriv->ok; +if (ret && !i) { + goto vlan_del; + }else if (!ret && i) { + ret =-1 ; + goto vlan_del; + }else { + ret =0 ; + } + + tpriv->ok = false; + } + +vlan_del: +vlan_vid_del (priv->dev,htons (ETH_P_8021AD ), tpriv->vlan_id); +cleanup: +dev_remove_pack (&tpriv->pt); +kfree (tpriv); +return ret; +} +#define STMMAC_LOOPBACK_NONE 0#define STMMAC_LOOPBACK_MAC 1#define STMMAC_LOOPBACK_PHY 2
@@ -764,6 +961,14 @@ static const struct stmmac_test { .name = "RSS ", .lb = STMMAC_LOOPBACK_PHY, .fn = stmmac_test_rss, + }, { + .name = "VLAN Filtering ", + .lb = STMMAC_LOOPBACK_PHY, + .fn = stmmac_test_vlanfilt, + }, { + .name = "Double VLAN Filtering", + .lb = STMMAC_LOOPBACK_PHY, + .fn = stmmac_test_dvlanfilt, }, };
Signature · 7 lines
2.7.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 2/26 net: stmmac: xgmac: Implement MMC counters
In reply to Jose AbreuImplement the MMC counters feature in XGMAC core.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 1 + drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 1 + drivers/net/ethernet/stmicro/stmmac/hwif.c | 4 +- drivers/net/ethernet/stmicro/stmmac/hwif.h | 1 + drivers/net/ethernet/stmicro/stmmac/mmc.h | 9 + drivers/net/ethernet/stmicro/stmmac/mmc_core.c | 192 +++++++++++++++++++++ .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 6 + 7 files changed, 212 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +1 -0
@@ -84,6 +84,7 @@#define XGMAC_HWFEAT_AVSEL BIT(11)#define XGMAC_HWFEAT_RAVSEL BIT(10)#define XGMAC_HWFEAT_ARPOFFSEL BIT(9) +#define XGMAC_HWFEAT_MMCSEL BIT(8)#define XGMAC_HWFEAT_MGKSEL BIT(7)#define XGMAC_HWFEAT_RWKSEL BIT(6)#define XGMAC_HWFEAT_GMIISEL BIT(1)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +1 -0
@@ -356,6 +356,7 @@ static void dwxgmac2_get_hw_feature(void __iomem *ioaddr, dma_cap->atime_stamp = (hw_cap &XGMAC_HWFEAT_TSSEL ) >>12 ; dma_cap->av = (hw_cap &XGMAC_HWFEAT_AVSEL ) >>11 ; dma_cap->av &= (hw_cap &XGMAC_HWFEAT_RAVSEL ) >>10 ; + dma_cap->rmon = (hw_cap &XGMAC_HWFEAT_MMCSEL ) >>8 ; dma_cap->pmt_magic_frame = (hw_cap &XGMAC_HWFEAT_MGKSEL ) >>7 ; dma_cap->pmt_remote_wake_up = (hw_cap &XGMAC_HWFEAT_RWKSEL ) >>6 ; dma_cap->mbps_1000 = (hw_cap &XGMAC_HWFEAT_GMIISEL ) >>1 ;
drivers/net/ethernet/stmicro/stmmac/hwif.c +2 -2
@@ -201,7 +201,7 @@ static const struct stmmac_hwif_entry { .min_id = DWXGMAC_CORE_2_10, .regs = { .ptp_off = PTP_XGMAC_OFFSET, - .mmc_off = 0, + .mmc_off = MMC_XGMAC_OFFSET, }, .desc = &dwxgmac210_desc_ops, .dma = &dwxgmac210_dma_ops,
@@ -209,7 +209,7 @@ static const struct stmmac_hwif_entry { .hwtimestamp = &stmmac_ptp, .mode = NULL, .tc = &dwmac510_tc_ops, - .mmc = NULL, + .mmc = &dwxgmac_mmc_ops, .setup = dwxgmac2_setup, .quirks = NULL, },
drivers/net/ethernet/stmicro/stmmac/hwif.h +1 -0
@@ -503,6 +503,7 @@ extern const struct stmmac_ops dwxgmac210_ops;extern const struct stmmac_dma_ops dwxgmac210_dma_ops;extern const struct stmmac_desc_ops dwxgmac210_desc_ops;extern const struct stmmac_mmc_ops dwmac_mmc_ops; +extern const struct stmmac_mmc_ops dwxgmac_mmc_ops;#define GMAC_VERSION 0x00000020/* GMAC CORE Version */ #define GMAC4_VERSION 0x00000110/* GMAC4+ CORE Version */
drivers/net/ethernet/stmicro/stmmac/mmc.h +9 -0
@@ -24,6 +24,7 @@#define MMC_GMAC4_OFFSET 0x700#define MMC_GMAC3_X_OFFSET 0x100 +#define MMC_XGMAC_OFFSET 0x800struct stmmac_counters {unsigned int mmc_tx_octetcount_gb;
@@ -116,6 +117,14 @@ struct stmmac_counters {unsigned int mmc_rx_tcp_err_octets;unsigned int mmc_rx_icmp_gd_octets;unsigned int mmc_rx_icmp_err_octets; + +/* FPE */ +unsigned int mmc_tx_fpe_fragment_cntr; +unsigned int mmc_tx_hold_req_cntr; +unsigned int mmc_rx_packet_assembly_err_cntr; +unsigned int mmc_rx_packet_smd_err_cntr; +unsigned int mmc_rx_packet_assembly_ok_cntr; + unsigned int mmc_rx_fpe_fragment_cntr; };#endif /* __MMC_H__ */
drivers/net/ethernet/stmicro/stmmac/mmc_core.c +192 -0
201 lines not on this page · raw message
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +6 -0
@@ -243,6 +243,12 @@ static const struct stmmac_stats stmmac_mmc[] = {STMMAC_MMC_STAT (mmc_rx_tcp_err_octets),STMMAC_MMC_STAT (mmc_rx_icmp_gd_octets),STMMAC_MMC_STAT (mmc_rx_icmp_err_octets), +STMMAC_MMC_STAT (mmc_tx_fpe_fragment_cntr), +STMMAC_MMC_STAT (mmc_tx_hold_req_cntr), +STMMAC_MMC_STAT (mmc_rx_packet_assembly_err_cntr), +STMMAC_MMC_STAT (mmc_rx_packet_smd_err_cntr), +STMMAC_MMC_STAT (mmc_rx_packet_assembly_ok_cntr), + STMMAC_MMC_STAT(mmc_rx_fpe_fragment_cntr), };#define STMMAC_MMC_STATS_LEN ARRAY_SIZE(stmmac_mmc)
Signature · 1 line
2.7.4
PATCH 11/26 net: stmmac: Add Flexible RX Parser support in XGMAC
In reply to Jose AbreuXGMAC cores also support the Flexible RX Parser feature. Add the support for it in the XGMAC core.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 13 ++ .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 190 +++++++++++++++++++++ drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 3 + 3 files changed, 206 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +13 -0
@@ -112,6 +112,9 @@#define XGMAC_HWFEAT_RXQCNT GENMASK(3, 0)#define XGMAC_HW_FEATURE3 0x00000128#define XGMAC_HWFEAT_ASP GENMASK(15, 14) +#define XGMAC_HWFEAT_FRPES GENMASK(12, 11) +#define XGMAC_HWFEAT_FRPPB GENMASK(10, 9) +#define XGMAC_HWFEAT_FRPSEL BIT(3)#define XGMAC_MAC_DPP_FSM_INT_STATUS 0x00000150#define XGMAC_MAC_FSM_CONTROL 0x00000158#define XGMAC_PRTYEN BIT(1)
@@ -145,6 +148,7 @@/* MTL Registers */ #define XGMAC_MTL_OPMODE 0x00001000 +#define XGMAC_FRPE BIT(15)#define XGMAC_ETSALG GENMASK(6, 5)#define XGMAC_WRR (0x0 << 5)#define XGMAC_WFQ (0x1 << 5)
@@ -160,6 +164,15 @@#define XGMAC_TC_PRTY_MAP1 0x00001044#define XGMAC_PSTC (x) GENMASK((x) * 8 + 7, (x) * 8)#define XGMAC_PSTC_SHIFT (x) ((x) * 8) +#define XGMAC_MTL_RXP_CONTROL_STATUS 0x000010a0 +#define XGMAC_RXPI BIT(31) +#define XGMAC_NPE GENMASK(23, 16) +#define XGMAC_NVE GENMASK(7, 0) +#define XGMAC_MTL_RXP_IACC_CTRL_ST 0x000010b0 +#define XGMAC_STARTBUSY BIT(31) +#define XGMAC_WRRDN BIT(16) +#define XGMAC_ADDR GENMASK(9, 0) +#define XGMAC_MTL_RXP_IACC_DATA 0x000010b4#define XGMAC_MTL_ECC_CONTROL 0x000010c0#define XGMAC_MTL_SAFETY_INT_STATUS 0x000010c4#define XGMAC_MEUIS BIT(1)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +190 -0
202 lines not on this page · raw message
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +3 -0
@@ -403,6 +403,9 @@ static void dwxgmac2_get_hw_feature(void __iomem *ioaddr,/* MAC HW feature 3 */ hw_cap =readl (ioaddr +XGMAC_HW_FEATURE3 ); dma_cap->asp = (hw_cap &XGMAC_HWFEAT_ASP ) >>14 ; + dma_cap->frpes = (hw_cap &XGMAC_HWFEAT_FRPES ) >>11 ; + dma_cap->frpbs = (hw_cap &XGMAC_HWFEAT_FRPPB ) >>9 ; + dma_cap->frpsel = (hw_cap &XGMAC_HWFEAT_FRPSEL ) >>3 ; }static void dwxgmac2_rx_watchdog (void __iomem *ioaddr,u32 riwt,u32 nchan)
Signature · 1 line
2.7.4
PATCH 12/26 net: stmmac: tc: Do not return a fragment entry
In reply to Jose AbreuDo not try to return a fragment entry from TC list. Otherwise we may not clean properly allocated entries.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +1 -1
@@ -37,7 +37,7 @@ static struct stmmac_tc_entry *tc_find_entry(struct stmmac_priv *priv, entry = &priv->tc_entries[i];if (!entry->in_use && !first && free) first = entry; -if (entry->handle == loc && !free) +if ((entry->handle == loc) && !free && !entry->is_frag) dup = entry; }
Signature · 1 line
2.7.4
David Miller
maintainerThis patch series is way too large.
Break it down into smaller collections of changes, say a dozen at a time or so.
Thank you.