Change in libosmocore[master]: gprs_ns2_sns: refactor nss_weight_sum_data -> ip46_weight_sum_data

laforge gerrit-no-reply at lists.osmocom.org
Sun Jun 13 18:31:25 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/24588 )

Change subject: gprs_ns2_sns: refactor nss_weight_sum_data -> ip46_weight_sum_data
......................................................................

gprs_ns2_sns: refactor nss_weight_sum_data -> ip46_weight_sum_data

Allow to use ip46_weight_sum_data for local endpoints as well.

Related: OS#5036
Change-Id: I75d88f3da89ad13e34a3fd5ae72bd967d81f4abc
---
M src/gb/gprs_ns2_sns.c
1 file changed, 7 insertions(+), 7 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 2256758..d7ff47a 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -209,13 +209,13 @@
 #define ip6_weight_sum_data(elems)		ip6_weight_sum(elems, true)
 #define ip6_weight_sum_sig(elems)		ip6_weight_sum(elems, false)
 
-static int nss_weight_sum(const struct ns2_sns_state *nss, bool data_weight)
+static int ip46_weight_sum(const struct ns2_sns_elems *elems, bool data_weight)
 {
-	return ip4_weight_sum(&nss->remote, data_weight) +
-	       ip6_weight_sum(&nss->remote, data_weight);
+	return ip4_weight_sum(elems, data_weight) +
+	       ip6_weight_sum(elems, data_weight);
 }
-#define nss_weight_sum_data(nss)	nss_weight_sum(nss, true)
-#define nss_weight_sum_sig(nss)		nss_weight_sum(nss, false)
+#define ip46_weight_sum_data(elems)		ip46_weight_sum(elems, true)
+#define ip46_weight_sum_sig(elems)		ip46_weight_sum(elems, false)
 
 static struct gprs_ns2_vc *nsvc_by_ip4_elem(struct gprs_ns2_nse *nse,
 					    const struct gprs_ns_ie_ip4_elem *ip4)
@@ -1068,7 +1068,7 @@
 		}
 		if (event == GPRS_SNS_EV_RX_CONFIG_END) {
 			/* check if sum of data / sig weights == 0 */
-			if (nss_weight_sum_data(gss) == 0 || nss_weight_sum_sig(gss) == 0) {
+			if (ip46_weight_sum_data(&gss->remote) == 0 || ip46_weight_sum_sig(&gss->remote) == 0) {
 				cause = NS_CAUSE_INVAL_WEIGH;
 				ns2_tx_sns_config_ack(gss->sns_nsvc, &cause);
 				osmo_fsm_inst_state_chg(fi, GPRS_SNS_ST_UNCONFIGURED, 0, 0);
@@ -2095,7 +2095,7 @@
 		/* only change state if last CONFIG was received */
 		if (event == GPRS_SNS_EV_RX_CONFIG_END) {
 			/* ensure sum of data weight / sig weights is > 0 */
-			if (nss_weight_sum_data(gss) == 0 || nss_weight_sum_sig(gss) == 0) {
+			if (ip46_weight_sum_data(&gss->remote) == 0 || ip46_weight_sum_sig(&gss->remote) == 0) {
 				cause = NS_CAUSE_INVAL_WEIGH;
 				ns2_tx_sns_config_ack(gss->sns_nsvc, &cause);
 				osmo_fsm_inst_state_chg(fi, GPRS_SNS_ST_UNCONFIGURED, 0, 0);

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/24588
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I75d88f3da89ad13e34a3fd5ae72bd967d81f4abc
Gerrit-Change-Number: 24588
Gerrit-PatchSet: 3
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210613/9a023264/attachment.htm>


More information about the gerrit-log mailing list