[PATCH 2/4] Staging: bcm: Outsourced copying of classifier table
Jake Edge
jake at edge2.net
Tue Jun 24 02:39:52 UTC 2014
On Mon, 23 Jun 2014 21:50:45 +0200 Matthias Beyer wrote:
> 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++) {
I guess I am not clear on why these loops need to be "outsourced" ... both
this and copy_sf_table() are only called once and from the same indentation
level as the functions replacing them ... maybe I am missing something?
jake
--
Jake Edge - jake at edge2.net - http://www.edge2.net
More information about the devel
mailing list