netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Dmitry Kravkov" <dmitry@broadcom.com>
To: davem@davemloft.net, netdev@vger.kernel.org
Cc: "Dmitry Kravkov" <dmitry@broadcom.com>,
	"Eilon Greenstein" <eilong@broadcom.com>
Subject: [PATCH v3 net-next 06/12] bnx2x: DCBX: use #define instead of magic
Date: Sun, 13 Nov 2011 16:34:26 +0200	[thread overview]
Message-ID: <1321194872-8276-7-git-send-email-dmitry@broadcom.com> (raw)
In-Reply-To: <1321194872-8276-1-git-send-email-dmitry@broadcom.com>

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c |    6 +++---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.h |    4 +++-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c
index a0598fd..5051cf3 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c
@@ -874,7 +874,7 @@ static void bnx2x_dcbx_admin_mib_updated_params(struct bnx2x *bp,
 		/*For IEEE admin_recommendation_bw_precentage
 		 *For IEEE admin_recommendation_ets_pg */
 		af->pfc.pri_en_bitmap = (u8)dp->admin_pfc_bitmap;
-		for (i = 0; i < 4; i++) {
+		for (i = 0; i < DCBX_CONFIG_MAX_APP_PROTOCOL; i++) {
 			if (dp->admin_priority_app_table[i].valid) {
 				struct bnx2x_admin_priority_app_table *table =
 					dp->admin_priority_app_table;
@@ -2249,7 +2249,7 @@ static int bnx2x_set_admin_app_up(struct bnx2x *bp, u8 idtype, u16 idval, u8 up)
 	int i, ff;
 
 	/* iterate over the app entries looking for idtype and idval */
-	for (i = 0, ff = -1; i < 4; i++) {
+	for (i = 0, ff = -1; i < DCBX_CONFIG_MAX_APP_PROTOCOL; i++) {
 		struct bnx2x_admin_priority_app_table *app_ent =
 			&bp->dcbx_config_params.admin_priority_app_table[i];
 		if (bnx2x_admin_app_is_equal(app_ent, idtype, idval))
@@ -2258,7 +2258,7 @@ static int bnx2x_set_admin_app_up(struct bnx2x *bp, u8 idtype, u16 idval, u8 up)
 		if (ff < 0 && !app_ent->valid)
 			ff = i;
 	}
-	if (i < 4)
+	if (i < DCBX_CONFIG_MAX_APP_PROTOCOL)
 		/* if found overwrite up */
 		bp->dcbx_config_params.
 			admin_priority_app_table[i].priority = up;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.h
index 2c6a3bc..2ab9254 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.h
@@ -90,6 +90,7 @@ struct bnx2x_admin_priority_app_table {
 		u32 app_id;
 };
 
+#define DCBX_CONFIG_MAX_APP_PROTOCOL 4
 struct bnx2x_config_dcbx_params {
 	u32 overwrite_settings;
 	u32 admin_dcbx_version;
@@ -109,7 +110,8 @@ struct bnx2x_config_dcbx_params {
 	u32 admin_recommendation_bw_precentage[8];
 	u32 admin_recommendation_ets_pg[8];
 	u32 admin_pfc_bitmap;
-	struct bnx2x_admin_priority_app_table admin_priority_app_table[4];
+	struct bnx2x_admin_priority_app_table
+		admin_priority_app_table[DCBX_CONFIG_MAX_APP_PROTOCOL];
 	u32 admin_default_priority;
 };
 
-- 
1.7.7.2

  parent reply	other threads:[~2011-11-13 14:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-13 14:34 [PATCH v3 net-next 00/12] bnx2x series Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 01/12] bnx2x: allow FCoE and DCB for 578xx Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 02/12] bnx2x: use rx_queue index for skb_record_rx_queue() Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 03/12] bnx2x: remove unused variable Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 04/12] bnx2x: separate FCoE and iSCSI license initialization Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 05/12] bnx2x: propagate DCBX negotiation Dmitry Kravkov
2011-11-13 14:34 ` Dmitry Kravkov [this message]
2011-11-13 14:34 ` [PATCH v3 net-next 07/12] bnx2x: simplify definition of RX_SGE_MASK_LEN and use it Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 08/12] bnx2x: remove unused #define Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 09/12] bnx2x: add fan failure event handling Dmitry Kravkov
2011-11-13 21:11   ` Joe Perches
     [not found]     ` <80A6ED01A151614884EE6C5D6AF0F2E9099806AF42@SJEXCHCCR01.corp.ad.broadcom.com>
2011-11-14  8:28       ` Dmitry Kravkov
2011-11-14  8:37         ` David Miller
2011-11-13 14:34 ` [PATCH v3 net-next 10/12] bnx2x: prevent race in statistics flow Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 11/12] bnx2x: Remove on-stack napi struct variable Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 12/12] bnx2x: update driver version to 1.70.35-0 Dmitry Kravkov
2011-11-13 21:06 ` [PATCH v3 net-next 00/12] bnx2x series David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1321194872-8276-7-git-send-email-dmitry@broadcom.com \
    --to=dmitry@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=eilong@broadcom.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).