Blob Blame History Raw
From 713b589fcb659bfdfe2b3ba283236d9a7932fe9d Mon Sep 17 00:00:00 2001
From: Jens Osterkamp <jens@linux.vnet.ibm.com>
Date: Sun, 6 Mar 2011 21:38:54 -0800
Subject: [PATCH 21/51] consolidate ecp_somethingChangedlocal

This patch consolidates all modifications of vd->ecp.tx.localchange into
using ecp_somethingChangelocal like vdp_somethingChangedlocal for more
consistent interface and easier debugging.

Signed-off-by: Jens Osterkamp <jens@linux.vnet.ibm.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Petr Sabata <psabata@redhat.com>
---
 ecp/ecp_tx.c |   17 ++++++++++-------
 lldp_vdp.c   |    7 ++++---
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/ecp/ecp_tx.c b/ecp/ecp_tx.c
index 05c4818..99d5cae 100644
--- a/ecp/ecp_tx.c
+++ b/ecp/ecp_tx.c
@@ -48,12 +48,15 @@ void ecp_tx_run_sm(struct vdp_data *);
  * used  to signal an ecpdu needs to be sent out.
  */
 
-void ecp_somethingChangedLocal(struct vdp_data *vd)
+void ecp_somethingChangedLocal(struct vdp_data *vd, bool flag)
 {
 	if (!vd)
 		return;
 
-	vd->ecp.tx.localChange = true;
+	LLDPAD_DBG("%s(%i): setting vd->ecp.tx.localChange to %s.", __func__,
+		   __LINE__, (flag == true) ? "true" : "false");
+
+	vd->ecp.tx.localChange = flag;
 
 	return;
 }
@@ -218,7 +221,7 @@ void ecp_tx_Initialize(struct vdp_data *vd)
 		free(vd->ecp.tx.frameout);
 		vd->ecp.tx.frameout = NULL;
 	}
-	vd->ecp.tx.localChange = true;
+	ecp_somethingChangedLocal(vd, true);
 	vd->ecp.lastSequence = ECP_SEQUENCE_NR_START;
 	vd->ecp.stats.statsFramesOutTotal = 0;
 	vd->ecp.ackTimer = ECP_ACK_TIMER_STOPPED;
@@ -267,7 +270,7 @@ void ecp_tx_create_frame(struct vdp_data *vd)
 		ecp_txFrame(vd);
 	}
 
-	vd->ecp.tx.localChange = false;
+	ecp_somethingChangedLocal(vd, false);
 	return;
 }
 
@@ -395,7 +398,7 @@ static bool ecp_set_tx_state(struct vdp_data *vd)
 		if (ecp_ackTimer_expired(vd)) {
 			vd->ecp.retries++;
 			if (vd->ecp.retries < ECP_MAX_RETRIES) {
-				ecp_somethingChangedLocal(vd);
+				ecp_somethingChangedLocal(vd, true);
 				ecp_tx_change_state(vd, ECP_TX_TRANSMIT_ECPDU);
 				return true;
 			}
@@ -446,7 +449,7 @@ void ecp_tx_run_sm(struct vdp_data *vd)
 		case ECP_TX_TRANSMIT_ECPDU:
 			ecp_tx_create_frame(vd);
 			ecp_tx_start_ackTimer(vd);
-			vd->ecp.tx.localChange = false;
+			ecp_somethingChangedLocal(vd, false);
 			break;
 		case ECP_TX_WAIT_FOR_ACK:
 			if (vd->ecp.ackReceived) {
@@ -454,7 +457,7 @@ void ecp_tx_run_sm(struct vdp_data *vd)
 				       vd->ifname);
 				LLDPAD_DBG("%s(%i)-%s: seqECPDU %x lastSequence %x \n", __func__, __LINE__,
 				       vd->ifname, vd->ecp.seqECPDU, vd->ecp.lastSequence);
-				vd->ecp.tx.localChange = false;
+				ecp_somethingChangedLocal(vd, false);
 				ecp_tx_stop_ackTimer(vd);
 			}
 			break;
diff --git a/lldp_vdp.c b/lldp_vdp.c
index d8e7c52..e6ee7e8 100644
--- a/lldp_vdp.c
+++ b/lldp_vdp.c
@@ -510,7 +510,7 @@ void vdp_vsi_sm_station(struct vsi_profile *profile)
 			vdp_stop_keepaliveTimer(profile);
 			profile->response = VDP_RESPONSE_NO_RESPONSE;
 			if (profile->localChange) {
-				ecp_somethingChangedLocal(vd);
+				ecp_somethingChangedLocal(vd, true);
 				vdp_start_ackTimer(profile);
 			}
 			break;
@@ -524,7 +524,7 @@ void vdp_vsi_sm_station(struct vsi_profile *profile)
 			vdp_stop_keepaliveTimer(profile);
 			profile->response = VDP_RESPONSE_NO_RESPONSE;
 			if (profile->localChange) {
-				ecp_somethingChangedLocal(vd);
+				ecp_somethingChangedLocal(vd, true);
 				vdp_start_ackTimer(profile);
 			}
 			break;
@@ -535,10 +535,11 @@ void vdp_vsi_sm_station(struct vsi_profile *profile)
 			vdp_start_keepaliveTimer(profile);
 			break;
 		case VSI_DEASSOC_PROCESSING:
+			profile->ackReceived = false;
 			vdp_stop_keepaliveTimer(profile);
 			profile->response = VDP_RESPONSE_NO_RESPONSE;
 			if (profile->localChange) {
-				ecp_somethingChangedLocal(vd);
+				ecp_somethingChangedLocal(vd, true);
 				vdp_start_ackTimer(profile);
 			}
 			break;
-- 
1.7.4.4