Commit dced9213 authored by Adam Wujek's avatar Adam Wujek 💬 Committed by Alessandro Rubini

wr_nic: unify pstats part in nic-core.c (switch)

Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 073b41b1
...@@ -20,7 +20,9 @@ ...@@ -20,7 +20,9 @@
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include "wr-nic.h" #include "wr-nic.h"
#if WR_IS_SWITCH
#include "wr_pstats.h" #include "wr_pstats.h"
#endif
#include "nic-mem.h" #include "nic-mem.h"
/* /*
...@@ -220,17 +222,20 @@ static int wrn_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -220,17 +222,20 @@ static int wrn_start_xmit(struct sk_buff *skb, struct net_device *dev)
return 0; return 0;
} }
#if WR_IS_SWITCH
int (*wr_nic_pstats_callback)(int epnum, int (*wr_nic_pstats_callback)(int epnum,
unsigned int ctr[PSTATS_CNT_PP]); unsigned int ctr[PSTATS_CNT_PP]);
EXPORT_SYMBOL(wr_nic_pstats_callback); EXPORT_SYMBOL(wr_nic_pstats_callback);
static unsigned int nic_counters[PSTATS_CNT_PP]; static unsigned int nic_counters[PSTATS_CNT_PP];
static DEFINE_SPINLOCK(nic_counters_lock); static DEFINE_SPINLOCK(nic_counters_lock);
#endif
struct net_device_stats *wrn_get_stats(struct net_device *dev) struct net_device_stats *wrn_get_stats(struct net_device *dev)
{ {
struct wrn_ep *ep = netdev_priv(dev); struct wrn_ep *ep = netdev_priv(dev);
#if WR_IS_SWITCH
if (wr_nic_pstats_callback) { if (wr_nic_pstats_callback) {
int i; int i;
...@@ -259,9 +264,8 @@ struct net_device_stats *wrn_get_stats(struct net_device *dev) ...@@ -259,9 +264,8 @@ struct net_device_stats *wrn_get_stats(struct net_device *dev)
} }
spin_unlock(&nic_counters_lock); spin_unlock(&nic_counters_lock);
} }
#endif
return &ep->stats; return &ep->stats;
return NULL;
} }
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment