net: qrtr: ns: Fix Announce services for all nodes

ns service was notifying only local node ID services after
a pci disconnect and reconnect. Fix it to iterate over all
nodes and announce services of all nodes.

Change-Id: I4f91a71ad847b815318a7de47134f6b9c57dff53
Signed-off-by: Manoharan Vijaya Raghavan <mraghava@codeaurora.org>
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
This commit is contained in:
Chris Lew 2022-11-01 14:39:30 -07:00 committed by Gerrit - the friendly Code Review server
parent 8e0779d502
commit 81f44092bc

View File

@ -228,24 +228,26 @@ static int announce_servers(struct sockaddr_qrtr *sq)
struct qrtr_server *srv;
struct qrtr_node *node;
unsigned long index;
unsigned long node_idx;
int ret;
node = node_get(qrtr_ns.local_node);
if (!node)
return 0;
/* Announce the list of servers registered in this node */
xa_for_each(&node->servers, index, srv) {
ret = service_announce_new(sq, srv);
if (ret < 0) {
if (ret == -ENODEV)
continue;
xa_for_each(&nodes, node_idx, node) {
if (node->id == sq->sq_node) {
pr_info("Avoiding duplicate announce for NODE ID %u\n", node->id);
continue;
}
xa_for_each(&node->servers, index, srv) {
ret = service_announce_new(sq, srv);
if (ret < 0) {
if (ret == -ENODEV)
continue;
pr_err("failed to announce new service %d\n", ret);
return ret;
pr_err("failed to announce new service %d\n", ret);
return ret;
}
}
}
return 0;
}