Commit 4dd506da authored by Aurelio Colosimo's avatar Aurelio Colosimo

proto-standard: do not depend on pp_links configuration

The pp_links mechanism, currently based on /etc/ppsi.conf file, shall not
be mandatory, since not all archs will use it. Thus, this patch reduces
at its minimum the dependency on ppi->nlinks. If an arch is not using
the pp_links, it just has to define nlinks=0 in pp_globals struct, and
the engine will work as well, assuming one pp_instance has been
configured in the main.
Signed-off-by: Aurelio Colosimo's avatarAurelio Colosimo <aurelio@aureliocolosimo.it>
parent a448a514
......@@ -23,10 +23,13 @@ static int wr_open(struct pp_globals *ppg, struct pp_runtime_opts *rt_opts)
static struct wr_data_t wr_data; /* WR-specific global data */
int i;
/* FIXME: used by arch-wrpc only; iface_name should be assigned
* in main in every arch*/
if ((ppg->nlinks == 1) && (!ppg->pp_instances[0].iface_name))
ppg->pp_instances[0].iface_name = "wr1";
/* If current arch (e.g. wrpc) is not using the 'pp_links style'
* configuration, just assume there is one ppi instance,
* already configured properly by the arch's main loop */
if (ppg->nlinks == 0) {
ppg->pp_instances[0].ext_data = &wr_data;
return 0;
}
for (i = 0; i < ppg->nlinks; i++) {
struct pp_link *lnk = &ppg->links[i];
......
......@@ -255,7 +255,7 @@ void bmc_update_ebest(struct pp_globals *ppg)
int i, best;
struct pp_instance *ppi, *ppi_best;
for (i = 1, best = 0 ; i < ppg->nlinks; i++) {
for (i = 1, best = 0; i < ppg->defaultDS->numberPorts; i++) {
ppi_best = &ppg->pp_instances[best];
ppi = &ppg->pp_instances[i];
......
......@@ -42,7 +42,10 @@ int pp_open_globals(struct pp_globals *ppg)
int i;
struct DSDefault *def = ppg->defaultDS;
def->twoStepFlag = TRUE;
def->numberPorts = ppg->nlinks;
/* if ppg->nlinks == 0, let's assume that the 'pp_links style'
* configuration was not used, so we have 1 port */
def->numberPorts = ppg->nlinks > 0 ? ppg->nlinks : 1;
struct pp_runtime_opts *rt_opts;
if (!ppg->rt_opts)
......@@ -53,9 +56,8 @@ int pp_open_globals(struct pp_globals *ppg)
memcpy(&def->clockQuality, &rt_opts->clock_quality,
sizeof(ClockQuality));
if (ppg->nlinks == 1) {
if (def->numberPorts == 1)
def->slaveOnly = ppg->pp_instances[0].slave_only;
}
else
def->slaveOnly = 1; /* the for cycle below will set it to 0 if not
* ports are not all slave_only */
......@@ -64,7 +66,7 @@ int pp_open_globals(struct pp_globals *ppg)
def->priority2 = rt_opts->prio2;
def->domainNumber = rt_opts->domain_number;
for (i = 0; i < ppg->nlinks; i++) {
for (i = 0; i < def->numberPorts; i++) {
if (def->slaveOnly && !ppg->pp_instances[i].slave_only)
def->slaveOnly = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment