Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Ezekiel Dohmen
advLigoRTS
Commits
49224e28
Commit
49224e28
authored
Oct 03, 2022
by
Ezekiel Dohmen
Browse files
Trying to only mark witer side active
parent
e5f42200
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/pcie_switch/kmod/cdsrfmswitch_core.c
View file @
49224e28
...
...
@@ -111,7 +111,6 @@ volatile static uint64_t max_copy_times_ns[RFMX_NUM_COPY_CPUS] = {0,};
volatile
static
uint64_t
total_copies
[
RFMX_NUM_COPY_CPUS
]
=
{
1
,};
static
int
ipcActive
[
RFMX_TOTAL_SEGMENTS
][
RFMX_MAX_CHANS_PER_RFM
];
static
int
isReadSide
[
RFMX_TOTAL_SEGMENTS
][
RFMX_MAX_CHANS_PER_RFM
];
static
volatile
int
stop_working_threads
;
static
int
mysysstatus
;
static
int
g_copy_cpu_nums
[
RFMX_NUM_COPY_CPUS
]
=
{
3
,
4
,
5
,
6
};
//These are the cores we isolate the copy threads on
...
...
@@ -149,9 +148,10 @@ int monitorActiveConnections(void *data)
int
delay
=
((
struct
monitor_thread_params_t
*
)
data
)
->
delay
;
unsigned
long
syncWord
;
int
i
i
,
jj
,
kk
,
mm
;
int
i
pc_index
,
dolphin_net
,
kk
,
mm
;
static
int
traffic
[
RFMX_TOTAL_SEGMENTS
];
int
swstatus
;
int
other_side
;
if
(
g_dolphin_read_addrs
[
RFM0_EX_ADDR_INDEX
]
!=
NULL
&&
g_dolphin_read_addrs
[
RFM0_CS_ADDR_INDEX
]
!=
NULL
&&
...
...
@@ -161,30 +161,45 @@ int monitorActiveConnections(void *data)
while
(
!
kthread_should_stop
())
{
// Check port activity once per second
msleep
(
delay
);
for
(
jj
=
0
;
jj
<
RFMX_TOTAL_SEGMENTS
;
jj
++
)
{
for
(
dolphin_net
=
0
;
dolphin_net
<
RFMX_TOTAL_SEGMENTS
;
dolphin_net
++
)
{
mycounter
[
jj
]
=
0
;
for
(
i
i
=
0
;
ii
<
indx
;
ii
++
)
{
mycounter
[
dolphin_net
]
=
0
;
for
(
i
pc_index
=
0
;
ipc_index
<
indx
;
ipc_index
++
)
{
// Will send port activity info to EPICS via 32 bit ints
kk
=
i
i
/
32
;
mm
=
i
i
%
32
;
kk
=
i
pc_index
/
32
;
mm
=
i
pc_index
%
32
;
// Determine active channels by change in data timestamp
// Only checking first data block of each channel, as should have
// changed in the last second if active.
syncWord
=
g_dolphin_read_addrs
[
jj
]
->
dBlock
[
0
][
ii
].
timestamp
;
if
(
syncWord
!=
lastSyncWord
[
jj
][
ii
])
{
// Indicate channel active for data xfer threads
ipcActive
[
jj
][
ii
]
=
1
;
lastSyncWord
[
jj
][
ii
]
=
syncWord
;
syncWord
=
g_dolphin_read_addrs
[
dolphin_net
]
->
dBlock
[
0
][
ipc_index
].
timestamp
;
if
(
dolphin_net
==
RFM0_EX_ADDR_INDEX
)
other_side
=
RFM0_CS_ADDR_INDEX
;
else
if
(
dolphin_net
==
RFM0_CS_ADDR_INDEX
)
other_side
=
RFM0_EX_ADDR_INDEX
;
else
if
(
dolphin_net
==
RFM1_EY_ADDR_INDEX
)
other_side
=
RFM1_CS_ADDR_INDEX
;
else
other_side
=
RFM1_EY_ADDR_INDEX
;
if
(
syncWord
!=
lastSyncWord
[
dolphin_net
][
ipc_index
]
)
{
if
(
ipcActive
[
other_side
][
ipc_index
]
==
0
)
{
// Indicate channel active for data xfer threads (only writer side)
ipcActive
[
dolphin_net
][
ipc_index
]
=
1
;
}
lastSyncWord
[
dolphin_net
][
ipc_index
]
=
syncWord
;
// Increment the active channel counter for this network
mycounter
[
jj
]
+=
1
;
mycounter
[
dolphin_net
]
+=
1
;
// Set the active port info for EPICS
myactive
[
jj
][
kk
]
|=
(
1
<<
mm
);
myactive
[
dolphin_net
][
kk
]
|=
(
1
<<
mm
);
}
else
{
// Indicate channel NOT active for data xfer threads
ipcActive
[
jj
][
ii
]
=
0
;
ipcActive
[
dolphin_net
][
ipc_index
]
=
0
;
// Unset active port info for EPICS
myactive
[
jj
][
kk
]
&=
~
(
1
<<
mm
);
myactive
[
dolphin_net
][
kk
]
&=
~
(
1
<<
mm
);
}
}
}
...
...
@@ -194,10 +209,10 @@ int monitorActiveConnections(void *data)
// Check traffic for all data xfer threads
// and set thread status bits.
swstatus
=
0
;
for
(
jj
=
0
;
jj
<
RFMX_TOTAL_SEGMENTS
;
jj
++
)
{
if
(
traffic
[
jj
]
!=
mytraffic
[
jj
])
{
traffic
[
jj
]
=
mytraffic
[
jj
];
swstatus
|=
(
1
<<
jj
);
for
(
dolphin_net
=
0
;
dolphin_net
<
RFMX_TOTAL_SEGMENTS
;
dolphin_net
++
)
{
if
(
traffic
[
dolphin_net
]
!=
mytraffic
[
dolphin_net
])
{
traffic
[
dolphin_net
]
=
mytraffic
[
dolphin_net
];
swstatus
|=
(
1
<<
dolphin_net
);
}
}
// Copy data xfer thread status to be sent to EPICS
...
...
@@ -230,7 +245,7 @@ inline int copyIpcData (int start_indx, int end_indx, int netFrom, int netTo)
// Scan thru switching ports for new data
for
(
ii
=
start_indx
;
ii
<=
eor
;
ii
++
)
{
// Copy data only if port is active, as marked by switch monitor task
if
(
ipcActive
[
netFrom
][
ii
]
&&
isReadSide
[
netFrom
][
ii
]
==
0
)
{
if
(
ipcActive
[
netFrom
][
ii
]
)
{
start_ipc_datapoint
=
expected_ipc_datapoint
[
netTo
][
ii
];
...
...
@@ -247,7 +262,6 @@ inline int copyIpcData (int start_indx, int end_indx, int netFrom, int netTo)
memcpy
(
(
void
*
)
&
g_dolphin_write_addrs
[
netTo
]
->
dBlock
[
start_ipc_datapoint
][
ii
],
&
tmp_block
,
sizeof
(
tmp_block
));
syncArray
[
netFrom
][
start_ipc_datapoint
][
ii
]
=
syncWord
;
expected_ipc_datapoint
[
netTo
][
ii
]
=
(
start_ipc_datapoint
+
4
)
%
IPC_BLOCKS
;
isReadSide
[
netTo
][
ii
]
=
1
;
//cblock = start_ipc_datapoint;
//dblock = ii;
ttcache
+=
1
;
...
...
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment