Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
White Rabbit Switch - Software
Manage
Activity
Members
Labels
Plan
Issues
86
Issue boards
Milestones
Wiki
Code
Merge requests
4
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
White Rabbit Switch - Software
Commits
4bfea64a
Commit
4bfea64a
authored
10 years ago
by
Adam Wujek
Browse files
Options
Downloads
Patches
Plain Diff
kernel/wr_pstats: get rid of PSTATS_NPORTS
Signed-off-by:
Adam Wujek
<
adam.wujek@cern.ch
>
parent
908be15d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
kernel/wr_pstats/wr_pstats.c
+15
-8
15 additions, 8 deletions
kernel/wr_pstats/wr_pstats.c
kernel/wr_pstats/wr_pstats.h
+5
-1
5 additions, 1 deletion
kernel/wr_pstats/wr_pstats.h
with
20 additions
and
9 deletions
kernel/wr_pstats/wr_pstats.c
+
15
−
8
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
);
...
...
This diff is collapsed.
Click to expand it.
kernel/wr_pstats/wr_pstats.h
+
5
−
1
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment