[PATCH 3/4] Staging: bcm: Outsourced SF table copying

Matthias Beyer mail at beyermatthias.de
Mon Jun 23 19:50:46 UTC 2014


This commit includes renaming of variables which got outsourced into an
own function to fit the kernel styleguide.

Signed-off-by: Matthias Beyer <mail at beyermatthias.de>
---
 drivers/staging/bcm/hostmibs.c | 70 +++++++++++++++++++++++-------------------
 1 file changed, 39 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/bcm/hostmibs.c b/drivers/staging/bcm/hostmibs.c
index 13c1430..63bfb04 100644
--- a/drivers/staging/bcm/hostmibs.c
+++ b/drivers/staging/bcm/hostmibs.c
@@ -25,32 +25,23 @@ static void copy_classifier_table(struct bcm_mini_adapter *ad,
 
 }
 
-INT ProcessGetHostMibs(struct bcm_mini_adapter *Adapter,
-		       struct bcm_host_stats_mibs *pstHostMibs)
+static void copy_sf_table(struct bcm_mini_adapter *ad,
+			  struct bcm_host_stats_mibs *mibs,
+			  struct bcm_phs_extension *dev_extension)
 {
-	struct bcm_phs_entry *pstServiceFlowEntry = NULL;
-	struct bcm_phs_rule *pstPhsRule = NULL;
-	struct bcm_phs_classifier_table *pstClassifierTable = NULL;
-	struct bcm_phs_classifier_entry *pstClassifierRule = NULL;
-	struct bcm_phs_extension *pDeviceExtension = &Adapter->stBCMPhsContext;
-	struct bcm_mibs_host_info *host_info;
-	UINT nPhsTableIndex = 0;
+	struct bcm_phs_classifier_table *classifier_table = NULL;
+	struct bcm_phs_classifier_entry *classifier_rule = NULL;
+	struct bcm_phs_entry *service_flow_entry = NULL;
+	struct bcm_phs_rule *phs_rule = NULL;
 	UINT nSfIndex = 0;
+	UINT nPhsTableIndex = 0;
 	UINT uiIndex = 0;
 
-	if (pDeviceExtension == NULL) {
-		BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, HOST_MIBS,
-				DBG_LVL_ALL, "Invalid Device Extension\n");
-		return STATUS_FAILURE;
-	}
-
-	copy_classifier_table(Adapter, pstHostMibs);
-
 	/* Copy the SF Table */
 	for (nSfIndex = 0; nSfIndex < NO_OF_QUEUES; nSfIndex++) {
-		if (Adapter->PackInfo[nSfIndex].bValid) {
-			memcpy(&pstHostMibs->astSFtable[nSfIndex],
-			       &Adapter->PackInfo[nSfIndex],
+		if (ad->PackInfo[nSfIndex].bValid) {
+			memcpy(&mibs->astSFtable[nSfIndex],
+			       &ad->PackInfo[nSfIndex],
 			       sizeof(struct bcm_mibs_table));
 		} else {
 			/* If index in not valid,
@@ -62,26 +53,26 @@ INT ProcessGetHostMibs(struct bcm_mini_adapter *Adapter,
 
 		/* Retrieve the SFID Entry Index for requested Service Flow */
 		if (PHS_INVALID_TABLE_INDEX ==
-		    GetServiceFlowEntry(pDeviceExtension->
+		    GetServiceFlowEntry(dev_extension->
 					pstServiceFlowPhsRulesTable,
-					Adapter->PackInfo[nSfIndex].
-					usVCID_Value, &pstServiceFlowEntry))
+					ad->PackInfo[nSfIndex].
+					usVCID_Value, &service_flow_entry))
 
 			continue;
 
-		pstClassifierTable = pstServiceFlowEntry->pstClassifierTable;
+		classifier_table = service_flow_entry->pstClassifierTable;
 
 		for (uiIndex = 0; uiIndex < MAX_PHSRULE_PER_SF; uiIndex++) {
-			pstClassifierRule = &pstClassifierTable->stActivePhsRulesList[uiIndex];
+			classifier_rule = &classifier_table->stActivePhsRulesList[uiIndex];
 
-			if (pstClassifierRule->bUsed) {
-				pstPhsRule = pstClassifierRule->pstPhsRule;
+			if (classifier_rule->bUsed) {
+				phs_rule = classifier_rule->pstPhsRule;
 
-				pstHostMibs->astPhsRulesTable[nPhsTableIndex].
-				    ulSFID = Adapter->PackInfo[nSfIndex].ulSFID;
+				mibs->astPhsRulesTable[nPhsTableIndex].
+				    ulSFID = ad->PackInfo[nSfIndex].ulSFID;
 
-				memcpy(&pstHostMibs->astPhsRulesTable[nPhsTableIndex].u8PHSI,
-				       &pstPhsRule->u8PHSI,
+				memcpy(&mibs->astPhsRulesTable[nPhsTableIndex].u8PHSI,
+				       &phs_rule->u8PHSI,
 				       sizeof(struct bcm_phs_rule));
 				nPhsTableIndex++;
 
@@ -90,6 +81,23 @@ INT ProcessGetHostMibs(struct bcm_mini_adapter *Adapter,
 		}
 
 	}
+}
+
+INT ProcessGetHostMibs(struct bcm_mini_adapter *Adapter,
+		       struct bcm_host_stats_mibs *pstHostMibs)
+{
+	struct bcm_phs_extension *pDeviceExtension = &Adapter->stBCMPhsContext;
+	struct bcm_mibs_host_info *host_info;
+
+	if (pDeviceExtension == NULL) {
+		BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, HOST_MIBS,
+				DBG_LVL_ALL, "Invalid Device Extension\n");
+		return STATUS_FAILURE;
+	}
+
+	copy_classifier_table(Adapter, pstHostMibs);
+
+	copy_sf_table(Adapter, pstHostMibs, pDeviceExtension);
 
 	/* Copy other Host Statistics parameters */
 	host_info = &pstHostMibs->stHostInfo;
-- 
2.0.0



More information about the devel mailing list