Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
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
White Rabbit Switch - Software
Commits
4bfea64a
Commit
4bfea64a
authored
Dec 09, 2014
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel/wr_pstats: get rid of PSTATS_NPORTS
Signed-off-by:
Adam Wujek
<
adam.wujek@cern.ch
>
parent
908be15d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
9 deletions
+20
-9
wr_pstats.c
kernel/wr_pstats/wr_pstats.c
+15
-8
wr_pstats.h
kernel/wr_pstats/wr_pstats.h
+5
-1
No files found.
kernel/wr_pstats/wr_pstats.c
View file @
4bfea64a
...
...
@@ -35,7 +35,7 @@
#define pstats_readl(device, r) __raw_readl(&device.regs->r)
#define pstats_writel(val, device, r) __raw_writel(val, &device.regs->r)
static
int
pstats_nports
=
PSTATS_NPORTS
;
static
int
pstats_nports
=
PSTATS_
DEFAULT_
NPORTS
;
static
uint32_t
portmsk
;
module_param
(
pstats_nports
,
int
,
S_IRUGO
);
...
...
@@ -104,18 +104,18 @@ static struct pstats_version_description pstats_desc[] = {
};
struct
cntrs_dev
{
unsigned
int
cntrs
[
PSTATS_NPORTS
][
PSTATS_CNT_PP
];
unsigned
int
zeros
[
PSTATS_NPORTS
][
PSTATS_CNT_PP
];
unsigned
int
userv
[
PSTATS_NPORTS
][
PSTATS_CNT_PP
];
unsigned
int
cntrs
[
PSTATS_
MAX_
NPORTS
][
PSTATS_CNT_PP
];
unsigned
int
zeros
[
PSTATS_
MAX_
NPORTS
][
PSTATS_CNT_PP
];
unsigned
int
userv
[
PSTATS_
MAX_
NPORTS
][
PSTATS_CNT_PP
];
struct
PSTATS_WB
__iomem
*
regs
;
/* prevents from simultaneous access to cntrs array from tasklet and
* sysfs handler */
spinlock_t
port_mutex
[
PSTATS_NPORTS
];
spinlock_t
port_mutex
[
PSTATS_
MAX_
NPORTS
];
/* circular bufer for passing Port's IRQ mask between irq handler and
* the tasklet */
uint32_t
port_irqs
[
PSTATS_IRQBUFSZ
];
uint64_t
overflows
[
PSTATS_IRQBUFSZ
][
PSTATS_NPORTS
];
uint64_t
overflows
[
PSTATS_IRQBUFSZ
][
PSTATS_
MAX_
NPORTS
];
volatile
int
irqs_head
;
int
irqs_tail
;
};
...
...
@@ -366,7 +366,7 @@ static int pstats_handler(ctl_table *ctl, int write, void *buffer,
}
/* one per port, then info and description, and terminator, filled at init time */
static
ctl_table
pstats_ctl_table
[
PSTATS_NPORTS
+
3
];
static
ctl_table
pstats_ctl_table
[
PSTATS_
MAX_
NPORTS
+
3
];
static
ctl_table
proc_table
[]
=
{
{
...
...
@@ -420,6 +420,13 @@ static int __init pstats_init(void)
unsigned
int
data
;
unsigned
int
version
;
if
(
pstats_nports
>
PSTATS_MAX_NPORTS
)
{
printk
(
KERN_ERR
"%s: Too many ports for pstats %u,"
"only %d supported
\n
"
,
KBUILD_MODNAME
,
pstats_nports
,
PSTATS_MAX_NPORTS
);
err
=
-
EFBIG
;
/* "File too large", not exact */
goto
err_exit
;
}
/*convert nports to one-hot port mask (for enabling IRQs*/
printk
(
KERN_INFO
"nports=%u
\n
"
,
pstats_nports
);
portmsk
=
(
1
<<
pstats_nports
)
-
1
;
...
...
@@ -481,7 +488,7 @@ static int __init pstats_init(void)
goto
err_exit
;
}
for
(
i
=
0
;
i
<
PSTATS_NPORTS
;
++
i
)
for
(
i
=
0
;
i
<
PSTATS_
MAX_
NPORTS
;
++
i
)
spin_lock_init
(
&
pstats_dev
.
port_mutex
[
i
]);
pstats_irq_enable
(
portmsk
);
...
...
kernel/wr_pstats/wr_pstats.h
View file @
4bfea64a
...
...
@@ -9,7 +9,11 @@
#define PSTATS_NUM_OF_COUNTERS 39
#define PSTATS_NPORTS 18
/* how many eth ports are in the switch */
#define PSTATS_MAX_NPORTS 18
/* Maximum number of ports
* supported by the driver */
#define PSTATS_DEFAULT_NPORTS PSTATS_MAX_NPORTS
/* how many eth ports are
* in the switch */
#define PSTATS_CNT_PP PSTATS_NUM_OF_COUNTERS
/* how many counters per port */
#define PSTATS_ADR_PP ((PSTATS_CNT_PP+3)/4)
/* how many address words are
* there per counter (each of
...
...
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