Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Simple PCIe FMC carrier SPEC - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Simple PCIe FMC carrier SPEC - Software
Commits
6950cf63
Commit
6950cf63
authored
Oct 31, 2014
by
Adam Wujek
💬
Committed by
Alessandro Rubini
Dec 02, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wr_nic: unify pstats part in nic-core.c (spec)
Signed-off-by:
Adam Wujek
<
adam.wujek@cern.ch
>
parent
e089315b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
2 deletions
+42
-2
nic-core.c
kernel/wr_nic/nic-core.c
+42
-2
No files found.
kernel/wr_nic/nic-core.c
View file @
6950cf63
...
@@ -20,6 +20,9 @@
...
@@ -20,6 +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"
#endif
#include "nic-mem.h"
#include "nic-mem.h"
/*
/*
...
@@ -215,13 +218,50 @@ static int wrn_start_xmit(struct sk_buff *skb, struct net_device *dev)
...
@@ -215,13 +218,50 @@ 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
,
unsigned
int
ctr
[
PSTATS_CNT_PP
]);
EXPORT_SYMBOL
(
wr_nic_pstats_callback
);
static
unsigned
int
nic_counters
[
PSTATS_CNT_PP
];
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
);
/* FIXME: we should get the RMON information from endpoint */
#if WR_IS_SWITCH
if
(
wr_nic_pstats_callback
)
{
int
i
;
spin_lock
(
&
nic_counters_lock
);
wr_nic_pstats_callback
(
ep
->
ep_number
,
nic_counters
);
if
(
0
)
{
/* A stupid diagnostics, happens oh so often... */
printk
(
KERN_INFO
"counters for %i:"
,
ep
->
ep_number
);
for
(
i
=
0
;
i
<
PSTATS_CNT_PP
;
i
++
)
printk
(
KERN_CONT
" %u"
,
nic_counters
[
i
]);
printk
(
KERN_CONT
"
\n
"
);
}
else
{
/* Recover values in the kernel structure */
ep
->
stats
.
rx_packets
=
nic_counters
[
PSTATS_C_R_FRAME
];
ep
->
stats
.
tx_packets
=
nic_counters
[
PSTATS_C_T_FRAME
];
ep
->
stats
.
rx_length_errors
=
nic_counters
[
PSTATS_C_R_GIANT
];
ep
->
stats
.
rx_crc_errors
=
nic_counters
[
PSTATS_C_R_CRC_ERROR
];
ep
->
stats
.
rx_fifo_errors
=
nic_counters
[
PSTATS_C_R_OVERRUN
];
ep
->
stats
.
tx_fifo_errors
=
nic_counters
[
PSTATS_C_T_UNDERRUN
];
}
spin_unlock
(
&
nic_counters_lock
);
}
#endif
return
&
ep
->
stats
;
return
&
ep
->
stats
;
return
NULL
;
}
}
/*
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment