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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Matthias Beyer <mail@xxxxxxxxxxxxxxxx>
---
 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

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux