ftgmac100: Rework batch 4 - Misc
cover ftgmac100: Rework batch 4 - Misc
This is the fourth batch of updates to the ftgmac100 driver.
This is a bunch of misc cleanups and fixes, such as properly disabling HW checksum generation on AST2400 where it's known to be broken and some chip init updates.
This also adds the ability to turn HW checksum on/off and configure the ring sizes via ethtool.
The next (and last) batch will add a few more "features" such as netpoll, multicast/promist, vlan offload...
PATCH 1/10 ftgmac100: Upgrade to NETIF_F_HW_CSUM
The documentation describes NETIF_F_IP_CSUM as deprecated so let's switch to NETIF_F_HW_CSUM and use the helper to handle unhandled protocols.
--- drivers/net/ethernet/faraday/ftgmac100.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/faraday/ftgmac100.c +4 -3
@@ -637,7 +637,8 @@ static int ftgmac100_hard_start_xmit(struct sk_buff *skb, csum_vlan |=FTGMAC100_TXDES1_TCP_CHKSUM ; else if (ip_proto == IPPROTO_UDP) csum_vlan |= FTGMAC100_TXDES1_UDP_CHKSUM; - } + }else if (skb_checksum_help (skb)) + goto drop; } txdes->txdes1 =cpu_to_le32 (csum_vlan);
@@ -1463,11 +1464,11 @@ static int ftgmac100_probe(struct platform_device *pdev)* when NCSI is enabled on the interface. It doesn't work * in that case. */ - netdev->features =NETIF_F_RXCSUM |NETIF_F_IP_CSUM | + netdev->features =NETIF_F_RXCSUM |NETIF_F_HW_CSUM |NETIF_F_GRO |NETIF_F_SG ;if (priv->use_ncsi &&of_get_property (pdev->dev.of_node,"no-hw-checksum" ,NULL )) - netdev->features &= ~NETIF_F_IP_CSUM ; + netdev->features &= ~NETIF_F_HW_CSUM ;/* register network device */ err =register_netdev (netdev);
Signature · 1 line
2.9.3
PATCH 3/10 ftgmac100: Disable HW checksum generation on AST2400, enable on others
In reply to Benjamin HerrenschmidtWe found out that HW checksum generation only works from AST2500 onward. This disables it on AST2400 and removes the "no-hw-checksum" properties in the device-trees. The problem we had wasn't related to NC-SI.
Also rework the logic testing for that property so it can be used to disable HW checksum generation and checking regardless of whether NC-SI is used or not in case other variants out there need this.
--- arch/arm/boot/dts/aspeed-g4.dtsi | 2 -- arch/arm/boot/dts/aspeed-g5.dtsi | 2 -- drivers/net/ethernet/faraday/ftgmac100.c | 12 ++++++------ 3 files changed, 6 insertions(+), 10 deletions(-)
arch/arm/boot/dts/aspeed-g4.dtsi +0 -2
@@ -45,7 +45,6 @@ compatible = "aspeed,ast2400-mac", "faraday,ftgmac100"; reg = <0x1e660000 0x180>; interrupts = <2>; - no-hw-checksum; status = "disabled"; };
@@ -53,7 +52,6 @@ compatible = "aspeed,ast2400-mac", "faraday,ftgmac100"; reg = <0x1e680000 0x180>; interrupts = <3>; - no-hw-checksum; status = "disabled"; };
arch/arm/boot/dts/aspeed-g5.dtsi +0 -2
@@ -36,7 +36,6 @@ compatible = "aspeed,ast2500-mac", "faraday,ftgmac100"; reg = <0x1e660000 0x180>; interrupts = <2>; - no-hw-checksum; status = "disabled"; };
@@ -44,7 +43,6 @@ compatible = "aspeed,ast2500-mac", "faraday,ftgmac100"; reg = <0x1e680000 0x180>; interrupts = <3>; - no-hw-checksum; status = "disabled"; };
drivers/net/ethernet/faraday/ftgmac100.c +6 -6
@@ -1462,15 +1462,15 @@ static int ftgmac100_probe(struct platform_device *pdev) goto err_setup_mdio; } -/* We have to disable on-chip IP checksum functionality -* when NCSI is enabled on the interface. It doesn't work -* in that case. -*/ +/* Base feature set */ netdev->features =NETIF_F_RXCSUM |NETIF_F_HW_CSUM |NETIF_F_GRO |NETIF_F_SG ; -if (priv->use_ncsi && -of_get_property (np,"no-hw-checksum" ,NULL )) + +/* AST2400 doesn't have working HW checksum generation */ +if (np && (of_device_is_compatible (np,"aspeed,ast2400-mac" ))) netdev->features &= ~NETIF_F_HW_CSUM ; +if (np &&of_get_property (np,"no-hw-checksum" ,NULL )) + netdev->features &= ~(NETIF_F_HW_CSUM |NETIF_F_RXCSUM );/* register network device */ err =register_netdev (netdev);
Signature · 1 line
2.9.3
PATCH 5/10 ftgmac100: Rename ftgmac100_set_mac to ftgmac100_write_mac_addr
In reply to Benjamin HerrenschmidtTo avoid confusion with the ndo callback and generally be clearer about the purpose of that function
--- drivers/net/ethernet/faraday/ftgmac100.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/faraday/ftgmac100.c +3 -3
@@ -173,7 +173,7 @@ static int ftgmac100_reset_and_config_mac(struct ftgmac100 *priv)return ftgmac100_reset_mac (priv, maccr); } -static void ftgmac100_set_mac (struct ftgmac100 *priv,const unsigned char *mac) +static void ftgmac100_write_mac_addr (struct ftgmac100 *priv,const u8 *mac) {unsigned int maddr = mac[0 ] <<8 | mac[1 ];unsigned int laddr = mac[2 ] <<24 | mac[3 ] <<16 | mac[4 ] <<8 | mac[5 ];
@@ -226,7 +226,7 @@ static int ftgmac100_set_mac_addr(struct net_device *dev, void *p)return ret;eth_commit_mac_addr_change (dev, p); -ftgmac100_set_mac (netdev_priv (dev), dev->dev_addr); +ftgmac100_write_mac_addr (netdev_priv (dev), dev->dev_addr);return 0 ; }
@@ -245,7 +245,7 @@ static void ftgmac100_init_hw(struct ftgmac100 *priv)iowrite32 (FTGMAC100_APTC_RXPOLL_CNT (1 ), priv->base +FTGMAC100_OFFSET_APTC ); -ftgmac100_set_mac (priv, priv->netdev->dev_addr); +ftgmac100_write_mac_addr (priv, priv->netdev->dev_addr); }static void ftgmac100_start_hw (struct ftgmac100 *priv)
Signature · 1 line
2.9.3
PATCH 4/10 ftgmac100: Set netdev->hw_features
In reply to Benjamin HerrenschmidtSo features can be turned on/off via ethtool
--- drivers/net/ethernet/faraday/ftgmac100.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/faraday/ftgmac100.c +4 -3
@@ -1463,14 +1463,15 @@ static int ftgmac100_probe(struct platform_device *pdev) }/* Base feature set */ - netdev->features =NETIF_F_RXCSUM |NETIF_F_HW_CSUM | + netdev->hw_features =NETIF_F_RXCSUM |NETIF_F_HW_CSUM |NETIF_F_GRO |NETIF_F_SG ;/* AST2400 doesn't have working HW checksum generation */ if (np && (of_device_is_compatible (np,"aspeed,ast2400-mac" ))) - netdev->features &= ~NETIF_F_HW_CSUM ; + netdev->hw_features &= ~NETIF_F_HW_CSUM ;if (np &&of_get_property (np,"no-hw-checksum" ,NULL )) - netdev->features &= ~(NETIF_F_HW_CSUM |NETIF_F_RXCSUM ); + netdev->hw_features &= ~(NETIF_F_HW_CSUM |NETIF_F_RXCSUM ); + netdev->features |= netdev->hw_features;/* register network device */ err =register_netdev (netdev);
Signature · 1 line
2.9.3
PATCH 6/10 ftgmac100: Rename ftgmac100_setup_mac to ftgmac100_initial_mac
In reply to Benjamin HerrenschmidtTo remove more confusion. This function is about obtaining the initial MAC address at driver probe time.
--- drivers/net/ethernet/faraday/ftgmac100.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/faraday/ftgmac100.c +2 -2
@@ -182,7 +182,7 @@ static void ftgmac100_write_mac_addr(struct ftgmac100 *priv, const u8 *mac)iowrite32 (laddr, priv->base +FTGMAC100_OFFSET_MAC_LADR ); } -static void ftgmac100_setup_mac (struct ftgmac100 *priv) +static void ftgmac100_initial_mac (struct ftgmac100 *priv) {u8 mac[ETH_ALEN ];unsigned int m;
@@ -1431,7 +1431,7 @@ static int ftgmac100_probe(struct platform_device *pdev) netdev->irq = irq;/* MAC address from chip or random one */ -ftgmac100_setup_mac (priv); +ftgmac100_initial_mac (priv); np = pdev->dev.of_node; if (np && (of_device_is_compatible(np, "aspeed,ast2400-mac") ||
Signature · 1 line
2.9.3
PATCH 7/10 ftgmac100: Open code remaining register writes
In reply to Benjamin HerrenschmidtThe helpers just take space but don't provide much value. Simple one line comments are more explanatory.
--- drivers/net/ethernet/faraday/ftgmac100.c | 53 ++++++++++++-------------------- 1 file changed, 20 insertions(+), 33 deletions(-)
drivers/net/ethernet/faraday/ftgmac100.c +20 -33
@@ -93,29 +93,6 @@ struct ftgmac100 {bool is_aspeed; }; -static void ftgmac100_set_rx_ring_base (struct ftgmac100 *priv,dma_addr_t addr) -{ -iowrite32 (addr, priv->base +FTGMAC100_OFFSET_RXR_BADR ); -} - -static void ftgmac100_set_rx_buffer_size (struct ftgmac100 *priv, -unsigned int size) -{ - size =FTGMAC100_RBSR_SIZE (size); -iowrite32 (size, priv->base +FTGMAC100_OFFSET_RBSR ); -} - -static void ftgmac100_set_normal_prio_tx_ring_base (struct ftgmac100 *priv, -dma_addr_t addr) -{ -iowrite32 (addr, priv->base +FTGMAC100_OFFSET_NPTXR_BADR ); -} - -static void ftgmac100_txdma_normal_prio_start_polling (struct ftgmac100 *priv) -{ -iowrite32 (1 , priv->base +FTGMAC100_OFFSET_NPTXPD ); -} -static int ftgmac100_reset_mac (struct ftgmac100 *priv,u32 maccr) {struct net_device *netdev = priv->netdev;
@@ -233,18 +210,27 @@ static int ftgmac100_set_mac_addr(struct net_device *dev, void *p)static void ftgmac100_init_hw (struct ftgmac100 *priv) { -/* setup ring buffer base registers */ -ftgmac100_set_rx_ring_base (priv, - priv->descs_dma_addr + - offsetof(struct ftgmac100_descs , rxdes)); -ftgmac100_set_normal_prio_tx_ring_base (priv, - priv->descs_dma_addr + - offsetof(struct ftgmac100_descs , txdes)); -ftgmac100_set_rx_buffer_size (priv,RX_BUF_SIZE ); -iowrite32 (FTGMAC100_APTC_RXPOLL_CNT (1 ), priv->base +FTGMAC100_OFFSET_APTC ); +/* Setup RX ring buffer base */ +iowrite32 (priv->descs_dma_addr + + offsetof(struct ftgmac100_descs , rxdes), + priv->base +FTGMAC100_OFFSET_RXR_BADR ); +/* Setup TX ring buffer base */ +iowrite32 (priv->descs_dma_addr + + offsetof(struct ftgmac100_descs , txdes), + priv->base +FTGMAC100_OFFSET_NPTXR_BADR ); + +/* Configure RX buffer size */ +iowrite32 (FTGMAC100_RBSR_SIZE (RX_BUF_SIZE ), + priv->base +FTGMAC100_OFFSET_RBSR ); + +/* Set RX descriptor autopoll */ +iowrite32 (FTGMAC100_APTC_RXPOLL_CNT (1 ), + priv->base +FTGMAC100_OFFSET_APTC ); + +/* Write MAC address */ ftgmac100_write_mac_addr (priv, priv->netdev->dev_addr); }
@@ -695,7 +681,8 @@ static int ftgmac100_hard_start_xmit(struct sk_buff *skb,netif_wake_queue (netdev); } -ftgmac100_txdma_normal_prio_start_polling (priv); +/* Poke transmitter to read the updated TX descriptors */ +iowrite32 (1 , priv->base +FTGMAC100_OFFSET_NPTXPD );return NETDEV_TX_OK ;
Signature · 1 line
2.9.3
PATCH 8/10 ftgmac100: Add more register inits in ftgmac100_init_hw()
In reply to Benjamin HerrenschmidtClear stale interrupts on entry, configure FIFO sizes, set FIFO thresholds, configure interrupt mitigation.
--- drivers/net/ethernet/faraday/ftgmac100.c | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
drivers/net/ethernet/faraday/ftgmac100.c +36 -0
@@ -210,7 +210,11 @@ static int ftgmac100_set_mac_addr(struct net_device *dev, void *p)static void ftgmac100_init_hw (struct ftgmac100 *priv) { +u32 reg, rfifo_sz, tfifo_sz; +/* Clear stale interrupts */ + reg =ioread32 (priv->base +FTGMAC100_OFFSET_ISR ); +iowrite32 (reg, priv->base +FTGMAC100_OFFSET_ISR );/* Setup RX ring buffer base */ iowrite32(priv->descs_dma_addr +
@@ -232,6 +236,38 @@ static void ftgmac100_init_hw(struct ftgmac100 *priv)/* Write MAC address */ ftgmac100_write_mac_addr (priv, priv->netdev->dev_addr); + +/* Configure descriptor sizes and increase burst sizes according +* to values in Aspeed SDK. The FIFO arbitration is enabled and +* the thresholds set based on the recommended values in the +* AST2400 specification. +*/ +iowrite32 (FTGMAC100_DBLAC_RXDES_SIZE (2 ) |/* 2*8 bytes RX descs */ +FTGMAC100_DBLAC_TXDES_SIZE (2 ) |/* 2*8 bytes TX descs */ +FTGMAC100_DBLAC_RXBURST_SIZE (3 ) |/* 512 bytes max RX bursts */ +FTGMAC100_DBLAC_TXBURST_SIZE (3 ) |/* 512 bytes max TX bursts */ +FTGMAC100_DBLAC_RX_THR_EN |/* Enable fifo threshold arb */ +FTGMAC100_DBLAC_RXFIFO_HTHR (6 ) |/* 6/8 of FIFO high threshold */ +FTGMAC100_DBLAC_RXFIFO_LTHR (2 ),/* 2/8 of FIFO low threshold */ + priv->base +FTGMAC100_OFFSET_DBLAC ); + +/* Interrupt mitigation configured for 1 interrupt/packet. HW interrupt +* mitigation doesn't seem to provide any benefit with NAPI so leave +* it at that. +*/ +iowrite32 (FTGMAC100_ITC_RXINT_THR (1 ) | +FTGMAC100_ITC_TXINT_THR (1 ), + priv->base +FTGMAC100_OFFSET_ITC ); + +/* Configure FIFO sizes in the TPAFCR register */ + reg =ioread32 (priv->base +FTGMAC100_OFFSET_FEAR ); + rfifo_sz = reg &0x00000007 ; + tfifo_sz = (reg >>3 ) &0x00000007 ; + reg =ioread32 (priv->base +FTGMAC100_OFFSET_TPAFCR ); + reg &= ~0x3f000000 ; + reg |= (tfifo_sz <<27 ); + reg |= (rfifo_sz <<24 ); +iowrite32 (reg, priv->base +FTGMAC100_OFFSET_TPAFCR ); }static void ftgmac100_start_hw (struct ftgmac100 *priv)
Signature · 1 line
2.9.3
PATCH 9/10 ftgmac100: Make ring sizes configurable via ethtool
In reply to Benjamin HerrenschmidtWe set an arbitrary max at 1024 since we pre-allocate the actual descriptor arrays and skb arrays to the full size to keep the code a bit simpler and avoid allocation failures in the reset task.
--- drivers/net/ethernet/faraday/ftgmac100.c | 204 ++++++++++++++++++++++--------- 1 file changed, 148 insertions(+), 56 deletions(-)
drivers/net/ethernet/faraday/ftgmac100.c +148 -56
@@ -38,8 +38,15 @@#define DRV_NAME "ftgmac100"#define DRV_VERSION "0.7" -#define RX_QUEUE_ENTRIES 256/* must be power of 2 */ -#define TX_QUEUE_ENTRIES 512/* must be power of 2 */ +/* Arbitrary values, I am not sure the HW has limits */ +#define MAX_RX_QUEUE_ENTRIES 1024 +#define MAX_TX_QUEUE_ENTRIES 1024 +#define MIN_RX_QUEUE_ENTRIES 32 +#define MIN_TX_QUEUE_ENTRIES 32 + +/* Defaults */ +#define DEF_RX_QUEUE_ENTRIES 256 +#define DEF_TX_QUEUE_ENTRIES 512#define MAX_PKT_SIZE 1536#define RX_BUF_SIZE MAX_PKT_SIZE/* must be smaller than 0x3fff */
@@ -47,30 +54,32 @@/* Min number of tx ring entries before stopping queue */ #define TX_THRESHOLD (MAX_SKB_FRAGS + 1) -struct ftgmac100_descs { -struct ftgmac100_rxdes rxdes[RX_QUEUE_ENTRIES ]; -struct ftgmac100_txdes txdes[TX_QUEUE_ENTRIES ]; -}; -struct ftgmac100 {/* Registers */ struct resource *res;void __iomem *base; -struct ftgmac100_descs *descs; -dma_addr_t descs_dma_addr; -/* Rx ring */ -struct sk_buff *rx_skbs[RX_QUEUE_ENTRIES ]; +unsigned int rx_q_entries; +struct ftgmac100_rxdes *rxdes; +dma_addr_t rxdes_dma; +struct sk_buff **rx_skbs;unsigned int rx_pointer;u32 rxdes0_edorr_mask;/* Tx ring */ -struct sk_buff *tx_skbs[TX_QUEUE_ENTRIES ]; +unsigned int tx_q_entries; +struct ftgmac100_txdes *txdes; +dma_addr_t txdes_dma; +struct sk_buff **tx_skbs;unsigned int tx_clean_pointer;unsigned int tx_pointer;u32 txdes0_edotr_mask; +/* Used to signal the reset task of ring change request */ +unsigned int new_rx_q_entries; +unsigned int new_tx_q_entries; +/* Scratch page to use when rx skb alloc fails */ void *rx_scratch;dma_addr_t rx_scratch_dma;
@@ -217,14 +226,10 @@ static void ftgmac100_init_hw(struct ftgmac100 *priv)iowrite32 (reg, priv->base +FTGMAC100_OFFSET_ISR );/* Setup RX ring buffer base */ -iowrite32 (priv->descs_dma_addr + - offsetof(struct ftgmac100_descs , rxdes), - priv->base +FTGMAC100_OFFSET_RXR_BADR ); +iowrite32 (priv->rxdes_dma, priv->base +FTGMAC100_OFFSET_RXR_BADR );/* Setup TX ring buffer base */ -iowrite32 (priv->descs_dma_addr + - offsetof(struct ftgmac100_descs , txdes), - priv->base +FTGMAC100_OFFSET_NPTXR_BADR ); +iowrite32 (priv->txdes_dma, priv->base +FTGMAC100_OFFSET_NPTXR_BADR );/* Configure RX buffer size */ iowrite32(FTGMAC100_RBSR_SIZE(RX_BUF_SIZE),
@@ -337,7 +342,7 @@ static int ftgmac100_alloc_rx_buf(struct ftgmac100 *priv, unsigned int entry,dma_wmb ();/* Clean status (which resets own bit) */ -if (entry == (RX_QUEUE_ENTRIES -1 )) +if (entry == (priv->rx_q_entries -1 )) rxdes->rxdes0 =cpu_to_le32 (priv->rxdes0_edorr_mask);else rxdes->rxdes0 =0 ;
@@ -345,9 +350,10 @@ static int ftgmac100_alloc_rx_buf(struct ftgmac100 *priv, unsigned int entry,return 0 ; } -static int ftgmac100_next_rx_pointer (int pointer) +static unsigned int ftgmac100_next_rx_pointer (struct ftgmac100 *priv, +unsigned int pointer) { -return (pointer +1 ) & (RX_QUEUE_ENTRIES -1 ); +return (pointer +1 ) & (priv->rx_q_entries -1 ); }static void ftgmac100_rx_packet_error (struct ftgmac100 *priv,u32 status)
@@ -377,7 +383,7 @@ static bool ftgmac100_rx_packet(struct ftgmac100 *priv, int *processed)/* Grab next RX descriptor */ pointer = priv->rx_pointer; - rxdes = &priv->descs->rxdes[pointer]; + rxdes = &priv->rxdes[pointer];/* Grab descriptor status */ status =le32_to_cpu (rxdes->rxdes0);
@@ -465,7 +471,7 @@ static bool ftgmac100_rx_packet(struct ftgmac100 *priv, int *processed)/* Resplenish rx ring */ ftgmac100_alloc_rx_buf (priv, pointer, rxdes,GFP_ATOMIC ); - priv->rx_pointer =ftgmac100_next_rx_pointer (pointer); + priv->rx_pointer =ftgmac100_next_rx_pointer (priv, pointer); skb->protocol =eth_type_trans (skb, netdev);
@@ -484,7 +490,7 @@ static bool ftgmac100_rx_packet(struct ftgmac100 *priv, int *processed) drop:/* Clean rxdes0 (which resets own bit) */ rxdes->rxdes0 =cpu_to_le32 (status & priv->rxdes0_edorr_mask); - priv->rx_pointer =ftgmac100_next_rx_pointer (pointer); + priv->rx_pointer =ftgmac100_next_rx_pointer (priv, pointer); netdev->stats.rx_dropped++;return true; }
@@ -492,15 +498,16 @@ static bool ftgmac100_rx_packet(struct ftgmac100 *priv, int *processed)static u32 ftgmac100_base_tx_ctlstat (struct ftgmac100 *priv,unsigned int index) { -if (index == (TX_QUEUE_ENTRIES -1 )) +if (index == (priv->tx_q_entries -1 ))return priv->txdes0_edotr_mask;else return 0 ; } -static int ftgmac100_next_tx_pointer (int pointer) +static unsigned int ftgmac100_next_tx_pointer (struct ftgmac100 *priv, +unsigned int pointer) { -return (pointer +1 ) & (TX_QUEUE_ENTRIES -1 ); +return (pointer +1 ) & (priv->tx_q_entries -1 ); }static u32 ftgmac100_tx_buf_avail (struct ftgmac100 *priv)
@@ -512,7 +519,7 @@ static u32 ftgmac100_tx_buf_avail(struct ftgmac100 *priv)* test for ftgmac100_tx_buf_cleanable() below */ return (priv->tx_clean_pointer - priv->tx_pointer -1 ) & - (TX_QUEUE_ENTRIES -1 ); + (priv->tx_q_entries -1 ); }static bool ftgmac100_tx_buf_cleanable (struct ftgmac100 *priv)
@@ -552,7 +559,7 @@ static bool ftgmac100_tx_complete_packet(struct ftgmac100 *priv)u32 ctl_stat; pointer = priv->tx_clean_pointer; - txdes = &priv->descs->txdes[pointer]; + txdes = &priv->txdes[pointer]; ctl_stat =le32_to_cpu (txdes->txdes0);if (ctl_stat &FTGMAC100_TXDES0_TXDMA_OWN )
@@ -564,7 +571,7 @@ static bool ftgmac100_tx_complete_packet(struct ftgmac100 *priv)ftgmac100_free_tx_packet (priv, pointer, skb, txdes, ctl_stat); txdes->txdes0 =cpu_to_le32 (ctl_stat & priv->txdes0_edotr_mask); - priv->tx_clean_pointer =ftgmac100_next_tx_pointer (pointer); + priv->tx_clean_pointer =ftgmac100_next_tx_pointer (priv, pointer);return true; }
@@ -633,7 +640,7 @@ static int ftgmac100_hard_start_xmit(struct sk_buff *skb,/* Grab the next free tx descriptor */ pointer = priv->tx_pointer; - txdes = first = &priv->descs->txdes[pointer]; + txdes = first = &priv->txdes[pointer];/* Setup it up with the packet head. Don't write the head to the * ring just yet
@@ -666,7 +673,7 @@ static int ftgmac100_hard_start_xmit(struct sk_buff *skb, txdes->txdes1 =cpu_to_le32 (csum_vlan);/* Next descriptor */ - pointer =ftgmac100_next_tx_pointer (pointer); + pointer =ftgmac100_next_tx_pointer (priv, pointer);/* Add the fragments */ for (i =0 ; i < nfrags; i++) {
@@ -682,7 +689,7 @@ static int ftgmac100_hard_start_xmit(struct sk_buff *skb,/* Setup descriptor */ priv->tx_skbs[pointer] = skb; - txdes = &priv->descs->txdes[pointer]; + txdes = &priv->txdes[pointer]; ctl_stat =ftgmac100_base_tx_ctlstat (priv, pointer); ctl_stat |=FTGMAC100_TXDES0_TXDMA_OWN ; ctl_stat |=FTGMAC100_TXDES0_TXBUF_SIZE (len);
@@ -693,7 +700,7 @@ static int ftgmac100_hard_start_xmit(struct sk_buff *skb, txdes->txdes3 =cpu_to_le32 (map);/* Next one */ - pointer =ftgmac100_next_tx_pointer (pointer); + pointer =ftgmac100_next_tx_pointer (priv, pointer); }/* Order the previous packet and descriptor udpates
@@ -733,8 +740,8 @@ static int ftgmac100_hard_start_xmit(struct sk_buff *skb,/* Then all fragments */ for (j =0 ; j < i; j++) { - pointer =ftgmac100_next_tx_pointer (pointer); - txdes = &priv->descs->txdes[pointer]; + pointer =ftgmac100_next_tx_pointer (priv, pointer); + txdes = &priv->txdes[pointer]; ctl_stat =le32_to_cpu (txdes->txdes0);ftgmac100_free_tx_packet (priv, pointer, skb, txdes, ctl_stat); txdes->txdes0 =cpu_to_le32 (ctl_stat & priv->txdes0_edotr_mask);
@@ -757,8 +764,8 @@ static void ftgmac100_free_buffers(struct ftgmac100 *priv)int i;/* Free all RX buffers */ -for (i =0 ; i <RX_QUEUE_ENTRIES ; i++) { -struct ftgmac100_rxdes *rxdes = &priv->descs->rxdes[i]; +for (i =0 ; i < priv->rx_q_entries; i++) { +struct ftgmac100_rxdes *rxdes = &priv->rxdes[i];struct sk_buff *skb = priv->rx_skbs[i];dma_addr_t map =le32_to_cpu (rxdes->rxdes3);
@@ -771,8 +778,8 @@ static void ftgmac100_free_buffers(struct ftgmac100 *priv) }/* Free all TX buffers */ -for (i =0 ; i <TX_QUEUE_ENTRIES ; i++) { -struct ftgmac100_txdes *txdes = &priv->descs->txdes[i]; +for (i =0 ; i < priv->tx_q_entries; i++) { +struct ftgmac100_txdes *txdes = &priv->txdes[i];struct sk_buff *skb = priv->tx_skbs[i];if (!skb)
@@ -784,10 +791,22 @@ static void ftgmac100_free_buffers(struct ftgmac100 *priv)static void ftgmac100_free_rings (struct ftgmac100 *priv) { +/* Free skb arrays */ +kfree (priv->rx_skbs); +kfree (priv->tx_skbs); +/* Free descriptors */ -if (priv->descs) -dma_free_coherent (priv->dev,sizeof (struct ftgmac100_descs ), - priv->descs, priv->descs_dma_addr); +if (priv->rxdes) +dma_free_coherent (priv->dev,MAX_RX_QUEUE_ENTRIES * +sizeof (struct ftgmac100_rxdes ), + priv->rxdes, priv->rxdes_dma); + priv->rxdes =NULL ; + +if (priv->txdes) +dma_free_coherent (priv->dev,MAX_TX_QUEUE_ENTRIES * +sizeof (struct ftgmac100_txdes ), + priv->txdes, priv->txdes_dma); + priv->txdes =NULL ;/* Free scratch packet buffer */ if (priv->rx_scratch)
@@ -797,11 +816,28 @@ static void ftgmac100_free_rings(struct ftgmac100 *priv)static int ftgmac100_alloc_rings (struct ftgmac100 *priv) { +/* Allocate skb arrays */ + priv->rx_skbs =kcalloc (MAX_RX_QUEUE_ENTRIES ,sizeof (void *), +GFP_KERNEL ); +if (!priv->rx_skbs) +return -ENOMEM ; + priv->tx_skbs =kcalloc (MAX_TX_QUEUE_ENTRIES ,sizeof (void *), +GFP_KERNEL ); +if (!priv->tx_skbs) +return -ENOMEM ; +/* Allocate descriptors */ - priv->descs =dma_zalloc_coherent (priv->dev, -sizeof (struct ftgmac100_descs ), - &priv->descs_dma_addr,GFP_KERNEL ); -if (!priv->descs) + priv->rxdes =dma_zalloc_coherent (priv->dev, +MAX_RX_QUEUE_ENTRIES * +sizeof (struct ftgmac100_rxdes ), + &priv->rxdes_dma,GFP_KERNEL ); +if (!priv->rxdes) +return -ENOMEM ; + priv->txdes =dma_zalloc_coherent (priv->dev, +MAX_TX_QUEUE_ENTRIES * +sizeof (struct ftgmac100_txdes ), + &priv->txdes_dma,GFP_KERNEL ); +if (!priv->txdes)return -ENOMEM ;/* Allocate scratch packet buffer */
@@ -817,22 +853,32 @@ static int ftgmac100_alloc_rings(struct ftgmac100 *priv)static void ftgmac100_init_rings (struct ftgmac100 *priv) { -struct ftgmac100_rxdes *rxdes; -struct ftgmac100_txdes *txdes; +struct ftgmac100_rxdes *rxdes =NULL ; +struct ftgmac100_txdes *txdes =NULL ;int i; +/* Update entries counts */ + priv->rx_q_entries = priv->new_rx_q_entries; + priv->tx_q_entries = priv->new_tx_q_entries; + +if (WARN_ON (priv->rx_q_entries <MIN_RX_QUEUE_ENTRIES )) +return ; +/* Initialize RX ring */ -for (i =0 ; i <RX_QUEUE_ENTRIES ; i++) { - rxdes = &priv->descs->rxdes[i]; +for (i =0 ; i < priv->rx_q_entries; i++) { + rxdes = &priv->rxdes[i]; rxdes->rxdes0 =0 ; rxdes->rxdes3 =cpu_to_le32 (priv->rx_scratch_dma); }/* Mark the end of the ring */ rxdes->rxdes0 |=cpu_to_le32 (priv->rxdes0_edorr_mask); +if (WARN_ON (priv->tx_q_entries <MIN_RX_QUEUE_ENTRIES )) +return ; +/* Initialize TX ring */ -for (i =0 ; i <TX_QUEUE_ENTRIES ; i++) { - txdes = &priv->descs->txdes[i]; +for (i =0 ; i < priv->tx_q_entries; i++) { + txdes = &priv->txdes[i]; txdes->txdes0 =0 ; } txdes->txdes0 |=cpu_to_le32 (priv->txdes0_edotr_mask);
@@ -842,8 +888,8 @@ static int ftgmac100_alloc_rx_buffers(struct ftgmac100 *priv) {int i; -for (i =0 ; i <RX_QUEUE_ENTRIES ; i++) { -struct ftgmac100_rxdes *rxdes = &priv->descs->rxdes[i]; +for (i =0 ; i < priv->rx_q_entries; i++) { +struct ftgmac100_rxdes *rxdes = &priv->rxdes[i];if (ftgmac100_alloc_rx_buf (priv, i, rxdes,GFP_KERNEL ))return -ENOMEM ;
@@ -988,11 +1034,53 @@ static void ftgmac100_get_drvinfo(struct net_device *netdev,strlcpy (info->bus_info,dev_name (&netdev->dev),sizeof (info->bus_info)); } +static int ftgmac100_nway_reset (struct net_device *ndev) +{ +if (!ndev->phydev) +return -ENXIO ; +return phy_start_aneg (ndev->phydev); +} + +static void ftgmac100_get_ringparam (struct net_device *netdev, +struct ethtool_ringparam *ering) +{ +struct ftgmac100 *priv =netdev_priv (netdev); + +memset (ering,0 ,sizeof (*ering)); + ering->rx_max_pending =MAX_RX_QUEUE_ENTRIES ; + ering->tx_max_pending =MAX_TX_QUEUE_ENTRIES ; + ering->rx_pending = priv->rx_q_entries; + ering->tx_pending = priv->tx_q_entries; +} + +static int ftgmac100_set_ringparam (struct net_device *netdev, +struct ethtool_ringparam *ering) +{ +struct ftgmac100 *priv =netdev_priv (netdev); + +if (ering->rx_pending >MAX_RX_QUEUE_ENTRIES || + ering->tx_pending >MAX_TX_QUEUE_ENTRIES || + ering->rx_pending <MIN_RX_QUEUE_ENTRIES || + ering->tx_pending <MIN_TX_QUEUE_ENTRIES || + !is_power_of_2 (ering->rx_pending) || + !is_power_of_2 (ering->tx_pending)) +return -EINVAL ; + + priv->new_rx_q_entries = ering->rx_pending; + priv->new_tx_q_entries = ering->tx_pending; +if (netif_running (netdev)) +schedule_work (&priv->reset_task); + +return 0 ; +} +static const struct ethtool_ops ftgmac100_ethtool_ops = { .get_drvinfo = ftgmac100_get_drvinfo, .get_link = ethtool_op_get_link, .get_link_ksettings = phy_ethtool_get_link_ksettings, .set_link_ksettings = phy_ethtool_set_link_ksettings, + .get_ringparam = ftgmac100_get_ringparam, + .set_ringparam = ftgmac100_set_ringparam, };static irqreturn_t ftgmac100_interrupt (int irq,void *dev_id)
@@ -1048,7 +1136,7 @@ static irqreturn_t ftgmac100_interrupt(int irq, void *dev_id)static bool ftgmac100_check_rx (struct ftgmac100 *priv) { -struct ftgmac100_rxdes *rxdes = &priv->descs->rxdes[priv->rx_pointer]; +struct ftgmac100_rxdes *rxdes = &priv->rxdes[priv->rx_pointer];/* Do we have a packet ? */ return !!(rxdes->rxdes0 &cpu_to_le32 (FTGMAC100_RXDES0_RXPKT_RDY ));
@@ -1485,6 +1573,10 @@ static int ftgmac100_probe(struct platform_device *pdev) goto err_setup_mdio; } +/* Default ring sizes */ + priv->rx_q_entries = priv->new_rx_q_entries =DEF_RX_QUEUE_ENTRIES ; + priv->tx_q_entries = priv->new_tx_q_entries =DEF_TX_QUEUE_ENTRIES ; +/* Base feature set */ netdev->hw_features =NETIF_F_RXCSUM |NETIF_F_HW_CSUM |NETIF_F_GRO |NETIF_F_SG ;
Signature · 1 line
2.9.3
PATCH 10/10 ftgmac100: Set default ring sizes to 128 entries
In reply to Benjamin HerrenschmidtI haven't seen any improvement above that size on the machines I've tested with.
--- drivers/net/ethernet/faraday/ftgmac100.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/faraday/ftgmac100.c +2 -2
@@ -45,8 +45,8 @@#define MIN_TX_QUEUE_ENTRIES 32/* Defaults */ -#define DEF_RX_QUEUE_ENTRIES 256 -#define DEF_TX_QUEUE_ENTRIES 512 +#define DEF_RX_QUEUE_ENTRIES 128 +#define DEF_TX_QUEUE_ENTRIES 128#define MAX_PKT_SIZE 1536#define RX_BUF_SIZE MAX_PKT_SIZE/* must be smaller than 0x3fff */
Signature · 1 line
2.9.3
Quoted 11 lines · Benjamin Herrenschmidt
This is the fourth batch of updates to the ftgmac100 driver.
This is a bunch of misc cleanups and fixes, such as properly disabling HW checksum generation on AST2400 where it's known to be broken and some chip init updates.
This also adds the ability to turn HW checksum on/off and configure the ring sizes via ethtool.
The next (and last) batch will add a few more "features" such as netpoll, multicast/promist, vlan offload...
FYI. This series plays a bit with the device-tree properties for this driver. There is more in the last batch, which will also include an patch adding
Documentation/devicetree/bindings/net/ftgmac100.txt
documenting all this.
Cheers,
Ben.
PATCH 2/10 ftgmac100: Use device "compatible" property, not machine.
In reply to Benjamin HerrenschmidtWe test for aspeed chips to handle a couple of special cases, but we do that by checking the machine type which isn't right.
Instead check the actual device compatible property. This also updates the dtsi files for the aspeed SoC to match.
--- arch/arm/boot/dts/aspeed-g4.dtsi | 4 ++-- arch/arm/boot/dts/aspeed-g5.dtsi | 4 ++-- drivers/net/ethernet/faraday/ftgmac100.c | 16 +++++++++------- 3 files changed, 13 insertions(+), 11 deletions(-)
arch/arm/boot/dts/aspeed-g4.dtsi +2 -2
@@ -42,7 +42,7 @@ }; mac0: ethernet@1e660000 { - compatible = "faraday,ftgmac100"; + compatible = "aspeed,ast2400-mac", "faraday,ftgmac100"; reg = <0x1e660000 0x180>; interrupts = <2>; no-hw-checksum;
@@ -50,7 +50,7 @@ }; mac1: ethernet@1e680000 { - compatible = "faraday,ftgmac100"; + compatible = "aspeed,ast2400-mac", "faraday,ftgmac100"; reg = <0x1e680000 0x180>; interrupts = <3>; no-hw-checksum;
arch/arm/boot/dts/aspeed-g5.dtsi +2 -2
@@ -33,7 +33,7 @@ }; mac0: ethernet@1e660000 { - compatible = "faraday,ftgmac100"; + compatible = "aspeed,ast2500-mac", "faraday,ftgmac100"; reg = <0x1e660000 0x180>; interrupts = <2>; no-hw-checksum;
@@ -41,7 +41,7 @@ }; mac1: ethernet@1e680000 { - compatible = "faraday,ftgmac100"; + compatible = "aspeed,ast2500-mac", "faraday,ftgmac100"; reg = <0x1e680000 0x180>; interrupts = <3>; no-hw-checksum;
drivers/net/ethernet/faraday/ftgmac100.c +9 -7
@@ -90,6 +90,7 @@ struct ftgmac100 {/* Misc */ bool need_mac_restart; +bool is_aspeed; };static void ftgmac100_set_rx_ring_base (struct ftgmac100 *priv,dma_addr_t addr)
@@ -1311,8 +1312,7 @@ static int ftgmac100_setup_mdio(struct net_device *netdev)if (!priv->mii_bus)return -EIO ; -if (of_machine_is_compatible ("aspeed,ast2400" ) || -of_machine_is_compatible ("aspeed,ast2500" )) { +if (priv->is_aspeed) {/* This driver supports the old MDIO interface */ reg =ioread32 (priv->base +FTGMAC100_OFFSET_REVR ); reg &= ~FTGMAC100_REVR_NEW_MDIO_INTERFACE ;
@@ -1377,6 +1377,7 @@ static int ftgmac100_probe(struct platform_device *pdev)int irq;struct net_device *netdev;struct ftgmac100 *priv; +struct device_node *np;int err =0 ;if (!pdev)
@@ -1432,17 +1433,18 @@ static int ftgmac100_probe(struct platform_device *pdev)/* MAC address from chip or random one */ ftgmac100_setup_mac (priv); -if (of_machine_is_compatible ("aspeed,ast2400" ) || -of_machine_is_compatible ("aspeed,ast2500" )) { + np = pdev->dev.of_node; +if (np && (of_device_is_compatible (np,"aspeed,ast2400-mac" ) || +of_device_is_compatible (np,"aspeed,ast2500-mac" ))) { priv->rxdes0_edorr_mask =BIT (30 ); priv->txdes0_edotr_mask =BIT (30 ); + priv->is_aspeed = true; }else { priv->rxdes0_edorr_mask =BIT (15 ); priv->txdes0_edotr_mask =BIT (15 ); } -if (pdev->dev.of_node && -of_get_property (pdev->dev.of_node,"use-ncsi" ,NULL )) { +if (np &&of_get_property (np,"use-ncsi" ,NULL )) {if (!IS_ENABLED (CONFIG_NET_NCSI )) {dev_err (&pdev->dev,"NCSI stack not enabled\n" ); goto err_ncsi_dev;
@@ -1467,7 +1469,7 @@ static int ftgmac100_probe(struct platform_device *pdev) netdev->features =NETIF_F_RXCSUM |NETIF_F_HW_CSUM |NETIF_F_GRO |NETIF_F_SG ;if (priv->use_ncsi && -of_get_property (pdev->dev.of_node,"no-hw-checksum" ,NULL )) +of_get_property (np,"no-hw-checksum" ,NULL )) netdev->features &= ~NETIF_F_HW_CSUM ;/* register network device */
Signature · 1 line
2.9.3
Re: [PATCH 01/10] ftgmac100: Upgrade to NETIF_F_HW_CSUM
In reply to Benjamin HerrenschmidtHello!
Quoted 14 lines · Benjamin Herrenschmidt
The documentation describes
NETIF_F_IP_CSUMas deprecated so let's switch toNETIF_F_HW_CSUMand use the helper to handle unhandled protocols.Signed-off-by Benjamin Herrenschmidt <[email protected]>--- drivers/net/ethernet/faraday/ftgmac100.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/net/ethernet/faraday/ftgmac100.c +0
-0
drivers/net/ethernet/faraday/ftgmac100.c static int ftgmac100_hard_start_xmit(struct sk_buff *skb, · line 641
Quoted 6 lines
drivers/net/ethernet/faraday/ftgmac100.c +2
-1@@ -637,7 +637,8 @@ static int ftgmac100_hard_start_xmit(struct sk_buff *skb, csum_vlan |=FTGMAC100_TXDES1_TCP_CHKSUM ; else if (ip_proto == IPPROTO_UDP) csum_vlan |= FTGMAC100_TXDES1_UDP_CHKSUM; - } + }else if (skb_checksum_help (skb)) + goto drop;
Need {} here as well since the 1st branch has it -- seeDocumentation/process/coding-style.rst (the end of the section 3).
[...]
MBR, Sergei
Re: [PATCH 01/10] ftgmac100: Upgrade to NETIF_F_HW_CSUM
Quoted 2 lines · Sergei Shtylyov
Need {} here as well since the 1st branch has it -- see
Documentation/process/coding-style.rst(the end of the section 3).
Adding {} in that specific statements just makes things more cluttered and less readable.
I can find a ton of examples of
if (...) {
multi lines
...
} else if (...)
single_line()In existing kernel code.
I'll fix it in a next spin if Dave wants it that way but otherwise I'm keen to leave it as it is.
Ben.
Re: [PATCH 01/10] ftgmac100: Upgrade to NETIF_F_HW_CSUM
Quoted 15 lines · Benjamin Herrenschmidt
Quoted 2 lines · Sergei Shtylyov
Need {} here as well since the 1st branch has it -- see
Documentation/process/coding-style.rst(the end of the section 3).Adding {} in that specific statements just makes things more cluttered and less readable.
I can find a ton of examples of
if (...) { multi lines ... } else if (...) single_line()
Quoted 4 lines
In existing kernel code.
I'll fix it in a next spin if Dave wants it that way but otherwise I'm keen to leave it as it is.
I actually took the time to read the coding-style.txt statement, and I would argue that it is about
if (...) {
...
} else {
...
}Which is a different can of worms. I tend to agree that the else by itself followed by a single tabulated statement is a bit "odd" and I tend to use braces in that case as well.
However the "} else if (...)" case is subtly different and from a code clarity point of view I prefer what I wrote.
This isn't an accident, I specifically wrote that statement that way because I preferred how the code looked like that way.
This tend to be my problem with coding style rules (and people who comment on patches solely on coding style issues, especially so marginal ones ;-) ... this needs to be applied along with a bit of common sense and taste.
Those rules should be "general guidelines" not absolute laws. A specific piece of code might benefit from violating some of them occasionally for all sort of reasons provided the end result is both clear and more concise for example.
Anyway, way too much internet bandwidth wasted today on that subject.
Dave, just let me know how you want it to look like :-)
Cheers,
Ben.
David Miller
maintainerRe: [PATCH 01/10] ftgmac100: Upgrade to NETIF_F_HW_CSUM
In reply to Benjamin HerrenschmidtFrom: Benjamin Herrenschmidt <[email protected]>
Date: Tue, 11 Apr 2017 21:13:45 +1000
Quoted 9 lines · Sergei Shtylyov
Quoted 2 lines
Need {} here as well since the 1st branch has it -- see
Documentation/process/coding-style.rst(the end of the section 3).Adding {} in that specific statements just makes things more cluttered and less readable.
I can find a ton of examples of
Quoted 7 lines
if (...) { multi lines ... } else if (...) single_line()In existing kernel code.
Existing practice not following the coding style rules does not dictate that it's OK to do so.
Quoted 2 lines
I'll fix it in a next spin if Dave wants it that way but otherwise I'm keen to leave it as it is.
Please fix this and respin.
Meanwhile get the coding style rules changed if you disagree with them. A patch series review is not the place to argue about your disagreement with the coding style rules.
Thanks.
Re: [PATCH 01/10] ftgmac100: Upgrade to NETIF_F_HW_CSUM
Quoted 8 lines · David Miller
Quoted 2 lines
I'll fix it in a next spin if Dave wants it that way but otherwise I'm keen to leave it as it is.
Please fix this and respin.
Meanwhile get the coding style rules changed if you disagree with them. A patch series review is not the place to argue about your disagreement with the coding style rules.
I will fix.
Note that I don't disagree with the rule as stated.
However I'd like to point out that the rule doesn't precisely match the construct here as it's for a dangling single else while what I had here is an else if ... so it's open to intepretation :-)
I also tend to disagree that coding style rules should be firm laws, imho they should be considered in context and broken if they render a given piece of code less clear.
That said, I will respin.
Cheers,
Ben.
Re: [PATCH 01/10] ftgmac100: Upgrade to NETIF_F_HW_CSUM
Quoted 5 lines · Benjamin Herrenschmidt
Quoted 4 lines · David Miller
Quoted 3 lines
I'll fix it in a next spin if Dave wants it that way but otherwise
I'm keen to leave it as it is.
Quoted 7 lines
Quoted 5 lines
Please fix this and respin.
Meanwhile get the coding style rules changed if you disagree with them. A patch series review is not the place to argue about your disagreement with the coding style rules.
I will fix.
Funny thing is, I think the code is wrong :)
I should call the helper when I don't recognize the protocol type in the IP header, not just when the main skb protocol type is not IP.
BTW. I'm not too familiar with how encapsulation works these days. I wouldn't throw at that HW anything other than unencapsulated packets for HW checksumming. Is checking skb->protocol to be IP and ip_hdr(skb)->protocol to be IP, UDP or TCP enough ? IE. Will the latter especially return the outer header ?
Cheers,
Ben.
David Miller
maintainerRe: [PATCH 01/10] ftgmac100: Upgrade to NETIF_F_HW_CSUM
From: Benjamin Herrenschmidt <[email protected]>
Date: Wed, 12 Apr 2017 09:36:05 +1000
Quoted 2 lines
I should call the helper when I don't recognize the protocol type in the IP header, not just when the main skb protocol type is not IP.
That's correct.
Quoted 5 lines
BTW. I'm not too familiar with how encapsulation works these days. I wouldn't throw at that HW anything other than unencapsulated packets for HW checksumming. Is checking
skb->protocolto be IP and ip_hdr(skb)->protocol to be IP, UDP or TCP enough ? IE. Will the latter especially return the outer header ?
If skb->protocol is IP then yes ip_hdr() will point at the outermost header.
Re: [PATCH 01/10] ftgmac100: Upgrade to NETIF_F_HW_CSUM
Quoted 8 lines · David Miller
Quoted 1 line
From: Benjamin Herrenschmidt <[email protected]>
Date: Wed, 12 Apr 2017 09:36:05 +1000
Quoted 2 lines
I should call the helper when I don't recognize the protocol type in the IP header, not just when the main skb protocol type is not IP.
That's correct.
Quoted 8 lines
Quoted 5 lines
BTW. I'm not too familiar with how encapsulation works these days. I wouldn't throw at that HW anything other than unencapsulated packets for HW checksumming. Is checking
skb->protocolto be IP and ip_hdr(skb)->protocol to be IP, UDP or TCP enough ? IE. Will the latter especially return the outer header ?If
skb->protocolis IP then yesip_hdr()will point at the outermost header.
Great thanks. I'll repost later today in case some other comments still come in.
Cheers,
Ben.