[dpdk-dev] [PATCH v9 5/5] ixgbe/igb: changed register tables to const
Liang-Min Larry Wang
liang-min.wang at intel.com
Sat Jun 27 03:19:08 CEST 2015
Changed registers tables in ixgbe and igb to const type.
Signed-off-by: Andrew G. Harvey <agh at cisco.com>
Signed-off-by: Liang-Min Larry Wang <liang-min.wang at intel.com>
---
drivers/net/e1000/igb_ethdev.c | 8 ++++----
drivers/net/e1000/igb_regs.h | 28 ++++++++++++-------------
drivers/net/ixgbe/ixgbe_ethdev.c | 12 +++++------
drivers/net/ixgbe/ixgbe_regs.h | 44 ++++++++++++++++++++--------------------
4 files changed, 46 insertions(+), 46 deletions(-)
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 895d91d..745940e 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -3710,7 +3710,7 @@ eth_igb_get_reg_length(struct rte_eth_dev *dev __rte_unused)
{
int count = 0;
int g_ind = 0;
- struct reg_info *reg_group;
+ const struct reg_info *reg_group;
reg_group = igb_regs[g_ind++];
while (reg_group) {
@@ -3726,7 +3726,7 @@ igbvf_get_reg_length(struct rte_eth_dev *dev __rte_unused)
{
int count = 0;
int g_ind = 0;
- struct reg_info *reg_group;
+ const struct reg_info *reg_group;
reg_group = igbvf_regs[g_ind++];
while (reg_group) {
@@ -3745,7 +3745,7 @@ eth_igb_get_regs(struct rte_eth_dev *dev,
uint32_t *regs_buff = regs->buf;
int g_ind = 0;
int count = 0;
- struct reg_info *reg_group;
+ const struct reg_info *reg_group;
/* Support only full register dump */
if ((regs->leng == 0) ||
@@ -3772,7 +3772,7 @@ igbvf_get_regs(struct rte_eth_dev *dev,
uint32_t *regs_buff = regs->buf;
int g_ind = 0;
int count = 0;
- struct reg_info *reg_group;
+ const struct reg_info *reg_group;
/* Support only full register dump */
if ((regs->leng == 0) ||
diff --git a/drivers/net/e1000/igb_regs.h b/drivers/net/e1000/igb_regs.h
index ac66f8b..338575a 100644
--- a/drivers/net/e1000/igb_regs.h
+++ b/drivers/net/e1000/igb_regs.h
@@ -42,7 +42,7 @@ struct reg_info {
const char *name;
};
-static struct reg_info igb_regs_general[] = {
+static const struct reg_info igb_regs_general[] = {
{E1000_CTRL, 1, 1, "E1000_CTRL"},
{E1000_STATUS, 1, 1, "E1000_STATUS"},
{E1000_CTRL_EXT, 1, 1, "E1000_CTRL_EXT"},
@@ -58,12 +58,12 @@ static struct reg_info igb_regs_general[] = {
{0, 0, 0, ""}
};
-static struct reg_info igb_regs_nvm[] = {
+static const struct reg_info igb_regs_nvm[] = {
{E1000_EECD, 1, 1, "E1000_EECD"},
{0, 0, 0, ""}
};
-static struct reg_info igb_regs_interrupt[] = {
+static const struct reg_info igb_regs_interrupt[] = {
{E1000_EICS, 1, 1, "E1000_EICS"},
{E1000_EIMS, 1, 1, "E1000_EIMS"},
{E1000_EIMC, 1, 1, "E1000_EIMC"},
@@ -81,7 +81,7 @@ static struct reg_info igb_regs_interrupt[] = {
{0, 0, 0, ""}
};
-static struct reg_info igb_regs_fctl[] = {
+static const struct reg_info igb_regs_fctl[] = {
{E1000_FCAL, 1, 1, "E1000_FCAL"},
{E1000_FCAH, 1, 1, "E1000_FCAH"},
{E1000_FCTTV, 1, 1, "E1000_FCTTV"},
@@ -91,7 +91,7 @@ static struct reg_info igb_regs_fctl[] = {
{0, 0, 0, ""}
};
-static struct reg_info igb_regs_rxdma[] = {
+static const struct reg_info igb_regs_rxdma[] = {
{E1000_RDBAL(0), 4, 0x100, "E1000_RDBAL"},
{E1000_RDBAH(0), 4, 0x100, "E1000_RDBAH"},
{E1000_RDLEN(0), 4, 0x100, "E1000_RDLEN"},
@@ -103,7 +103,7 @@ static struct reg_info igb_regs_rxdma[] = {
{0, 0, 0, ""}
};
-static struct reg_info igb_regs_rx[] = {
+static const struct reg_info igb_regs_rx[] = {
{E1000_RCTL, 1, 1, "E1000_RCTL"},
{E1000_RXCSUM, 1, 1, "E1000_RXCSUM"},
{E1000_RLPML, 1, 1, "E1000_RLPML"},
@@ -115,7 +115,7 @@ static struct reg_info igb_regs_rx[] = {
{0, 0, 0, ""}
};
-static struct reg_info igb_regs_tx[] = {
+static const struct reg_info igb_regs_tx[] = {
{E1000_TCTL, 1, 1, "E1000_TCTL"},
{E1000_TCTL_EXT, 1, 1, "E1000_TCTL_EXT"},
{E1000_TIPG, 1, 1, "E1000_TIPG"},
@@ -136,7 +136,7 @@ static struct reg_info igb_regs_tx[] = {
{0, 0, 0, ""}
};
-static struct reg_info igb_regs_wakeup[] = {
+static const struct reg_info igb_regs_wakeup[] = {
{E1000_WUC, 1, 1, "E1000_WUC"},
{E1000_WUFC, 1, 1, "E1000_WUFC"},
{E1000_WUS, 1, 1, "E1000_WUS"},
@@ -151,7 +151,7 @@ static struct reg_info igb_regs_wakeup[] = {
{0, 0, 0, ""}
};
-static struct reg_info igb_regs_mac[] = {
+static const struct reg_info igb_regs_mac[] = {
{E1000_PCS_CFG0, 1, 1, "E1000_PCS_CFG0"},
{E1000_PCS_LCTL, 1, 1, "E1000_PCS_LCTL"},
{E1000_PCS_LSTAT, 1, 1, "E1000_PCS_LSTAT"},
@@ -162,7 +162,7 @@ static struct reg_info igb_regs_mac[] = {
{0, 0, 0, ""}
};
-static struct reg_info *igb_regs[] = {
+static const struct reg_info *igb_regs[] = {
igb_regs_general,
igb_regs_nvm,
igb_regs_interrupt,
@@ -177,14 +177,14 @@ static struct reg_info *igb_regs[] = {
/* FIXME: reading igb_regs_interrupt results side-effect which doesn't
* work with VFIO; re-install igb_regs_interrupt once issue is resolved.
*/
-static struct reg_info *igbvf_regs[] = {
+static const struct reg_info *igbvf_regs[] = {
igb_regs_general,
igb_regs_rxdma,
igb_regs_tx,
NULL};
static inline int
-igb_read_regs(struct e1000_hw *hw, struct reg_info *reg, uint32_t *reg_buf)
+igb_read_regs(struct e1000_hw *hw, const struct reg_info *reg, uint32_t *reg_buf)
{
unsigned int i;
@@ -196,7 +196,7 @@ igb_read_regs(struct e1000_hw *hw, struct reg_info *reg, uint32_t *reg_buf)
};
static inline int
-igb_reg_group_count(struct reg_info *regs)
+igb_reg_group_count(const struct reg_info *regs)
{
int count = 0;
int i = 0;
@@ -210,7 +210,7 @@ igb_reg_group_count(struct reg_info *regs)
static inline int
igb_read_regs_group(struct rte_eth_dev *dev, uint32_t *reg_buf,
- struct reg_info *regs)
+ const struct reg_info *regs)
{
int count = 0;
int i = 0;
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index e2be855..4be8e07 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -4545,8 +4545,8 @@ ixgbe_get_reg_length(struct rte_eth_dev *dev __rte_unused)
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
int count = 0;
int g_ind = 0;
- struct reg_info *reg_group;
- struct reg_info **reg_set = (hw->mac.type == ixgbe_mac_82598EB) ?
+ const struct reg_info *reg_group;
+ const struct reg_info **reg_set = (hw->mac.type == ixgbe_mac_82598EB) ?
ixgbe_regs_mac_82598EB : ixgbe_regs_others;
reg_group = reg_set[g_ind++];
@@ -4563,7 +4563,7 @@ ixgbevf_get_reg_length(struct rte_eth_dev *dev __rte_unused)
{
int count = 0;
int g_ind = 0;
- struct reg_info *reg_group;
+ const struct reg_info *reg_group;
reg_group = ixgbevf_regs[g_ind++];
while (reg_group) {
@@ -4582,8 +4582,8 @@ ixgbe_get_regs(struct rte_eth_dev *dev,
uint32_t *regs_buff = regs->buf;
int g_ind = 0;
int count = 0;
- struct reg_info *reg_group;
- struct reg_info **reg_set = (hw->mac.type == ixgbe_mac_82598EB) ?
+ const struct reg_info *reg_group;
+ const struct reg_info **reg_set = (hw->mac.type == ixgbe_mac_82598EB) ?
ixgbe_regs_mac_82598EB : ixgbe_regs_others;
/* Support only full register dump */
@@ -4611,7 +4611,7 @@ ixgbevf_get_regs(struct rte_eth_dev *dev,
uint32_t *regs_buff = regs->buf;
int g_ind = 0;
int count = 0;
- struct reg_info *reg_group;
+ const struct reg_info *reg_group;
/* Support only full register dump */
if ((regs->leng == 0) ||
diff --git a/drivers/net/ixgbe/ixgbe_regs.h b/drivers/net/ixgbe/ixgbe_regs.h
index 67d6439..58fd25f 100644
--- a/drivers/net/ixgbe/ixgbe_regs.h
+++ b/drivers/net/ixgbe/ixgbe_regs.h
@@ -43,7 +43,7 @@ struct reg_info {
const char *name;
} reg_info;
-static struct reg_info ixgbe_regs_general[] = {
+static const struct reg_info ixgbe_regs_general[] = {
{IXGBE_CTRL, 1, 1, "IXGBE_CTRL"},
{IXGBE_STATUS, 1, 1, "IXGBE_STATUS"},
{IXGBE_CTRL_EXT, 1, 1, "IXGBE_CTRL_EXT"},
@@ -55,7 +55,7 @@ static struct reg_info ixgbe_regs_general[] = {
{0, 0, 0, ""}
};
-static struct reg_info ixgbevf_regs_general[] = {
+static const struct reg_info ixgbevf_regs_general[] = {
{IXGBE_CTRL, 1, 1, "IXGBE_CTRL"},
{IXGBE_STATUS, 1, 1, "IXGBE_STATUS"},
{IXGBE_VFLINKS, 1, 1, "IXGBE_VFLINKS"},
@@ -66,7 +66,7 @@ static struct reg_info ixgbevf_regs_general[] = {
{0, 0, 0, ""}
};
-static struct reg_info ixgbe_regs_nvm[] = {
+static const struct reg_info ixgbe_regs_nvm[] = {
{IXGBE_EEC, 1, 1, "IXGBE_EEC"},
{IXGBE_EERD, 1, 1, "IXGBE_EERD"},
{IXGBE_FLA, 1, 1, "IXGBE_FLA"},
@@ -80,7 +80,7 @@ static struct reg_info ixgbe_regs_nvm[] = {
{0, 0, 0, ""}
};
-static struct reg_info ixgbe_regs_interrupt[] = {
+static const struct reg_info ixgbe_regs_interrupt[] = {
{IXGBE_EICS, 1, 1, "IXGBE_EICS"},
{IXGBE_EIMS, 1, 1, "IXGBE_EIMS"},
{IXGBE_EIMC, 1, 1, "IXGBE_EIMC"},
@@ -95,7 +95,7 @@ static struct reg_info ixgbe_regs_interrupt[] = {
{0, 0, 0, ""}
};
-static struct reg_info ixgbevf_regs_interrupt[] = {
+static const struct reg_info ixgbevf_regs_interrupt[] = {
{IXGBE_VTEICR, 1, 1, "IXGBE_VTEICR"},
{IXGBE_VTEICS, 1, 1, "IXGBE_VTEICS"},
{IXGBE_VTEIMS, 1, 1, "IXGBE_VTEIMS"},
@@ -108,7 +108,7 @@ static struct reg_info ixgbevf_regs_interrupt[] = {
{0, 0, 0, ""}
};
-static struct reg_info ixgbe_regs_fctl_mac_82598EB[] = {
+static const struct reg_info ixgbe_regs_fctl_mac_82598EB[] = {
{IXGBE_PFCTOP, 1, 1, ""},
{IXGBE_FCTTV(0), 4, 4, ""},
{IXGBE_FCRTV, 1, 1, ""},
@@ -118,7 +118,7 @@ static struct reg_info ixgbe_regs_fctl_mac_82598EB[] = {
{0, 0, 0, ""}
};
-static struct reg_info ixgbe_regs_fctl_others[] = {
+static const struct reg_info ixgbe_regs_fctl_others[] = {
{IXGBE_PFCTOP, 1, 1, ""},
{IXGBE_FCTTV(0), 4, 4, ""},
{IXGBE_FCRTV, 1, 1, ""},
@@ -128,7 +128,7 @@ static struct reg_info ixgbe_regs_fctl_others[] = {
{0, 0, 0, ""}
};
-static struct reg_info ixgbe_regs_rxdma[] = {
+static const struct reg_info ixgbe_regs_rxdma[] = {
{IXGBE_RDBAL(0), 64, 0x40, "IXGBE_RDBAL"},
{IXGBE_RDBAH(0), 64, 0x40, "IXGBE_RDBAH"},
{IXGBE_RDLEN(0), 64, 0x40, "IXGBE_RDLEN"},
@@ -144,7 +144,7 @@ static struct reg_info ixgbe_regs_rxdma[] = {
{0, 0, 0, ""}
};
-static struct reg_info ixgbevf_regs_rxdma[] = {
+static const struct reg_info ixgbevf_regs_rxdma[] = {
{IXGBE_RDBAL(0), 8, 0x40, "IXGBE_RDBAL"},
{IXGBE_RDBAH(0), 8, 0x40, "IXGBE_RDBAH"},
{IXGBE_RDLEN(0), 8, 0x40, "IXGBE_RDLEN"},
@@ -159,7 +159,7 @@ static struct reg_info ixgbevf_regs_rxdma[] = {
{0, 0, 0, ""}
};
-static struct reg_info ixgbe_regs_rx[] = {
+static const struct reg_info ixgbe_regs_rx[] = {
{IXGBE_RXCSUM, 1, 1, "IXGBE_RXCSUM"},
{IXGBE_RFCTL, 1, 1, "IXGBE_RFCTL"},
{IXGBE_RAL(0), 16, 8, "IXGBE_RAL"},
@@ -176,7 +176,7 @@ static struct reg_info ixgbe_regs_rx[] = {
{0, 0, 0, ""}
};
-static struct reg_info ixgbe_regs_tx[] = {
+static const struct reg_info ixgbe_regs_tx[] = {
{IXGBE_TDBAL(0), 32, 0x40, "IXGBE_TDBAL"},
{IXGBE_TDBAH(0), 32, 0x40, "IXGBE_TDBAH"},
{IXGBE_TDLEN(0), 32, 0x40, "IXGBE_TDLEN"},
@@ -192,7 +192,7 @@ static struct reg_info ixgbe_regs_tx[] = {
{0, 0, 0, ""}
};
-static struct reg_info ixgbevf_regs_tx[] = {
+static const struct reg_info ixgbevf_regs_tx[] = {
{IXGBE_TDBAL(0), 4, 0x40, "IXGBE_TDBAL"},
{IXGBE_TDBAH(0), 4, 0x40, "IXGBE_TDBAH"},
{IXGBE_TDLEN(0), 4, 0x40, "IXGBE_TDLEN"},
@@ -204,7 +204,7 @@ static struct reg_info ixgbevf_regs_tx[] = {
{0, 0, 0, ""}
};
-static struct reg_info ixgbe_regs_wakeup[] = {
+static const struct reg_info ixgbe_regs_wakeup[] = {
{IXGBE_WUC, 1, 1, "IXGBE_WUC"},
{IXGBE_WUFC, 1, 1, "IXGBE_WUFC"},
{IXGBE_WUS, 1, 1, "IXGBE_WUS"},
@@ -217,7 +217,7 @@ static struct reg_info ixgbe_regs_wakeup[] = {
{0, 0, 0, ""}
};
-static struct reg_info ixgbe_regs_dcb[] = {
+static const struct reg_info ixgbe_regs_dcb[] = {
{IXGBE_RMCS, 1, 1, "IXGBE_RMCS"},
{IXGBE_DPMCS, 1, 1, "IXGBE_DPMCS"},
{IXGBE_PDPMCS, 1, 1, "IXGBE_PDPMCS"},
@@ -231,7 +231,7 @@ static struct reg_info ixgbe_regs_dcb[] = {
{0, 0, 0, ""}
};
-static struct reg_info ixgbe_regs_mac[] = {
+static const struct reg_info ixgbe_regs_mac[] = {
{IXGBE_PCS1GCFIG, 1, 1, "IXGBE_PCS1GCFIG"},
{IXGBE_PCS1GLCTL, 1, 1, "IXGBE_PCS1GLCTL"},
{IXGBE_PCS1GLSTA, 1, 1, "IXGBE_PCS1GLSTA"},
@@ -268,7 +268,7 @@ static struct reg_info ixgbe_regs_mac[] = {
{0, 0, 0, ""}
};
-static struct reg_info ixgbe_regs_diagnostic[] = {
+static const struct reg_info ixgbe_regs_diagnostic[] = {
{IXGBE_RDSTATCTL, 1, 1, "IXGBE_RDSTATCTL"},
{IXGBE_RDSTAT(0), 8, 4, "IXGBE_RDSTAT"},
{IXGBE_RDHMPN, 1, 1, "IXGBE_RDHMPN"},
@@ -302,7 +302,7 @@ static struct reg_info ixgbe_regs_diagnostic[] = {
};
/* PF registers */
-static struct reg_info *ixgbe_regs_others[] = {
+static const struct reg_info *ixgbe_regs_others[] = {
ixgbe_regs_general,
ixgbe_regs_nvm, ixgbe_regs_interrupt,
ixgbe_regs_fctl_others,
@@ -315,7 +315,7 @@ static struct reg_info *ixgbe_regs_others[] = {
ixgbe_regs_diagnostic,
NULL};
-static struct reg_info *ixgbe_regs_mac_82598EB[] = {
+static const struct reg_info *ixgbe_regs_mac_82598EB[] = {
ixgbe_regs_general,
ixgbe_regs_nvm,
ixgbe_regs_interrupt,
@@ -330,7 +330,7 @@ static struct reg_info *ixgbe_regs_mac_82598EB[] = {
NULL};
/* VF registers */
-static struct reg_info *ixgbevf_regs[] = {
+static const struct reg_info *ixgbevf_regs[] = {
ixgbevf_regs_general,
ixgbevf_regs_interrupt,
ixgbevf_regs_rxdma,
@@ -338,7 +338,7 @@ static struct reg_info *ixgbevf_regs[] = {
NULL};
static inline int
-ixgbe_read_regs(struct ixgbe_hw *hw, struct reg_info *reg, uint32_t *reg_buf)
+ixgbe_read_regs(struct ixgbe_hw *hw, const struct reg_info *reg, uint32_t *reg_buf)
{
unsigned int i;
@@ -349,7 +349,7 @@ ixgbe_read_regs(struct ixgbe_hw *hw, struct reg_info *reg, uint32_t *reg_buf)
};
static inline int
-ixgbe_regs_group_count(struct reg_info *regs)
+ixgbe_regs_group_count(const struct reg_info *regs)
{
int count = 0;
int i = 0;
@@ -363,7 +363,7 @@ ixgbe_regs_group_count(struct reg_info *regs)
static inline int
ixgbe_read_regs_group(struct rte_eth_dev *dev, uint32_t *reg_buf,
- struct reg_info *regs)
+ const struct reg_info *regs)
{
int count = 0;
int i = 0;
--
2.1.4
More information about the dev
mailing list