Blame SOURCES/lldpad-0.9.46-Ignore-supplied-PG-configuration-if-PG-is-being-disabled.patch

3e0fe9
Disabling PG currently validates the entire given PG config,
3e0fe9
even if no configuration is given.  Of course since PG is
3e0fe9
being disabled, the configuration wouldn't be used anyway, so
3e0fe9
ignore any PG configuration given when disabling it.
3e0fe9
3e0fe9
Signed-off-by: Dan Williams <dcbw at redhat.com>
3e0fe9
---
3e0fe9
 lldp_dcbx_cmds.c | 5 +++++
3e0fe9
 1 file changed, 5 insertions(+)
3e0fe9
3e0fe9
diff --git a/lldp_dcbx_cmds.c b/lldp_dcbx_cmds.c
3e0fe9
index 7fdf6c4..8dcee7a 100644
3e0fe9
--- a/lldp_dcbx_cmds.c
3e0fe9
+++ b/lldp_dcbx_cmds.c
3e0fe9
@@ -939,14 +939,18 @@ static int set_pg_config(pg_attribs *pg_data, char *port_id, char *ibuf,
3e0fe9
 	cmd_status status = cmd_success;
3e0fe9
 	int i, is_pfc;
3e0fe9
 	int plen;
3e0fe9
 	int off;
3e0fe9
 	bool used[MAX_BANDWIDTH_GROUPS];
3e0fe9
 	bool uppcts_changed = false;
3e0fe9
 
3e0fe9
+	/* If PG is disabled, skip changing any other attributes */
3e0fe9
+	if (!(pg_data->protocol.Enable))
3e0fe9
+		goto done;
3e0fe9
+
3e0fe9
 	plen=strlen(port_id);
3e0fe9
 	off = DCB_PORT_OFF + plen + CFG_LEN;
3e0fe9
 
3e0fe9
 	if (ilen == (off + CFG_PG_DLEN)) {
3e0fe9
 		for (i = 0; i < MAX_USER_PRIORITIES; i++) {
3e0fe9
 			flag = *(ibuf+off+PG_UP2TC(i));
3e0fe9
 			if (flag == CLIF_NOT_SUPPLIED)
3e0fe9
@@ -1063,14 +1067,15 @@ static int set_pg_config(pg_attribs *pg_data, char *port_id, char *ibuf,
3e0fe9
 	}
3e0fe9
 
3e0fe9
 	if (status != cmd_success) {
3e0fe9
 		printf("invalid DCB settings\n");
3e0fe9
 		return status;
3e0fe9
 	}
3e0fe9
 
3e0fe9
+done:
3e0fe9
 	is_pfc = get_pfc(port_id, &pfc_data);
3e0fe9
 	if (is_pfc == cmd_success)
3e0fe9
 		status = put_pg(port_id, pg_data, &pfc_data);
3e0fe9
 	else
3e0fe9
 		status = put_pg(port_id, pg_data, NULL);
3e0fe9
 
3e0fe9
 	if (status != cmd_success)
3e0fe9
-- 
3e0fe9
1.8.5.3