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
1059c398
Commit
1059c398
authored
Feb 09, 2016
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
userspace/wrsw_hal: replace fprintf's with pr_error
Signed-off-by:
Adam Wujek
<
adam.wujek@cern.ch
>
parent
02fdabd6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
19 deletions
+16
-19
hal_main.c
userspace/wrsw_hal/hal_main.c
+3
-4
hal_ports.c
userspace/wrsw_hal/hal_ports.c
+12
-14
hal_timing.c
userspace/wrsw_hal/hal_timing.c
+1
-1
No files found.
userspace/wrsw_hal/hal_main.c
View file @
1059c398
...
...
@@ -205,9 +205,8 @@ static void hal_parse_cmdline(int argc, char *argv[])
break
;
default:
fprintf
(
stderr
,
"Unrecognized option. Call %s -h for help.
\n
"
,
argv
[
0
]);
pr_error
(
"Unrecognized option. Call %s -h for help.
\n
"
,
argv
[
0
]);
break
;
}
}
...
...
@@ -225,7 +224,7 @@ int main(int argc, char *argv[])
/* Prevent from running HAL twice - it will likely freeze the system */
if
(
hal_check_running
())
{
fprintf
(
stderr
,
"Fatal: There is another WR HAL "
pr_error
(
"Fatal: There is another WR HAL "
"instance running. We can't work together.
\n\n
"
);
return
-
1
;
}
...
...
userspace/wrsw_hal/hal_ports.c
View file @
1059c398
...
...
@@ -114,7 +114,7 @@ static int hal_port_init(int index)
error
=
libwr_cfg_convert2
(
"PORT%02i_PARAMS"
,
"tx"
,
LIBWR_INT
,
&
val
,
index
);
if
(
error
)
fprintf
(
stderr
,
"port index %i (%s): no
\"
tx=
\"
specified
\n
"
,
pr_error
(
"port index %i (%s): no
\"
tx=
\"
specified
\n
"
,
index
,
name
);
p
->
calib
.
phy_tx_min
=
val
;
...
...
@@ -122,7 +122,7 @@ static int hal_port_init(int index)
error
=
libwr_cfg_convert2
(
"PORT%02i_PARAMS"
,
"rx"
,
LIBWR_INT
,
&
val
,
index
);
if
(
error
)
fprintf
(
stderr
,
"port index %i (%s): no
\"
rx=
\"
specified
\n
"
,
pr_error
(
"port index %i (%s): no
\"
rx=
\"
specified
\n
"
,
index
,
name
);
p
->
calib
.
phy_rx_min
=
val
;
...
...
@@ -150,7 +150,7 @@ static int hal_port_init(int index)
error
=
libwr_cfg_convert2
(
"PORT%02i_PARAMS"
,
"role"
,
LIBWR_STRING
,
s
,
index
);
if
(
error
)
fprintf
(
stderr
,
"port index %i (%s): "
pr_error
(
"port index %i (%s): "
"no
\"
role=
\"
specified
\n
"
,
index
,
name
);
for
(
rp
=
rt
;
rp
->
name
;
rp
++
)
...
...
@@ -158,7 +158,7 @@ static int hal_port_init(int index)
break
;
p
->
mode
=
rp
->
value
;
if
(
!
rp
->
name
)
fprintf
(
stderr
,
"port index %i (%s): invalid role "
pr_error
(
"port index %i (%s): invalid role "
"
\"
%s
\"
specified
\n
"
,
index
,
name
,
s
);
pr_info
(
"Port %s: mode %i
\n
"
,
p
->
name
,
val
);
...
...
@@ -169,13 +169,13 @@ static int hal_port_init(int index)
LIBWR_INT
,
&
p
->
fiber_index
,
index
);
if
(
error
)
{
fprintf
(
stderr
,
"port index %i (%s): "
pr_error
(
"port index %i (%s): "
"no
\"
fiber=
\"
specified, default fiber to 0
\n
"
,
index
,
name
);
p
->
fiber_index
=
0
;
}
if
(
p
->
fiber_index
>
3
)
{
fprintf
(
stderr
,
"port index %i (%s): "
pr_error
(
"port index %i (%s): "
"not supported
\"
fiber=
\"
value, default to 0
\n
"
,
index
,
name
);
p
->
fiber_index
=
0
;
...
...
@@ -205,8 +205,7 @@ int hal_port_init_all(char *logfilename)
/* Open a single raw socket for accessing the MAC addresses, etc. */
hal_port_fd
=
socket
(
AF_PACKET
,
SOCK_DGRAM
,
0
);
if
(
hal_port_fd
<
0
)
{
fprintf
(
stderr
,
"%s: Can't create socket: %s
\n
"
,
__func__
,
strerror
(
errno
));
pr_error
(
"Can't create socket: %s
\n
"
,
strerror
(
errno
));
return
-
1
;
}
/* Allocate the ports in shared memory, so wr_mon etc can see them
...
...
@@ -214,8 +213,7 @@ int hal_port_init_all(char *logfilename)
hal_shmem_hdr
=
wrs_shm_get
(
wrs_shm_hal
,
"wrsw_hal"
,
WRS_SHM_WRITE
|
WRS_SHM_LOCKED
);
if
(
!
hal_shmem_hdr
)
{
fprintf
(
stderr
,
"%s: Can't join shmem: %s
\n
"
,
__func__
,
strerror
(
errno
));
pr_error
(
"Can't join shmem: %s
\n
"
,
strerror
(
errno
));
return
-
1
;
}
hal_shmem
=
wrs_shm_alloc
(
hal_shmem_hdr
,
sizeof
(
*
hal_shmem
));
...
...
@@ -223,7 +221,7 @@ int hal_port_init_all(char *logfilename)
sizeof
(
struct
hal_port_state
)
*
HAL_MAX_PORTS
);
if
(
!
hal_shmem
||
!
ports
)
{
fprintf
(
stderr
,
"%s: can't allocate in shmem
\n
"
,
__func__
);
pr_error
(
"Can't allocate in shmem
\n
"
);
return
-
1
;
}
...
...
@@ -318,7 +316,7 @@ static uint32_t pcs_readl(struct hal_port_state * p, int reg)
ifr
.
ifr_data
=
(
void
*
)
&
rv
;
// printf("raw fd %d name %s\n", hal_port_fd, ifr.ifr_name);
if
(
ioctl
(
hal_port_fd
,
PRIV_IOCPHYREG
,
&
ifr
)
<
0
)
{
fprintf
(
stderr
,
"ioctl failed
\n
"
);
pr_error
(
"ioctl failed
\n
"
);
};
// printf("PCS_readl: reg %d data %x\n", reg, NIC_RESULT_DATA(rv));
...
...
@@ -486,7 +484,7 @@ static void hal_port_insert_sfp(struct hal_port_state * p)
/* Mark SFP as found in data base */
p
->
calib
.
sfp
.
flags
|=
SFP_FLAG_IN_DB
;
}
else
{
fprintf
(
stderr
,
"Unknown SFP vn=
\"
%.16s
\"
pn=
\"
%.16s
\"
"
pr_error
(
"Unknown SFP vn=
\"
%.16s
\"
pn=
\"
%.16s
\"
"
"vs=
\"
%.16s
\"
on port %s
\n
"
,
shdr
.
vendor_name
,
shdr
.
vendor_pn
,
shdr
.
vendor_serial
,
p
->
name
);
memset
(
&
p
->
calib
.
sfp
,
0
,
sizeof
(
p
->
calib
.
sfp
));
...
...
@@ -525,7 +523,7 @@ static void hal_port_insert_sfp(struct hal_port_state * p)
return
;
}
fprintf
(
stderr
,
"Port %s, SFP vn=
\"
%.16s
\"
pn=
\"
%.16s
\"
vs=
\"
%.16s
\"
, "
pr_error
(
"Port %s, SFP vn=
\"
%.16s
\"
pn=
\"
%.16s
\"
vs=
\"
%.16s
\"
, "
"fiber %i: no alpha known
\n
"
,
p
->
name
,
p
->
calib
.
sfp
.
vendor_name
,
p
->
calib
.
sfp
.
part_num
,
p
->
calib
.
sfp
.
vendor_serial
,
p
->
fiber_index
);
...
...
userspace/wrsw_hal/hal_timing.c
View file @
1059c398
...
...
@@ -45,7 +45,7 @@ int hal_init_timing(char *filename)
timing_mode
=
m
->
modevalue
;
if
(
!
m
->
cfgname
)
fprintf
(
stderr
,
"%s: no config variable set, defaults used
\n
"
,
pr_error
(
"%s: no config variable set, defaults used
\n
"
,
__func__
);
/* initialize the RT Subsys */
...
...
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