RE: [RFC,v3 02/10] dpaa_eth: add support for DPAA Ethernet

2015-06-10 Thread Jianhua Xie


 -Original Message-
 From: Linuxppc-dev [mailto:linuxppc-dev-
 bounces+jianhua.xie=freescale@lists.ozlabs.org] On Behalf Of Madalin
 Bucur
 Sent: Wednesday, April 29, 2015 10:57 PM
 To: net...@vger.kernel.org; linuxppc-dev@lists.ozlabs.org
 Cc: linux-ker...@vger.kernel.org; Bucur Madalin-Cristian-B32716
 Subject: [RFC,v3 02/10] dpaa_eth: add support for DPAA Ethernet
 
 This introduces the Freescale Data Path Acceleration Architecture
 (DPAA) Ethernet driver (dpaa_eth) that builds upon the DPAA QMan,
 BMan, PAMU and FMan drivers to deliver Ethernet connectivity on
 the Freescale DPAA QorIQ platforms.
 
Snip..

 +
 + if (unlikely(dpa_xmit(priv, percpu_stats, queue_mapping, fd)  0))
 + goto xmit_failed;
 +
 + net_dev-trans_start = jiffies;

It is probably better to use netdev_queue-trans_start to instead of 
net_dev-trans_start on SMP.

Best Regards,
Jianhua

 + return NETDEV_TX_OK;
 +
 +xmit_failed:
 + if (fd.cmd  FM_FD_CMD_FCO) {
 + (*countptr)--;
 + dpa_fd_release(net_dev, fd);
 + percpu_stats-tx_errors++;
 + return NETDEV_TX_OK;
 + }
 + _dpa_cleanup_tx_fd(priv, fd);
 + percpu_stats-tx_errors++;
 + dev_kfree_skb(skb);
 + return NETDEV_TX_OK;
 +}
 --
 1.7.11.7
 
 ___
 Linuxppc-dev mailing list
 Linuxppc-dev@lists.ozlabs.org
 https://lists.ozlabs.org/listinfo/linuxppc-dev
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH] ucc_geth: invalid rx checksum error values

2014-10-24 Thread Jianhua Xie

Hi Ioannis ,

Thank you very much for finding and reporting the issue.
I help to broadcast to netdev mailing-list.

Thanks  Best Regards,
Jianhua

在 2014年10月22日 21:07, Kokoris, Ioannis 写道:

Hi,

The value in QE UCC ethernet interfaces shows random values:

# ethtool -S eth0
NIC statistics:
  ...
  rx-ip-checksum-errors: 3933892214

The problem is located in a mismatch between the rx_fw_stat_gstrings fields
- used in ucc_geth_ethtool - and the ucc_geth_rx_firmware_statistics_pram
fields - used in ucc_geth.
Although the QE UCC Ethernet Controller includes the Rx checksum error
counter in the 'Rx firmware counters', the related field is missing from the
ucc_geth driver.
After adding the RxChecksumError field in
ucc_geth_rx_firmware_statistics_pram structure the counter works fine.



Signed-off-by: Ioannis Kokkoris ioannis.koko...@unify.com


diff -Nru a/drivers/net/ethernet/freescale/ucc_geth.h
b/drivers/net/ethernet/freescale/ucc_geth.h
--- a/drivers/net/ethernet/freescale/ucc_geth.h 2014-10-22
15:19:16.0 +0300
+++ b/drivers/net/ethernet/freescale/ucc_geth.h 2014-10-22
15:24:39.0 +0300
@@ -541,6 +541,8 @@
replaced */
 u32 insertvlan; /* total frames that had their VLAN tag
inserted */
+   u32 checksumerr;/* total frames that have IP Checksum Error
+*/
  } __packed;

  struct ucc_geth_rx_interrupt_coalescing_entry {



Best Regards,
Ioannis


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 1/2] gianfar: Clean up an unnecessary function gfar_new_skb

2013-02-01 Thread Jianhua Xie
Clean up an unnecessary function gfar_new_skb, since gfar_new_skb()
has the same parameters, return value and function as gfar_alloc_skb(),
should be cleaned up.

Signed-off-by: Jianhua Xie jianhua@freescale.com
---
 drivers/net/ethernet/freescale/gianfar.c |   11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/freescale/gianfar.c 
b/drivers/net/ethernet/freescale/gianfar.c
index bffb2ed..94d36ac 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -110,7 +110,7 @@ static int gfar_start_xmit(struct sk_buff *skb, struct 
net_device *dev);
 static void gfar_reset_task(struct work_struct *work);
 static void gfar_timeout(struct net_device *dev);
 static int gfar_close(struct net_device *dev);
-struct sk_buff *gfar_new_skb(struct net_device *dev);
+static struct sk_buff *gfar_alloc_skb(struct net_device *dev);
 static void gfar_new_rxbdp(struct gfar_priv_rx_q *rx_queue, struct rxbd8 *bdp,
   struct sk_buff *skb);
 static int gfar_set_mac_address(struct net_device *dev);
@@ -207,7 +207,7 @@ static int gfar_init_bds(struct net_device *ndev)
gfar_init_rxbdp(rx_queue, rxbdp,
rxbdp-bufPtr);
} else {
-   skb = gfar_new_skb(ndev);
+   skb = gfar_alloc_skb(ndev);
if (!skb) {
netdev_err(ndev, Can't allocate RX 
buffers\n);
return -ENOMEM;
@@ -2612,11 +2612,6 @@ static struct sk_buff *gfar_alloc_skb(struct net_device 
*dev)
return skb;
 }
 
-struct sk_buff *gfar_new_skb(struct net_device *dev)
-{
-   return gfar_alloc_skb(dev);
-}
-
 static inline void count_errors(unsigned short status, struct net_device *dev)
 {
struct gfar_private *priv = netdev_priv(dev);
@@ -2754,7 +2749,7 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, 
int rx_work_limit)
rmb();
 
/* Add another skb for the future */
-   newskb = gfar_new_skb(dev);
+   newskb = gfar_alloc_skb(dev);
 
skb = rx_queue-rx_skbuff[rx_queue-skb_currx];
 
-- 
1.7.9.5


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 2/2] gianfar: Add a parameter to support allocation skb GFP_KERNEL and GFP_ATOMIC

2013-02-01 Thread Jianhua Xie
While allocation skb in IRQ/SOFTIRQ, such as processing each frame
in the rx ring, alloc skb should be ATOMIC based, should not sleep.

When allocation skb is not in IRQ/SOFTIRQ, such as allocation skb
when initializing a net driver, starting up the NIC from stopped
status. In this case, it is not necessary to alloc memory base on
GFP_ATOMIC, should use GFP_KERNEL.

The second method also avoid kernel crash and reporting -ENOMEM
when free low memory is near vm.min_free_kbytes as below:

Signed-off-by: Jianhua Xie jianhua@freescale.com
---
 drivers/net/ethernet/freescale/gianfar.c |   11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/freescale/gianfar.c 
b/drivers/net/ethernet/freescale/gianfar.c
index 94d36ac..559a01c 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -110,7 +110,7 @@ static int gfar_start_xmit(struct sk_buff *skb, struct 
net_device *dev);
 static void gfar_reset_task(struct work_struct *work);
 static void gfar_timeout(struct net_device *dev);
 static int gfar_close(struct net_device *dev);
-static struct sk_buff *gfar_alloc_skb(struct net_device *dev);
+static struct sk_buff *gfar_alloc_skb(struct net_device *dev, gfp_t gfp_mask);
 static void gfar_new_rxbdp(struct gfar_priv_rx_q *rx_queue, struct rxbd8 *bdp,
   struct sk_buff *skb);
 static int gfar_set_mac_address(struct net_device *dev);
@@ -207,7 +207,7 @@ static int gfar_init_bds(struct net_device *ndev)
gfar_init_rxbdp(rx_queue, rxbdp,
rxbdp-bufPtr);
} else {
-   skb = gfar_alloc_skb(ndev);
+   skb = gfar_alloc_skb(ndev, GFP_KERNEL);
if (!skb) {
netdev_err(ndev, Can't allocate RX 
buffers\n);
return -ENOMEM;
@@ -2598,12 +2598,13 @@ static void gfar_new_rxbdp(struct gfar_priv_rx_q 
*rx_queue, struct rxbd8 *bdp,
gfar_init_rxbdp(rx_queue, bdp, buf);
 }
 
-static struct sk_buff *gfar_alloc_skb(struct net_device *dev)
+static struct sk_buff *gfar_alloc_skb(struct net_device *dev, gfp_t gfp_mask)
 {
struct gfar_private *priv = netdev_priv(dev);
struct sk_buff *skb;
 
-   skb = netdev_alloc_skb(dev, priv-rx_buffer_size + RXBUF_ALIGNMENT);
+   skb = __netdev_alloc_skb(dev, priv-rx_buffer_size + RXBUF_ALIGNMENT,
+   gfp_mask);
if (!skb)
return NULL;
 
@@ -2749,7 +2750,7 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, 
int rx_work_limit)
rmb();
 
/* Add another skb for the future */
-   newskb = gfar_alloc_skb(dev);
+   newskb = gfar_alloc_skb(dev, GFP_ATOMIC);
 
skb = rx_queue-rx_skbuff[rx_queue-skb_currx];
 
-- 
1.7.9.5


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev