[PATCH 2/4] Staging: bcm: Outsourced copying of classifier table

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


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

diff --git a/drivers/staging/bcm/hostmibs.c b/drivers/staging/bcm/hostmibs.c
index af3493c..13c1430 100644
--- a/drivers/staging/bcm/hostmibs.c
+++ b/drivers/staging/bcm/hostmibs.c
@@ -9,6 +9,22 @@
 
 #include "headers.h"
 
+static void copy_classifier_table(struct bcm_mini_adapter *ad,
+				  struct bcm_host_stats_mibs *mibs)
+{
+	UINT classifier_index = 0;
+
+	/* Copy the classifier Table */
+	for (classifier_index = 0; classifier_index < MAX_CLASSIFIERS;
+							classifier_index++) {
+		if (ad->astClassifierTable[classifier_index].bUsed == TRUE)
+			memcpy(&mibs->astClassifierTable[classifier_index],
+			       &ad->astClassifierTable[classifier_index],
+			       sizeof(struct bcm_mibs_classifier_rule));
+	}
+
+}
+
 INT ProcessGetHostMibs(struct bcm_mini_adapter *Adapter,
 		       struct bcm_host_stats_mibs *pstHostMibs)
 {
@@ -18,7 +34,6 @@ INT ProcessGetHostMibs(struct bcm_mini_adapter *Adapter,
 	struct bcm_phs_classifier_entry *pstClassifierRule = NULL;
 	struct bcm_phs_extension *pDeviceExtension = &Adapter->stBCMPhsContext;
 	struct bcm_mibs_host_info *host_info;
-	UINT nClassifierIndex = 0;
 	UINT nPhsTableIndex = 0;
 	UINT nSfIndex = 0;
 	UINT uiIndex = 0;
@@ -29,14 +44,7 @@ INT ProcessGetHostMibs(struct bcm_mini_adapter *Adapter,
 		return STATUS_FAILURE;
 	}
 
-	/* Copy the classifier Table */
-	for (nClassifierIndex = 0; nClassifierIndex < MAX_CLASSIFIERS;
-							nClassifierIndex++) {
-		if (Adapter->astClassifierTable[nClassifierIndex].bUsed == TRUE)
-			memcpy(&pstHostMibs->astClassifierTable[nClassifierIndex],
-			       &Adapter->astClassifierTable[nClassifierIndex],
-			       sizeof(struct bcm_mibs_classifier_rule));
-	}
+	copy_classifier_table(Adapter, pstHostMibs);
 
 	/* Copy the SF Table */
 	for (nSfIndex = 0; nSfIndex < NO_OF_QUEUES; nSfIndex++) {
-- 
2.0.0



More information about the devel mailing list