* [PATCH 0/10] staging: et131x: Kernel coding style cleanups
@ 2011-07-10 15:35 Mark Einon
2011-07-10 15:35 ` [PATCH 01/10] staging: et131x: Converting et1310_mac.c function and local names from CamelCase Mark Einon
` (9 more replies)
0 siblings, 10 replies; 12+ messages in thread
From: Mark Einon @ 2011-07-10 15:35 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, o.hartmann
Mainly sanitising function and variable names to bring them
more inline with the kernel coding style.
Mark Einon (11):
staging: et131x: Converting et1310_mac.c function and
staging: et131x: Converting et1310_phy.c function and
staging: et131x: Converting et1310_pm.c function and
staging: et131x: Remove unecessary *etdev NULL check
staging: et131x: Converting et1310_rx.c function and
staging: et131x: Make static some local functions in
staging: et131x: Converting et1310_rx.h variable names
staging: et131x: add et1310_ prefix to et1310_mac.c
staging: et131x: Converting et1310_tx.c function and
staging: et131x: Converting et1310_adapter.h variable
drivers/staging/et131x/et1310_mac.c | 251 ++++++++--------
drivers/staging/et131x/et1310_phy.c | 449 +++++++++++++-------------
drivers/staging/et131x/et1310_pm.c | 16 +-
drivers/staging/et131x/et1310_rx.c | 523 ++++++++++++++++---------------
drivers/staging/et131x/et1310_rx.h | 62 ++--
drivers/staging/et131x/et1310_tx.c | 302 +++++++++---------
drivers/staging/et131x/et131x.h | 69 ++---
drivers/staging/et131x/et131x_adapter.h | 91 +++---
drivers/staging/et131x/et131x_initpci.c | 84 +++---
drivers/staging/et131x/et131x_isr.c | 25 +-
drivers/staging/et131x/et131x_netdev.c | 79 +++---
11 files changed, 975 insertions(+), 976 deletions(-)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 01/10] staging: et131x: Converting et1310_mac.c function and local names from CamelCase
2011-07-10 15:35 [PATCH 0/10] staging: et131x: Kernel coding style cleanups Mark Einon
@ 2011-07-10 15:35 ` Mark Einon
2011-07-10 15:35 ` [PATCH 02/10] staging: et131x: Converting et1310_phy.c " Mark Einon
` (8 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Mark Einon @ 2011-07-10 15:35 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, o.hartmann, Mark Einon
Tested on an ET-131x device.
Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
drivers/staging/et131x/et1310_mac.c | 222 +++++++++++++++---------------
drivers/staging/et131x/et1310_phy.c | 4 +-
drivers/staging/et131x/et131x.h | 20 ++--
drivers/staging/et131x/et131x_initpci.c | 12 +-
drivers/staging/et131x/et131x_isr.c | 2 +-
drivers/staging/et131x/et131x_netdev.c | 4 +-
6 files changed, 132 insertions(+), 132 deletions(-)
diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c
index 656be4b..db34c79 100644
--- a/drivers/staging/et131x/et1310_mac.c
+++ b/drivers/staging/et131x/et1310_mac.c
@@ -99,12 +99,12 @@
#define COUNTER_MASK_12_BIT (COUNTER_WRAP_12_BIT - 1)
/**
- * ConfigMacRegs1 - Initialize the first part of MAC regs
- * @pAdpater: pointer to our adapter structure
+ * config_mac_regs1 - Initialize the first part of MAC regs
+ * @etdev: pointer to our adapter structure
*/
-void ConfigMACRegs1(struct et131x_adapter *etdev)
+void config_mac_regs1(struct et131x_adapter *etdev)
{
- struct mac_regs __iomem *pMac = &etdev->regs->mac;
+ struct mac_regs __iomem *macregs = &etdev->regs->mac;
u32 station1;
u32 station2;
u32 ipg;
@@ -112,22 +112,22 @@ void ConfigMACRegs1(struct et131x_adapter *etdev)
/* First we need to reset everything. Write to MAC configuration
* register 1 to perform reset.
*/
- writel(0xC00F0000, &pMac->cfg1);
+ writel(0xC00F0000, ¯egs->cfg1);
/* Next lets configure the MAC Inter-packet gap register */
ipg = 0x38005860; /* IPG1 0x38 IPG2 0x58 B2B 0x60 */
ipg |= 0x50 << 8; /* ifg enforce 0x50 */
- writel(ipg, &pMac->ipg);
+ writel(ipg, ¯egs->ipg);
/* Next lets configure the MAC Half Duplex register */
/* BEB trunc 0xA, Ex Defer, Rexmit 0xF Coll 0x37 */
- writel(0x00A1F037, &pMac->hfdp);
+ writel(0x00A1F037, ¯egs->hfdp);
/* Next lets configure the MAC Interface Control register */
- writel(0, &pMac->if_ctrl);
+ writel(0, ¯egs->if_ctrl);
/* Let's move on to setting up the mii management configuration */
- writel(0x07, &pMac->mii_mgmt_cfg); /* Clock reset 0x7 */
+ writel(0x07, ¯egs->mii_mgmt_cfg); /* Clock reset 0x7 */
/* Next lets configure the MAC Station Address register. These
* values are read from the EEPROM during initialization and stored
@@ -142,8 +142,8 @@ void ConfigMACRegs1(struct et131x_adapter *etdev)
(etdev->addr[4] << ET_MAC_STATION_ADDR1_OC5_SHIFT) |
(etdev->addr[3] << ET_MAC_STATION_ADDR1_OC4_SHIFT) |
etdev->addr[2];
- writel(station1, &pMac->station_addr_1);
- writel(station2, &pMac->station_addr_2);
+ writel(station1, ¯egs->station_addr_1);
+ writel(station2, ¯egs->station_addr_2);
/* Max ethernet packet in bytes that will passed by the mac without
* being truncated. Allow the MAC to pass 4 more than our max packet
@@ -152,29 +152,29 @@ void ConfigMACRegs1(struct et131x_adapter *etdev)
* Packets larger than (RegistryJumboPacket) that do not contain a
* VLAN ID will be dropped by the Rx function.
*/
- writel(etdev->RegistryJumboPacket + 4, &pMac->max_fm_len);
+ writel(etdev->RegistryJumboPacket + 4, ¯egs->max_fm_len);
/* clear out MAC config reset */
- writel(0, &pMac->cfg1);
+ writel(0, ¯egs->cfg1);
}
/**
- * ConfigMacRegs2 - Initialize the second part of MAC regs
- * @pAdpater: pointer to our adapter structure
+ * config_mac_regs2 - Initialize the second part of MAC regs
+ * @etdev: pointer to our adapter structure
*/
-void ConfigMACRegs2(struct et131x_adapter *etdev)
+void config_mac_regs2(struct et131x_adapter *etdev)
{
int32_t delay = 0;
- struct mac_regs __iomem *pMac = &etdev->regs->mac;
+ struct mac_regs __iomem *mac = &etdev->regs->mac;
u32 cfg1;
u32 cfg2;
u32 ifctrl;
u32 ctl;
ctl = readl(&etdev->regs->txmac.ctl);
- cfg1 = readl(&pMac->cfg1);
- cfg2 = readl(&pMac->cfg2);
- ifctrl = readl(&pMac->if_ctrl);
+ cfg1 = readl(&mac->cfg1);
+ cfg2 = readl(&mac->cfg2);
+ ifctrl = readl(&mac->if_ctrl);
/* Set up the if mode bits */
cfg2 &= ~0x300;
@@ -188,12 +188,12 @@ void ConfigMACRegs2(struct et131x_adapter *etdev)
}
/* We need to enable Rx/Tx */
- cfg1 |= CFG1_RX_ENABLE|CFG1_TX_ENABLE|CFG1_TX_FLOW;
+ cfg1 |= CFG1_RX_ENABLE | CFG1_TX_ENABLE | CFG1_TX_FLOW;
/* Initialize loop back to off */
- cfg1 &= ~(CFG1_LOOPBACK|CFG1_RX_FLOW);
+ cfg1 &= ~(CFG1_LOOPBACK | CFG1_RX_FLOW);
if (etdev->flowcontrol == FLOW_RXONLY || etdev->flowcontrol == FLOW_BOTH)
cfg1 |= CFG1_RX_FLOW;
- writel(cfg1, &pMac->cfg1);
+ writel(cfg1, &mac->cfg1);
/* Now we need to initialize the MAC Configuration 2 register */
/* preamble 7, check length, huge frame off, pad crc, crc enable
@@ -209,13 +209,13 @@ void ConfigMACRegs2(struct et131x_adapter *etdev)
if (!etdev->duplex_mode)
ifctrl |= (1<<26); /* Enable ghd */
- writel(ifctrl, &pMac->if_ctrl);
- writel(cfg2, &pMac->cfg2);
+ writel(ifctrl, &mac->if_ctrl);
+ writel(cfg2, &mac->cfg2);
do {
udelay(10);
delay++;
- cfg1 = readl(&pMac->cfg1);
+ cfg1 = readl(&mac->cfg1);
} while ((cfg1 & CFG1_WAIT) != CFG1_WAIT && delay < 100);
if (delay == 100) {
@@ -224,7 +224,7 @@ void ConfigMACRegs2(struct et131x_adapter *etdev)
cfg1);
}
- /* Enable TXMAC */
+ /* Enable txmac */
ctl |= 0x09; /* TX mac enable, FC disable */
writel(ctl, &etdev->regs->txmac.ctl);
@@ -235,78 +235,78 @@ void ConfigMACRegs2(struct et131x_adapter *etdev)
}
}
-void ConfigRxMacRegs(struct et131x_adapter *etdev)
+void config_rxmac_regs(struct et131x_adapter *etdev)
{
- struct rxmac_regs __iomem *pRxMac = &etdev->regs->rxmac;
+ struct rxmac_regs __iomem *rxmac = &etdev->regs->rxmac;
u32 sa_lo;
u32 sa_hi = 0;
u32 pf_ctrl = 0;
/* Disable the MAC while it is being configured (also disable WOL) */
- writel(0x8, &pRxMac->ctrl);
+ writel(0x8, &rxmac->ctrl);
/* Initialize WOL to disabled. */
- writel(0, &pRxMac->crc0);
- writel(0, &pRxMac->crc12);
- writel(0, &pRxMac->crc34);
+ writel(0, &rxmac->crc0);
+ writel(0, &rxmac->crc12);
+ writel(0, &rxmac->crc34);
/* We need to set the WOL mask0 - mask4 next. We initialize it to
* its default Values of 0x00000000 because there are not WOL masks
* as of this time.
*/
- writel(0, &pRxMac->mask0_word0);
- writel(0, &pRxMac->mask0_word1);
- writel(0, &pRxMac->mask0_word2);
- writel(0, &pRxMac->mask0_word3);
-
- writel(0, &pRxMac->mask1_word0);
- writel(0, &pRxMac->mask1_word1);
- writel(0, &pRxMac->mask1_word2);
- writel(0, &pRxMac->mask1_word3);
-
- writel(0, &pRxMac->mask2_word0);
- writel(0, &pRxMac->mask2_word1);
- writel(0, &pRxMac->mask2_word2);
- writel(0, &pRxMac->mask2_word3);
-
- writel(0, &pRxMac->mask3_word0);
- writel(0, &pRxMac->mask3_word1);
- writel(0, &pRxMac->mask3_word2);
- writel(0, &pRxMac->mask3_word3);
-
- writel(0, &pRxMac->mask4_word0);
- writel(0, &pRxMac->mask4_word1);
- writel(0, &pRxMac->mask4_word2);
- writel(0, &pRxMac->mask4_word3);
+ writel(0, &rxmac->mask0_word0);
+ writel(0, &rxmac->mask0_word1);
+ writel(0, &rxmac->mask0_word2);
+ writel(0, &rxmac->mask0_word3);
+
+ writel(0, &rxmac->mask1_word0);
+ writel(0, &rxmac->mask1_word1);
+ writel(0, &rxmac->mask1_word2);
+ writel(0, &rxmac->mask1_word3);
+
+ writel(0, &rxmac->mask2_word0);
+ writel(0, &rxmac->mask2_word1);
+ writel(0, &rxmac->mask2_word2);
+ writel(0, &rxmac->mask2_word3);
+
+ writel(0, &rxmac->mask3_word0);
+ writel(0, &rxmac->mask3_word1);
+ writel(0, &rxmac->mask3_word2);
+ writel(0, &rxmac->mask3_word3);
+
+ writel(0, &rxmac->mask4_word0);
+ writel(0, &rxmac->mask4_word1);
+ writel(0, &rxmac->mask4_word2);
+ writel(0, &rxmac->mask4_word3);
/* Lets setup the WOL Source Address */
sa_lo = (etdev->addr[2] << ET_WOL_LO_SA3_SHIFT) |
(etdev->addr[3] << ET_WOL_LO_SA4_SHIFT) |
(etdev->addr[4] << ET_WOL_LO_SA5_SHIFT) |
etdev->addr[5];
- writel(sa_lo, &pRxMac->sa_lo);
+ writel(sa_lo, &rxmac->sa_lo);
sa_hi = (u32) (etdev->addr[0] << ET_WOL_HI_SA1_SHIFT) |
etdev->addr[1];
- writel(sa_hi, &pRxMac->sa_hi);
+ writel(sa_hi, &rxmac->sa_hi);
/* Disable all Packet Filtering */
- writel(0, &pRxMac->pf_ctrl);
+ writel(0, &rxmac->pf_ctrl);
/* Let's initialize the Unicast Packet filtering address */
if (etdev->PacketFilter & ET131X_PACKET_TYPE_DIRECTED) {
- SetupDeviceForUnicast(etdev);
+ setup_device_for_unicast(etdev);
pf_ctrl |= 4; /* Unicast filter */
} else {
- writel(0, &pRxMac->uni_pf_addr1);
- writel(0, &pRxMac->uni_pf_addr2);
- writel(0, &pRxMac->uni_pf_addr3);
+ writel(0, &rxmac->uni_pf_addr1);
+ writel(0, &rxmac->uni_pf_addr2);
+ writel(0, &rxmac->uni_pf_addr3);
}
/* Let's initialize the Multicast hash */
if (!(etdev->PacketFilter & ET131X_PACKET_TYPE_ALL_MULTICAST)) {
pf_ctrl |= 2; /* Multicast filter */
- SetupDeviceForMulticast(etdev);
+ setup_device_for_multicast(etdev);
}
/* Runt packet filtering. Didn't work in version A silicon. */
@@ -324,18 +324,18 @@ void ConfigRxMacRegs(struct et131x_adapter *etdev)
*
* seg_en on, fc_en off, size 0x10
*/
- writel(0x41, &pRxMac->mcif_ctrl_max_seg);
+ writel(0x41, &rxmac->mcif_ctrl_max_seg);
else
- writel(0, &pRxMac->mcif_ctrl_max_seg);
+ writel(0, &rxmac->mcif_ctrl_max_seg);
/* Initialize the MCIF water marks */
- writel(0, &pRxMac->mcif_water_mark);
+ writel(0, &rxmac->mcif_water_mark);
/* Initialize the MIF control */
- writel(0, &pRxMac->mif_ctrl);
+ writel(0, &rxmac->mif_ctrl);
/* Initialize the Space Available Register */
- writel(0, &pRxMac->space_avail);
+ writel(0, &rxmac->space_avail);
/* Initialize the the mif_ctrl register
* bit 3: Receive code error. One or more nibbles were signaled as
@@ -351,9 +351,9 @@ void ConfigRxMacRegs(struct et131x_adapter *etdev)
* bit 17: Drop packet enable
*/
if (etdev->linkspeed == TRUEPHY_SPEED_100MBPS)
- writel(0x30038, &pRxMac->mif_ctrl);
+ writel(0x30038, &rxmac->mif_ctrl);
else
- writel(0x30030, &pRxMac->mif_ctrl);
+ writel(0x30030, &rxmac->mif_ctrl);
/* Finally we initialize RxMac to be enabled & WOL disabled. Packet
* filter is always enabled since it is where the runt packets are
@@ -361,11 +361,11 @@ void ConfigRxMacRegs(struct et131x_adapter *etdev)
* dropping doesn't work, so it is disabled in the pf_ctrl register,
* but we still leave the packet filter on.
*/
- writel(pf_ctrl, &pRxMac->pf_ctrl);
- writel(0x9, &pRxMac->ctrl);
+ writel(pf_ctrl, &rxmac->pf_ctrl);
+ writel(0x9, &rxmac->ctrl);
}
-void ConfigTxMacRegs(struct et131x_adapter *etdev)
+void config_txmac_regs(struct et131x_adapter *etdev)
{
struct txmac_regs *txmac = &etdev->regs->txmac;
@@ -379,7 +379,7 @@ void ConfigTxMacRegs(struct et131x_adapter *etdev)
writel(0x40, &txmac->cf_param);
}
-void ConfigMacStatRegs(struct et131x_adapter *etdev)
+void config_macstat_regs(struct et131x_adapter *etdev)
{
struct macstat_regs __iomem *macstat =
&etdev->regs->macstat;
@@ -444,7 +444,7 @@ void ConfigMacStatRegs(struct et131x_adapter *etdev)
writel(0xFFFE7E8B, &macstat->carry_reg2_mask);
}
-void ConfigFlowControl(struct et131x_adapter *etdev)
+void config_flow_control(struct et131x_adapter *etdev)
{
if (etdev->duplex_mode == 0) {
etdev->flowcontrol = FLOW_NONE;
@@ -480,42 +480,42 @@ void ConfigFlowControl(struct et131x_adapter *etdev)
}
/**
- * UpdateMacStatHostCounters - Update the local copy of the statistics
+ * update_macstat_host_counters - Update the local copy of the statistics
* @etdev: pointer to the adapter structure
*/
-void UpdateMacStatHostCounters(struct et131x_adapter *etdev)
+void update_macstat_host_counters(struct et131x_adapter *etdev)
{
struct ce_stats *stats = &etdev->stats;
struct macstat_regs __iomem *macstat =
&etdev->regs->macstat;
- stats->collisions += readl(&macstat->tx_total_collisions);
- stats->first_collision += readl(&macstat->tx_single_collisions);
- stats->tx_deferred += readl(&macstat->tx_deferred);
+ stats->collisions += readl(&macstat->tx_total_collisions);
+ stats->first_collision += readl(&macstat->tx_single_collisions);
+ stats->tx_deferred += readl(&macstat->tx_deferred);
stats->excessive_collisions += readl(&macstat->tx_multiple_collisions);
- stats->late_collisions += readl(&macstat->tx_late_collisions);
- stats->tx_uflo += readl(&macstat->tx_undersize_frames);
- stats->max_pkt_error += readl(&macstat->tx_oversize_frames);
-
- stats->alignment_err += readl(&macstat->rx_align_errs);
- stats->crc_err += readl(&macstat->rx_code_errs);
- stats->norcvbuf += readl(&macstat->rx_drops);
- stats->rx_ov_flow += readl(&macstat->rx_oversize_packets);
- stats->code_violations += readl(&macstat->rx_fcs_errs);
- stats->length_err += readl(&macstat->rx_frame_len_errs);
-
- stats->other_errors += readl(&macstat->rx_fragment_packets);
+ stats->late_collisions += readl(&macstat->tx_late_collisions);
+ stats->tx_uflo += readl(&macstat->tx_undersize_frames);
+ stats->max_pkt_error += readl(&macstat->tx_oversize_frames);
+
+ stats->alignment_err += readl(&macstat->rx_align_errs);
+ stats->crc_err += readl(&macstat->rx_code_errs);
+ stats->norcvbuf += readl(&macstat->rx_drops);
+ stats->rx_ov_flow += readl(&macstat->rx_oversize_packets);
+ stats->code_violations += readl(&macstat->rx_fcs_errs);
+ stats->length_err += readl(&macstat->rx_frame_len_errs);
+
+ stats->other_errors += readl(&macstat->rx_fragment_packets);
}
/**
- * HandleMacStatInterrupt
+ * handle_macstat_interrupt
* @etdev: pointer to the adapter structure
*
* One of the MACSTAT counters has wrapped. Update the local copy of
* the statistics held in the adapter structure, checking the "wrap"
* bit for each counter.
*/
-void HandleMacStatInterrupt(struct et131x_adapter *etdev)
+void handle_macstat_interrupt(struct et131x_adapter *etdev)
{
u32 carry_reg1;
u32 carry_reg2;
@@ -536,36 +536,36 @@ void HandleMacStatInterrupt(struct et131x_adapter *etdev)
* block indicates that one of the counters has wrapped.
*/
if (carry_reg1 & (1 << 14))
- etdev->stats.code_violations += COUNTER_WRAP_16_BIT;
+ etdev->stats.code_violations += COUNTER_WRAP_16_BIT;
if (carry_reg1 & (1 << 8))
- etdev->stats.alignment_err += COUNTER_WRAP_12_BIT;
+ etdev->stats.alignment_err += COUNTER_WRAP_12_BIT;
if (carry_reg1 & (1 << 7))
- etdev->stats.length_err += COUNTER_WRAP_16_BIT;
+ etdev->stats.length_err += COUNTER_WRAP_16_BIT;
if (carry_reg1 & (1 << 2))
- etdev->stats.other_errors += COUNTER_WRAP_16_BIT;
+ etdev->stats.other_errors += COUNTER_WRAP_16_BIT;
if (carry_reg1 & (1 << 6))
- etdev->stats.crc_err += COUNTER_WRAP_16_BIT;
+ etdev->stats.crc_err += COUNTER_WRAP_16_BIT;
if (carry_reg1 & (1 << 3))
- etdev->stats.rx_ov_flow += COUNTER_WRAP_16_BIT;
+ etdev->stats.rx_ov_flow += COUNTER_WRAP_16_BIT;
if (carry_reg1 & (1 << 0))
- etdev->stats.norcvbuf += COUNTER_WRAP_16_BIT;
+ etdev->stats.norcvbuf += COUNTER_WRAP_16_BIT;
if (carry_reg2 & (1 << 16))
- etdev->stats.max_pkt_error += COUNTER_WRAP_12_BIT;
+ etdev->stats.max_pkt_error += COUNTER_WRAP_12_BIT;
if (carry_reg2 & (1 << 15))
- etdev->stats.tx_uflo += COUNTER_WRAP_12_BIT;
+ etdev->stats.tx_uflo += COUNTER_WRAP_12_BIT;
if (carry_reg2 & (1 << 6))
- etdev->stats.first_collision += COUNTER_WRAP_12_BIT;
+ etdev->stats.first_collision += COUNTER_WRAP_12_BIT;
if (carry_reg2 & (1 << 8))
- etdev->stats.tx_deferred += COUNTER_WRAP_12_BIT;
+ etdev->stats.tx_deferred += COUNTER_WRAP_12_BIT;
if (carry_reg2 & (1 << 5))
etdev->stats.excessive_collisions += COUNTER_WRAP_12_BIT;
if (carry_reg2 & (1 << 4))
- etdev->stats.late_collisions += COUNTER_WRAP_12_BIT;
+ etdev->stats.late_collisions += COUNTER_WRAP_12_BIT;
if (carry_reg2 & (1 << 2))
- etdev->stats.collisions += COUNTER_WRAP_12_BIT;
+ etdev->stats.collisions += COUNTER_WRAP_12_BIT;
}
-void SetupDeviceForMulticast(struct et131x_adapter *etdev)
+void setup_device_for_multicast(struct et131x_adapter *etdev)
{
struct rxmac_regs __iomem *rxmac = &etdev->regs->rxmac;
uint32_t nIndex;
@@ -613,7 +613,7 @@ void SetupDeviceForMulticast(struct et131x_adapter *etdev)
}
}
-void SetupDeviceForUnicast(struct et131x_adapter *etdev)
+void setup_device_for_unicast(struct et131x_adapter *etdev)
{
struct rxmac_regs __iomem *rxmac = &etdev->regs->rxmac;
u32 uni_pf1;
diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c
index 0bcb7fb..d5b02a8 100644
--- a/drivers/staging/et131x/et1310_phy.c
+++ b/drivers/staging/et131x/et1310_phy.c
@@ -850,7 +850,7 @@ void et131x_Mii_check(struct et131x_adapter *etdev,
MiWrite(etdev, 0x12, Register18);
}
- ConfigFlowControl(etdev);
+ config_flow_control(etdev);
if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS &&
etdev->RegistryJumboPacket > 2048)
@@ -858,7 +858,7 @@ void et131x_Mii_check(struct et131x_adapter *etdev,
0x2000);
SetRxDmaTimer(etdev);
- ConfigMACRegs2(etdev);
+ config_mac_regs2(etdev);
}
}
}
diff --git a/drivers/staging/et131x/et131x.h b/drivers/staging/et131x/et131x.h
index 48ebac0..289d511 100644
--- a/drivers/staging/et131x/et131x.h
+++ b/drivers/staging/et131x/et131x.h
@@ -71,16 +71,16 @@ irqreturn_t et131x_isr(int irq, void *dev_id);
void et131x_isr_handler(struct work_struct *work);
/* et1310_mac.c */
-void ConfigMACRegs1(struct et131x_adapter *adapter);
-void ConfigMACRegs2(struct et131x_adapter *adapter);
-void ConfigRxMacRegs(struct et131x_adapter *adapter);
-void ConfigTxMacRegs(struct et131x_adapter *adapter);
-void ConfigMacStatRegs(struct et131x_adapter *adapter);
-void ConfigFlowControl(struct et131x_adapter *adapter);
-void UpdateMacStatHostCounters(struct et131x_adapter *adapter);
-void HandleMacStatInterrupt(struct et131x_adapter *adapter);
-void SetupDeviceForMulticast(struct et131x_adapter *adapter);
-void SetupDeviceForUnicast(struct et131x_adapter *adapter);
+void config_mac_regs1(struct et131x_adapter *adapter);
+void config_mac_regs2(struct et131x_adapter *adapter);
+void config_rxmac_regs(struct et131x_adapter *adapter);
+void config_txmac_regs(struct et131x_adapter *adapter);
+void config_macstat_regs(struct et131x_adapter *adapter);
+void config_flow_control(struct et131x_adapter *adapter);
+void update_macstat_host_counters(struct et131x_adapter *adapter);
+void handle_macstat_interrupt(struct et131x_adapter *adapter);
+void setup_device_for_multicast(struct et131x_adapter *adapter);
+void setup_device_for_unicast(struct et131x_adapter *adapter);
/* et131x_netdev.c */
struct net_device *et131x_device_alloc(void);
diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c
index 8c8d6b8..d98db85 100644
--- a/drivers/staging/et131x/et131x_initpci.c
+++ b/drivers/staging/et131x/et131x_initpci.c
@@ -269,7 +269,7 @@ void et131x_error_timer_handler(unsigned long data)
pm_csr = readl(&etdev->regs->global.pm_csr);
if ((pm_csr & ET_PM_PHY_SW_COMA) == 0)
- UpdateMacStatHostCounters(etdev);
+ update_macstat_host_counters(etdev);
else
dev_err(&etdev->pdev->dev,
"No interrupts, in PHY coma, pm_csr = 0x%x\n", pm_csr);
@@ -369,7 +369,7 @@ void ConfigGlobalRegs(struct et131x_adapter *etdev)
/**
* et131x_adapter_setup - Set the adapter up as per cassini+ documentation
- * @adapter: pointer to our private adapter structure
+ * @etdev: pointer to our private adapter structure
*
* Returns 0 on success, errno on failure (as defined in errno.h)
*/
@@ -380,19 +380,19 @@ int et131x_adapter_setup(struct et131x_adapter *etdev)
/* Configure the JAGCore */
ConfigGlobalRegs(etdev);
- ConfigMACRegs1(etdev);
+ config_mac_regs1(etdev);
/* Configure the MMC registers */
/* All we need to do is initialize the Memory Control Register */
writel(ET_MMC_ENABLE, &etdev->regs->mmc.mmc_ctrl);
- ConfigRxMacRegs(etdev);
- ConfigTxMacRegs(etdev);
+ config_rxmac_regs(etdev);
+ config_txmac_regs(etdev);
ConfigRxDmaRegs(etdev);
ConfigTxDmaRegs(etdev);
- ConfigMacStatRegs(etdev);
+ config_macstat_regs(etdev);
/* Move the following code to Timer function?? */
status = et131x_xcvr_find(etdev);
diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c
index 9c33209..48b4d78 100644
--- a/drivers/staging/et131x/et131x_isr.c
+++ b/drivers/staging/et131x/et131x_isr.c
@@ -460,7 +460,7 @@ void et131x_isr_handler(struct work_struct *work)
* to maintain the top, software managed bits of the
* counter(s).
*/
- HandleMacStatInterrupt(etdev);
+ handle_macstat_interrupt(etdev);
}
/* Handle SLV Timeout Interrupt */
diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c
index 5f25bba..4e9e176 100644
--- a/drivers/staging/et131x/et131x_netdev.c
+++ b/drivers/staging/et131x/et131x_netdev.c
@@ -301,14 +301,14 @@ int et131x_set_packet_filter(struct et131x_adapter *adapter)
if (filter & ET131X_PACKET_TYPE_ALL_MULTICAST)
pf_ctrl &= ~2; /* Multicast filter bit */
else {
- SetupDeviceForMulticast(adapter);
+ setup_device_for_multicast(adapter);
pf_ctrl |= 2;
ctrl &= ~0x04;
}
/* Set us up with Unicast packet filtering */
if (filter & ET131X_PACKET_TYPE_DIRECTED) {
- SetupDeviceForUnicast(adapter);
+ setup_device_for_unicast(adapter);
pf_ctrl |= 4;
ctrl &= ~0x04;
}
--
1.7.4.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 02/10] staging: et131x: Converting et1310_phy.c function and local names from CamelCase
2011-07-10 15:35 [PATCH 0/10] staging: et131x: Kernel coding style cleanups Mark Einon
2011-07-10 15:35 ` [PATCH 01/10] staging: et131x: Converting et1310_mac.c function and local names from CamelCase Mark Einon
@ 2011-07-10 15:35 ` Mark Einon
2011-07-10 15:35 ` [PATCH 03/10] staging: et131x: Converting et1310_pm.c " Mark Einon
` (7 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Mark Einon @ 2011-07-10 15:35 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, o.hartmann, Mark Einon
Tested on an ET-131x device.
Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
drivers/staging/et131x/et1310_mac.c | 10 +-
drivers/staging/et131x/et1310_phy.c | 402 +++++++++++++++----------------
drivers/staging/et131x/et131x.h | 35 ++--
drivers/staging/et131x/et131x_initpci.c | 14 +-
drivers/staging/et131x/et131x_isr.c | 9 +-
drivers/staging/et131x/et131x_netdev.c | 4 +-
6 files changed, 234 insertions(+), 240 deletions(-)
diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c
index db34c79..21b6153 100644
--- a/drivers/staging/et131x/et1310_mac.c
+++ b/drivers/staging/et131x/et1310_mac.c
@@ -451,11 +451,11 @@ void config_flow_control(struct et131x_adapter *etdev)
} else {
char remote_pause, remote_async_pause;
- ET1310_PhyAccessMiBit(etdev,
- TRUEPHY_BIT_READ, 5, 10, &remote_pause);
- ET1310_PhyAccessMiBit(etdev,
- TRUEPHY_BIT_READ, 5, 11,
- &remote_async_pause);
+ et1310_phy_access_mii_bit(etdev,
+ TRUEPHY_BIT_READ, 5, 10, &remote_pause);
+ et1310_phy_access_mii_bit(etdev,
+ TRUEPHY_BIT_READ, 5, 11,
+ &remote_async_pause);
if ((remote_pause == TRUEPHY_BIT_SET) &&
(remote_async_pause == TRUEPHY_BIT_SET)) {
diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c
index d5b02a8..d53656b 100644
--- a/drivers/staging/et131x/et1310_phy.c
+++ b/drivers/staging/et131x/et1310_phy.c
@@ -93,39 +93,36 @@
#include "et131x.h"
-/* Prototypes for functions with local scope */
-static void et131x_xcvr_init(struct et131x_adapter *etdev);
-
/**
- * PhyMiRead - Read from the PHY through the MII Interface on the MAC
+ * et131x_phy_mii_read - Read from the PHY through the MII Interface on the MAC
* @etdev: pointer to our private adapter structure
- * @xcvrAddr: the address of the transceiver
- * @xcvrReg: the register to read
+ * @xcvr_addr: the address of the transceiver
+ * @xcvr_reg: the register to read
* @value: pointer to a 16-bit value in which the value will be stored
*
* Returns 0 on success, errno on failure (as defined in errno.h)
*/
-int PhyMiRead(struct et131x_adapter *etdev, u8 xcvrAddr,
- u8 xcvrReg, u16 *value)
+int et131x_phy_mii_read(struct et131x_adapter *etdev, u8 xcvr_addr,
+ u8 xcvr_reg, u16 *value)
{
struct mac_regs __iomem *mac = &etdev->regs->mac;
int status = 0;
u32 delay;
- u32 miiAddr;
- u32 miiCmd;
- u32 miiIndicator;
+ u32 mii_addr;
+ u32 mii_cmd;
+ u32 mii_indicator;
/* Save a local copy of the registers we are dealing with so we can
* set them back
*/
- miiAddr = readl(&mac->mii_mgmt_addr);
- miiCmd = readl(&mac->mii_mgmt_cmd);
+ mii_addr = readl(&mac->mii_mgmt_addr);
+ mii_cmd = readl(&mac->mii_mgmt_cmd);
/* Stop the current operation */
writel(0, &mac->mii_mgmt_cmd);
/* Set up the register we need to read from on the correct PHY */
- writel(MII_ADDR(xcvrAddr, xcvrReg), &mac->mii_mgmt_addr);
+ writel(MII_ADDR(xcvr_addr, xcvr_reg), &mac->mii_mgmt_addr);
/* Kick the read cycle off */
delay = 0;
@@ -135,15 +132,15 @@ int PhyMiRead(struct et131x_adapter *etdev, u8 xcvrAddr,
do {
udelay(50);
delay++;
- miiIndicator = readl(&mac->mii_mgmt_indicator);
- } while ((miiIndicator & MGMT_WAIT) && delay < 50);
+ mii_indicator = readl(&mac->mii_mgmt_indicator);
+ } while ((mii_indicator & MGMT_WAIT) && delay < 50);
/* If we hit the max delay, we could not read the register */
if (delay == 50) {
dev_warn(&etdev->pdev->dev,
- "xcvrReg 0x%08x could not be read\n", xcvrReg);
+ "xcvrReg 0x%08x could not be read\n", xcvr_reg);
dev_warn(&etdev->pdev->dev, "status is 0x%08x\n",
- miiIndicator);
+ mii_indicator);
status = -EIO;
}
@@ -158,43 +155,43 @@ int PhyMiRead(struct et131x_adapter *etdev, u8 xcvrAddr,
/* set the registers we touched back to the state at which we entered
* this function
*/
- writel(miiAddr, &mac->mii_mgmt_addr);
- writel(miiCmd, &mac->mii_mgmt_cmd);
+ writel(mii_addr, &mac->mii_mgmt_addr);
+ writel(mii_cmd, &mac->mii_mgmt_cmd);
return status;
}
/**
- * MiWrite - Write to a PHY register through the MII interface of the MAC
+ * et131x_mii_write - Write to a PHY register through the MII interface of the MAC
* @etdev: pointer to our private adapter structure
- * @xcvrReg: the register to read
+ * @xcvr_reg: the register to read
* @value: 16-bit value to write
*
* FIXME: one caller in netdev still
*
* Return 0 on success, errno on failure (as defined in errno.h)
*/
-int MiWrite(struct et131x_adapter *etdev, u8 xcvrReg, u16 value)
+int et131x_mii_write(struct et131x_adapter *etdev, u8 xcvr_reg, u16 value)
{
struct mac_regs __iomem *mac = &etdev->regs->mac;
int status = 0;
- u8 xcvrAddr = etdev->stats.xcvr_addr;
+ u8 xcvr_addr = etdev->stats.xcvr_addr;
u32 delay;
- u32 miiAddr;
- u32 miiCmd;
- u32 miiIndicator;
+ u32 mii_addr;
+ u32 mii_cmd;
+ u32 mii_indicator;
/* Save a local copy of the registers we are dealing with so we can
* set them back
*/
- miiAddr = readl(&mac->mii_mgmt_addr);
- miiCmd = readl(&mac->mii_mgmt_cmd);
+ mii_addr = readl(&mac->mii_mgmt_addr);
+ mii_cmd = readl(&mac->mii_mgmt_cmd);
/* Stop the current operation */
writel(0, &mac->mii_mgmt_cmd);
/* Set up the register we need to write to on the correct PHY */
- writel(MII_ADDR(xcvrAddr, xcvrReg), &mac->mii_mgmt_addr);
+ writel(MII_ADDR(xcvr_addr, xcvr_reg), &mac->mii_mgmt_addr);
/* Add the value to write to the registers to the mac */
writel(value, &mac->mii_mgmt_ctrl);
@@ -203,32 +200,33 @@ int MiWrite(struct et131x_adapter *etdev, u8 xcvrReg, u16 value)
do {
udelay(50);
delay++;
- miiIndicator = readl(&mac->mii_mgmt_indicator);
- } while ((miiIndicator & MGMT_BUSY) && delay < 100);
+ mii_indicator = readl(&mac->mii_mgmt_indicator);
+ } while ((mii_indicator & MGMT_BUSY) && delay < 100);
/* If we hit the max delay, we could not write the register */
if (delay == 100) {
- u16 TempValue;
+ u16 tmp;
dev_warn(&etdev->pdev->dev,
- "xcvrReg 0x%08x could not be written", xcvrReg);
+ "xcvrReg 0x%08x could not be written", xcvr_reg);
dev_warn(&etdev->pdev->dev, "status is 0x%08x\n",
- miiIndicator);
+ mii_indicator);
dev_warn(&etdev->pdev->dev, "command is 0x%08x\n",
readl(&mac->mii_mgmt_cmd));
- MiRead(etdev, xcvrReg, &TempValue);
+ et131x_mii_read(etdev, xcvr_reg, &tmp);
status = -EIO;
}
/* Stop the write operation */
writel(0, &mac->mii_mgmt_cmd);
- /* set the registers we touched back to the state at which we entered
+ /*
+ * set the registers we touched back to the state at which we entered
* this function
*/
- writel(miiAddr, &mac->mii_mgmt_addr);
- writel(miiCmd, &mac->mii_mgmt_cmd);
+ writel(mii_addr, &mac->mii_mgmt_addr);
+ writel(mii_cmd, &mac->mii_mgmt_cmd);
return status;
}
@@ -249,12 +247,12 @@ int et131x_xcvr_find(struct et131x_adapter *etdev)
/* We need to get xcvr id and address we just get the first one */
for (xcvr_addr = 0; xcvr_addr < 32; xcvr_addr++) {
/* Read the ID from the PHY */
- PhyMiRead(etdev, xcvr_addr,
- (u8) offsetof(struct mi_regs, idr1),
- &idr1);
- PhyMiRead(etdev, xcvr_addr,
- (u8) offsetof(struct mi_regs, idr2),
- &idr2);
+ et131x_phy_mii_read(etdev, xcvr_addr,
+ (u8) offsetof(struct mi_regs, idr1),
+ &idr1);
+ et131x_phy_mii_read(etdev, xcvr_addr,
+ (u8) offsetof(struct mi_regs, idr2),
+ &idr2);
xcvr_id = (u32) ((idr1 << 16) | idr2);
@@ -267,13 +265,13 @@ int et131x_xcvr_find(struct et131x_adapter *etdev)
return -ENODEV;
}
-void ET1310_PhyReset(struct et131x_adapter *etdev)
+void et1310_phy_reset(struct et131x_adapter *etdev)
{
- MiWrite(etdev, PHY_CONTROL, 0x8000);
+ et131x_mii_write(etdev, PHY_CONTROL, 0x8000);
}
/**
- * ET1310_PhyPowerDown - PHY power control
+ * et1310_phy_power_down - PHY power control
* @etdev: device to control
* @down: true for off/false for back on
*
@@ -282,80 +280,76 @@ void ET1310_PhyReset(struct et131x_adapter *etdev)
* Can't you see that this code processed
* Phy power, phy power..
*/
-
-void ET1310_PhyPowerDown(struct et131x_adapter *etdev, bool down)
+void et1310_phy_power_down(struct et131x_adapter *etdev, bool down)
{
u16 data;
- MiRead(etdev, PHY_CONTROL, &data);
+ et131x_mii_read(etdev, PHY_CONTROL, &data);
data &= ~0x0800; /* Power UP */
if (down) /* Power DOWN */
data |= 0x0800;
- MiWrite(etdev, PHY_CONTROL, data);
+ et131x_mii_write(etdev, PHY_CONTROL, data);
}
/**
- * ET130_PhyAutoNEg - autonegotiate control
+ * et1310_phy_auto_neg - autonegotiate control
* @etdev: device to control
* @enabe: autoneg on/off
*
* Set up the autonegotiation state according to whether we will be
* negotiating the state or forcing a speed.
*/
-
-static void ET1310_PhyAutoNeg(struct et131x_adapter *etdev, bool enable)
+static void et1310_phy_auto_neg(struct et131x_adapter *etdev, bool enable)
{
u16 data;
- MiRead(etdev, PHY_CONTROL, &data);
+ et131x_mii_read(etdev, PHY_CONTROL, &data);
data &= ~0x1000; /* Autonegotiation OFF */
if (enable)
data |= 0x1000; /* Autonegotiation ON */
- MiWrite(etdev, PHY_CONTROL, data);
+ et131x_mii_write(etdev, PHY_CONTROL, data);
}
/**
- * ET130_PhyDuplexMode - duplex control
+ * et1310_phy_duplex_mode - duplex control
* @etdev: device to control
* @duplex: duplex on/off
*
* Set up the duplex state on the PHY
*/
-
-static void ET1310_PhyDuplexMode(struct et131x_adapter *etdev, u16 duplex)
+static void et1310_phy_duplex_mode(struct et131x_adapter *etdev, u16 duplex)
{
u16 data;
- MiRead(etdev, PHY_CONTROL, &data);
+ et131x_mii_read(etdev, PHY_CONTROL, &data);
data &= ~0x100; /* Set Half Duplex */
if (duplex == TRUEPHY_DUPLEX_FULL)
data |= 0x100; /* Set Full Duplex */
- MiWrite(etdev, PHY_CONTROL, data);
+ et131x_mii_write(etdev, PHY_CONTROL, data);
}
/**
- * ET130_PhySpeedSelect - speed control
+ * et1310_phy_speed_select - speed control
* @etdev: device to control
* @duplex: duplex on/off
*
* Set the speed of our PHY.
*/
-
-static void ET1310_PhySpeedSelect(struct et131x_adapter *etdev, u16 speed)
+static void et1310_phy_speed_select(struct et131x_adapter *etdev, u16 speed)
{
u16 data;
static const u16 bits[3] = {0x0000, 0x2000, 0x0040};
/* Read the PHY control register */
- MiRead(etdev, PHY_CONTROL, &data);
+ et131x_mii_read(etdev, PHY_CONTROL, &data);
/* Clear all Speed settings (Bits 6, 13) */
data &= ~0x2040;
/* Write back the new speed */
- MiWrite(etdev, PHY_CONTROL, data | bits[speed]);
+ et131x_mii_write(etdev, PHY_CONTROL, data | bits[speed]);
}
/**
- * ET1310_PhyLinkStatus - read link state
+ * et1310_phy_link_status - read link state
* @etdev: device to read
* @link_status: reported link state
* @autoneg: reported autonegotiation state (complete/incomplete/disabled)
@@ -370,8 +364,7 @@ static void ET1310_PhySpeedSelect(struct et131x_adapter *etdev, u16 speed)
* I know your link speed
* I see all the setting that you'd rather keep
*/
-
-static void ET1310_PhyLinkStatus(struct et131x_adapter *etdev,
+static void et1310_phy_link_status(struct et131x_adapter *etdev,
u8 *link_status,
u32 *autoneg,
u32 *linkspeed,
@@ -384,10 +377,10 @@ static void ET1310_PhyLinkStatus(struct et131x_adapter *etdev,
u16 vmi_phystatus = 0;
u16 control = 0;
- MiRead(etdev, PHY_STATUS, &mistatus);
- MiRead(etdev, PHY_1000_STATUS, &is1000BaseT);
- MiRead(etdev, PHY_PHY_STATUS, &vmi_phystatus);
- MiRead(etdev, PHY_CONTROL, &control);
+ et131x_mii_read(etdev, PHY_STATUS, &mistatus);
+ et131x_mii_read(etdev, PHY_1000_STATUS, &is1000BaseT);
+ et131x_mii_read(etdev, PHY_PHY_STATUS, &vmi_phystatus);
+ et131x_mii_read(etdev, PHY_CONTROL, &control);
*link_status = (vmi_phystatus & 0x0040) ? 1 : 0;
*autoneg = (control & 0x1000) ? ((vmi_phystatus & 0x0020) ?
@@ -405,26 +398,26 @@ static void ET1310_PhyLinkStatus(struct et131x_adapter *etdev,
TRUEPHY_POLARITY_INVERTED : TRUEPHY_POLARITY_NORMAL;
}
-static void ET1310_PhyAndOrReg(struct et131x_adapter *etdev,
- u16 regnum, u16 andMask, u16 orMask)
+static void et1310_phy_and_or_reg(struct et131x_adapter *etdev,
+ u16 regnum, u16 and_mask, u16 or_mask)
{
u16 reg;
- MiRead(etdev, regnum, ®);
- reg &= andMask;
- reg |= orMask;
- MiWrite(etdev, regnum, reg);
+ et131x_mii_read(etdev, regnum, ®);
+ reg &= and_mask;
+ reg |= or_mask;
+ et131x_mii_write(etdev, regnum, reg);
}
-/* Still used from _mac for BIT_READ */
-void ET1310_PhyAccessMiBit(struct et131x_adapter *etdev, u16 action,
- u16 regnum, u16 bitnum, u8 *value)
+/* Still used from _mac for BIT_READ */
+void et1310_phy_access_mii_bit(struct et131x_adapter *etdev, u16 action,
+ u16 regnum, u16 bitnum, u8 *value)
{
u16 reg;
u16 mask = 0x0001 << bitnum;
/* Read the requested register */
- MiRead(etdev, regnum, ®);
+ et131x_mii_read(etdev, regnum, ®);
switch (action) {
case TRUEPHY_BIT_READ:
@@ -432,11 +425,11 @@ void ET1310_PhyAccessMiBit(struct et131x_adapter *etdev, u16 action,
break;
case TRUEPHY_BIT_SET:
- MiWrite(etdev, regnum, reg | mask);
+ et131x_mii_write(etdev, regnum, reg | mask);
break;
case TRUEPHY_BIT_CLEAR:
- MiWrite(etdev, regnum, reg & ~mask);
+ et131x_mii_write(etdev, regnum, reg & ~mask);
break;
default:
@@ -444,13 +437,13 @@ void ET1310_PhyAccessMiBit(struct et131x_adapter *etdev, u16 action,
}
}
-void ET1310_PhyAdvertise1000BaseT(struct et131x_adapter *etdev,
+void et1310_phy_advertise_1000BaseT(struct et131x_adapter *etdev,
u16 duplex)
{
u16 data;
/* Read the PHY 1000 Base-T Control Register */
- MiRead(etdev, PHY_1000_CONTROL, &data);
+ et131x_mii_read(etdev, PHY_1000_CONTROL, &data);
/* Clear Bits 8,9 */
data &= ~0x0300;
@@ -477,16 +470,16 @@ void ET1310_PhyAdvertise1000BaseT(struct et131x_adapter *etdev,
}
/* Write back advertisement */
- MiWrite(etdev, PHY_1000_CONTROL, data);
+ et131x_mii_write(etdev, PHY_1000_CONTROL, data);
}
-static void ET1310_PhyAdvertise100BaseT(struct et131x_adapter *etdev,
- u16 duplex)
+static void et1310_phy_advertise_100BaseT(struct et131x_adapter *etdev,
+ u16 duplex)
{
u16 data;
/* Read the Autonegotiation Register (10/100) */
- MiRead(etdev, PHY_AUTO_ADVERTISEMENT, &data);
+ et131x_mii_read(etdev, PHY_AUTO_ADVERTISEMENT, &data);
/* Clear bits 7,8 */
data &= ~0x0180;
@@ -514,16 +507,16 @@ static void ET1310_PhyAdvertise100BaseT(struct et131x_adapter *etdev,
}
/* Write back advertisement */
- MiWrite(etdev, PHY_AUTO_ADVERTISEMENT, data);
+ et131x_mii_write(etdev, PHY_AUTO_ADVERTISEMENT, data);
}
-static void ET1310_PhyAdvertise10BaseT(struct et131x_adapter *etdev,
+static void et1310_phy_advertise_10BaseT(struct et131x_adapter *etdev,
u16 duplex)
{
u16 data;
/* Read the Autonegotiation Register (10/100) */
- MiRead(etdev, PHY_AUTO_ADVERTISEMENT, &data);
+ et131x_mii_read(etdev, PHY_AUTO_ADVERTISEMENT, &data);
/* Clear bits 5,6 */
data &= ~0x0060;
@@ -551,25 +544,9 @@ static void ET1310_PhyAdvertise10BaseT(struct et131x_adapter *etdev,
}
/* Write back advertisement */
- MiWrite(etdev, PHY_AUTO_ADVERTISEMENT, data);
-}
-
-/**
- * et131x_setphy_normal - Set PHY for normal operation.
- * @etdev: pointer to our private adapter structure
- *
- * Used by Power Management to force the PHY into 10 Base T half-duplex mode,
- * when going to D3 in WOL mode. Also used during initialization to set the
- * PHY for normal operation.
- */
-void et131x_setphy_normal(struct et131x_adapter *etdev)
-{
- /* Make sure the PHY is powered up */
- ET1310_PhyPowerDown(etdev, 0);
- et131x_xcvr_init(etdev);
+ et131x_mii_write(etdev, PHY_AUTO_ADVERTISEMENT, data);
}
-
/**
* et131x_xcvr_init - Init the phy if we are setting it into force mode
* @etdev: pointer to our private adapter structure
@@ -584,15 +561,15 @@ static void et131x_xcvr_init(struct et131x_adapter *etdev)
/* Zero out the adapter structure variable representing BMSR */
etdev->bmsr = 0;
- MiRead(etdev, (u8) offsetof(struct mi_regs, isr), &isr);
- MiRead(etdev, (u8) offsetof(struct mi_regs, imr), &imr);
+ et131x_mii_read(etdev, (u8) offsetof(struct mi_regs, isr), &isr);
+ et131x_mii_read(etdev, (u8) offsetof(struct mi_regs, imr), &imr);
/* Set the link status interrupt only. Bad behavior when link status
* and auto neg are set, we run into a nested interrupt problem
*/
imr |= 0x0105;
- MiWrite(etdev, (u8) offsetof(struct mi_regs, imr), imr);
+ et131x_mii_write(etdev, (u8) offsetof(struct mi_regs, imr), imr);
/* Set the LED behavior such that LED 1 indicates speed (off =
* 10Mbits, blink = 100Mbits, on = 1000Mbits) and LED 2 indicates
@@ -603,7 +580,7 @@ static void et131x_xcvr_init(struct et131x_adapter *etdev)
* EEPROM. However, the above description is the default.
*/
if ((etdev->eeprom_data[1] & 0x4) == 0) {
- MiRead(etdev, (u8) offsetof(struct mi_regs, lcr2),
+ et131x_mii_read(etdev, (u8) offsetof(struct mi_regs, lcr2),
&lcr2);
lcr2 &= 0x00FF;
@@ -614,7 +591,7 @@ static void et131x_xcvr_init(struct et131x_adapter *etdev)
else
lcr2 |= 0x0400;
- MiWrite(etdev, (u8) offsetof(struct mi_regs, lcr2),
+ et131x_mii_write(etdev, (u8) offsetof(struct mi_regs, lcr2),
lcr2);
}
@@ -622,113 +599,130 @@ static void et131x_xcvr_init(struct et131x_adapter *etdev)
if (etdev->AiForceSpeed == 0 && etdev->AiForceDpx == 0) {
if (etdev->wanted_flow == FLOW_TXONLY ||
etdev->wanted_flow == FLOW_BOTH)
- ET1310_PhyAccessMiBit(etdev,
+ et1310_phy_access_mii_bit(etdev,
TRUEPHY_BIT_SET, 4, 11, NULL);
else
- ET1310_PhyAccessMiBit(etdev,
+ et1310_phy_access_mii_bit(etdev,
TRUEPHY_BIT_CLEAR, 4, 11, NULL);
if (etdev->wanted_flow == FLOW_BOTH)
- ET1310_PhyAccessMiBit(etdev,
+ et1310_phy_access_mii_bit(etdev,
TRUEPHY_BIT_SET, 4, 10, NULL);
else
- ET1310_PhyAccessMiBit(etdev,
+ et1310_phy_access_mii_bit(etdev,
TRUEPHY_BIT_CLEAR, 4, 10, NULL);
/* Set the phy to autonegotiation */
- ET1310_PhyAutoNeg(etdev, true);
+ et1310_phy_auto_neg(etdev, true);
/* NOTE - Do we need this? */
- ET1310_PhyAccessMiBit(etdev, TRUEPHY_BIT_SET, 0, 9, NULL);
+ et1310_phy_access_mii_bit(etdev, TRUEPHY_BIT_SET, 0, 9, NULL);
return;
}
- ET1310_PhyAutoNeg(etdev, false);
+ et1310_phy_auto_neg(etdev, false);
/* Set to the correct force mode. */
if (etdev->AiForceDpx != 1) {
if (etdev->wanted_flow == FLOW_TXONLY ||
etdev->wanted_flow == FLOW_BOTH)
- ET1310_PhyAccessMiBit(etdev,
+ et1310_phy_access_mii_bit(etdev,
TRUEPHY_BIT_SET, 4, 11, NULL);
else
- ET1310_PhyAccessMiBit(etdev,
+ et1310_phy_access_mii_bit(etdev,
TRUEPHY_BIT_CLEAR, 4, 11, NULL);
if (etdev->wanted_flow == FLOW_BOTH)
- ET1310_PhyAccessMiBit(etdev,
+ et1310_phy_access_mii_bit(etdev,
TRUEPHY_BIT_SET, 4, 10, NULL);
else
- ET1310_PhyAccessMiBit(etdev,
+ et1310_phy_access_mii_bit(etdev,
TRUEPHY_BIT_CLEAR, 4, 10, NULL);
} else {
- ET1310_PhyAccessMiBit(etdev, TRUEPHY_BIT_CLEAR, 4, 10, NULL);
- ET1310_PhyAccessMiBit(etdev, TRUEPHY_BIT_CLEAR, 4, 11, NULL);
+ et1310_phy_access_mii_bit(etdev, TRUEPHY_BIT_CLEAR,
+ 4, 10, NULL);
+ et1310_phy_access_mii_bit(etdev, TRUEPHY_BIT_CLEAR,
+ 4, 11, NULL);
}
- ET1310_PhyPowerDown(etdev, 1);
+ et1310_phy_power_down(etdev, 1);
switch (etdev->AiForceSpeed) {
case 10:
/* First we need to turn off all other advertisement */
- ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
- ET1310_PhyAdvertise100BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
+ et1310_phy_advertise_1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
+ et1310_phy_advertise_100BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
if (etdev->AiForceDpx == 1) {
/* Set our advertise values accordingly */
- ET1310_PhyAdvertise10BaseT(etdev,
+ et1310_phy_advertise_10BaseT(etdev,
TRUEPHY_ADV_DUPLEX_HALF);
} else if (etdev->AiForceDpx == 2) {
/* Set our advertise values accordingly */
- ET1310_PhyAdvertise10BaseT(etdev,
+ et1310_phy_advertise_10BaseT(etdev,
TRUEPHY_ADV_DUPLEX_FULL);
} else {
/* Disable autoneg */
- ET1310_PhyAutoNeg(etdev, false);
+ et1310_phy_auto_neg(etdev, false);
/* Disable rest of the advertisements */
- ET1310_PhyAdvertise10BaseT(etdev,
+ et1310_phy_advertise_10BaseT(etdev,
TRUEPHY_ADV_DUPLEX_NONE);
/* Force 10 Mbps */
- ET1310_PhySpeedSelect(etdev, TRUEPHY_SPEED_10MBPS);
+ et1310_phy_speed_select(etdev, TRUEPHY_SPEED_10MBPS);
/* Force Full duplex */
- ET1310_PhyDuplexMode(etdev, TRUEPHY_DUPLEX_FULL);
+ et1310_phy_duplex_mode(etdev, TRUEPHY_DUPLEX_FULL);
}
break;
case 100:
/* first we need to turn off all other advertisement */
- ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
- ET1310_PhyAdvertise10BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
+ et1310_phy_advertise_1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
+ et1310_phy_advertise_10BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
if (etdev->AiForceDpx == 1) {
/* Set our advertise values accordingly */
- ET1310_PhyAdvertise100BaseT(etdev,
+ et1310_phy_advertise_100BaseT(etdev,
TRUEPHY_ADV_DUPLEX_HALF);
/* Set speed */
- ET1310_PhySpeedSelect(etdev, TRUEPHY_SPEED_100MBPS);
+ et1310_phy_speed_select(etdev, TRUEPHY_SPEED_100MBPS);
} else if (etdev->AiForceDpx == 2) {
/* Set our advertise values accordingly */
- ET1310_PhyAdvertise100BaseT(etdev,
+ et1310_phy_advertise_100BaseT(etdev,
TRUEPHY_ADV_DUPLEX_FULL);
} else {
/* Disable autoneg */
- ET1310_PhyAutoNeg(etdev, false);
+ et1310_phy_auto_neg(etdev, false);
/* Disable other advertisement */
- ET1310_PhyAdvertise100BaseT(etdev,
+ et1310_phy_advertise_100BaseT(etdev,
TRUEPHY_ADV_DUPLEX_NONE);
/* Force 100 Mbps */
- ET1310_PhySpeedSelect(etdev, TRUEPHY_SPEED_100MBPS);
+ et1310_phy_speed_select(etdev, TRUEPHY_SPEED_100MBPS);
/* Force Full duplex */
- ET1310_PhyDuplexMode(etdev, TRUEPHY_DUPLEX_FULL);
+ et1310_phy_duplex_mode(etdev, TRUEPHY_DUPLEX_FULL);
}
break;
case 1000:
/* first we need to turn off all other advertisement */
- ET1310_PhyAdvertise100BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
- ET1310_PhyAdvertise10BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
+ et1310_phy_advertise_100BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
+ et1310_phy_advertise_10BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
/* set our advertise values accordingly */
- ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_FULL);
+ et1310_phy_advertise_1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_FULL);
break;
}
- ET1310_PhyPowerDown(etdev, 0);
+ et1310_phy_power_down(etdev, 0);
+}
+
+/**
+ * et131x_setphy_normal - Set PHY for normal operation.
+ * @etdev: pointer to our private adapter structure
+ *
+ * Used by Power Management to force the PHY into 10 Base T half-duplex mode,
+ * when going to D3 in WOL mode. Also used during initialization to set the
+ * PHY for normal operation.
+ */
+void et131x_setphy_normal(struct et131x_adapter *etdev)
+{
+ /* Make sure the PHY is powered up */
+ et1310_phy_power_down(etdev, 0);
+ et131x_xcvr_init(etdev);
}
-void et131x_Mii_check(struct et131x_adapter *etdev,
+void et131x_mii_check(struct et131x_adapter *etdev,
u16 bmsr, u16 bmsr_ints)
{
u8 link_status;
@@ -764,13 +758,14 @@ void et131x_Mii_check(struct et131x_adapter *etdev,
* && TRU_QueryCoreType(etdev->hTruePhy, 0) ==
* EMI_TRUEPHY_A13O) {
*/
- u16 Register18;
-
- MiRead(etdev, 0x12, &Register18);
- MiWrite(etdev, 0x12, Register18 | 0x4);
- MiWrite(etdev, 0x10, Register18 | 0x8402);
- MiWrite(etdev, 0x11, Register18 | 511);
- MiWrite(etdev, 0x12, Register18);
+ u16 register18;
+
+ et131x_mii_read(etdev, 0x12, ®ister18);
+ et131x_mii_write(etdev, 0x12, register18 | 0x4);
+ et131x_mii_write(etdev, 0x10,
+ register18 | 0x8402);
+ et131x_mii_write(etdev, 0x11, register18 | 511);
+ et131x_mii_write(etdev, 0x12, register18);
}
/* For the first N seconds of life, we are in "link
@@ -805,7 +800,7 @@ void et131x_Mii_check(struct et131x_adapter *etdev,
* Bring the device back to the state it was during
* init prior to autonegotiation being complete. This
* way, when we get the auto-neg complete interrupt,
- * we can complete init by calling ConfigMacREGS2.
+ * we can complete init by calling config_mac_regs2.
*/
et131x_soft_reset(etdev);
@@ -824,7 +819,7 @@ void et131x_Mii_check(struct et131x_adapter *etdev,
(etdev->AiForceDpx == 3 && (bmsr_ints & MI_BMSR_LINK_STATUS))) {
if ((bmsr & MI_BMSR_AUTO_NEG_COMPLETE) ||
etdev->AiForceDpx == 3) {
- ET1310_PhyLinkStatus(etdev,
+ et1310_phy_link_status(etdev,
&link_status, &autoneg_status,
&speed, &duplex, &mdi_mdix,
&masterslave, &polarity);
@@ -841,20 +836,21 @@ void et131x_Mii_check(struct et131x_adapter *etdev,
* && TRU_QueryCoreType(etdev->hTruePhy, 0)==
* EMI_TRUEPHY_A13O) {
*/
- u16 Register18;
-
- MiRead(etdev, 0x12, &Register18);
- MiWrite(etdev, 0x12, Register18 | 0x4);
- MiWrite(etdev, 0x10, Register18 | 0x8402);
- MiWrite(etdev, 0x11, Register18 | 511);
- MiWrite(etdev, 0x12, Register18);
+ u16 register18;
+
+ et131x_mii_read(etdev, 0x12, ®ister18);
+ et131x_mii_write(etdev, 0x12, register18 | 0x4);
+ et131x_mii_write(etdev, 0x10,
+ register18 | 0x8402);
+ et131x_mii_write(etdev, 0x11, register18 | 511);
+ et131x_mii_write(etdev, 0x12, register18);
}
config_flow_control(etdev);
if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS &&
etdev->RegistryJumboPacket > 2048)
- ET1310_PhyAndOrReg(etdev, 0x16, 0xcfff,
+ et1310_phy_and_or_reg(etdev, 0x16, 0xcfff,
0x2000);
SetRxDmaTimer(etdev);
@@ -868,9 +864,8 @@ void et131x_Mii_check(struct et131x_adapter *etdev,
* primarily by the routines above (although there are a few places elsewhere
* in the driver where this level of access is required).
*/
-
-static const u16 ConfigPhy[25][2] = {
- /* Reg Value Register */
+static const u16 config_phy[25][2] = {
+ /* Reg Value Register */
/* Addr */
{0x880B, 0x0926}, /* AfeIfCreg4B1000Msbs */
{0x880C, 0x0926}, /* AfeIfCreg4B100Msbs */
@@ -906,11 +901,10 @@ static const u16 ConfigPhy[25][2] = {
{0x8010, 46}, /* IdlguardTime */
{0, 0}
-
};
/* condensed version of the phy initialization routine */
-void ET1310_PhyInit(struct et131x_adapter *etdev)
+void et1310_phy_init(struct et131x_adapter *etdev)
{
u16 data, index;
@@ -918,62 +912,66 @@ void ET1310_PhyInit(struct et131x_adapter *etdev)
return;
/* get the identity (again ?) */
- MiRead(etdev, PHY_ID_1, &data);
- MiRead(etdev, PHY_ID_2, &data);
+ et131x_mii_read(etdev, PHY_ID_1, &data);
+ et131x_mii_read(etdev, PHY_ID_2, &data);
/* what does this do/achieve ? */
- MiRead(etdev, PHY_MPHY_CONTROL_REG, &data); /* should read 0002 */
- MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0006);
+ /* should read 0002 */
+ et131x_mii_read(etdev, PHY_MPHY_CONTROL_REG, &data);
+ et131x_mii_write(etdev, PHY_MPHY_CONTROL_REG, 0x0006);
/* read modem register 0402, should I do something with the return
data ? */
- MiWrite(etdev, PHY_INDEX_REG, 0x0402);
- MiRead(etdev, PHY_DATA_REG, &data);
+ et131x_mii_write(etdev, PHY_INDEX_REG, 0x0402);
+ et131x_mii_read(etdev, PHY_DATA_REG, &data);
/* what does this do/achieve ? */
- MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0002);
+ et131x_mii_write(etdev, PHY_MPHY_CONTROL_REG, 0x0002);
/* get the identity (again ?) */
- MiRead(etdev, PHY_ID_1, &data);
- MiRead(etdev, PHY_ID_2, &data);
+ et131x_mii_read(etdev, PHY_ID_1, &data);
+ et131x_mii_read(etdev, PHY_ID_2, &data);
/* what does this achieve ? */
- MiRead(etdev, PHY_MPHY_CONTROL_REG, &data); /* should read 0002 */
- MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0006);
+ /* should read 0002 */
+ et131x_mii_read(etdev, PHY_MPHY_CONTROL_REG, &data);
+ et131x_mii_write(etdev, PHY_MPHY_CONTROL_REG, 0x0006);
/* read modem register 0402, should I do something with
the return data? */
- MiWrite(etdev, PHY_INDEX_REG, 0x0402);
- MiRead(etdev, PHY_DATA_REG, &data);
+ et131x_mii_write(etdev, PHY_INDEX_REG, 0x0402);
+ et131x_mii_read(etdev, PHY_DATA_REG, &data);
- MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0002);
+ et131x_mii_write(etdev, PHY_MPHY_CONTROL_REG, 0x0002);
/* what does this achieve (should return 0x1040) */
- MiRead(etdev, PHY_CONTROL, &data);
- MiRead(etdev, PHY_MPHY_CONTROL_REG, &data); /* should read 0002 */
- MiWrite(etdev, PHY_CONTROL, 0x1840);
+ et131x_mii_read(etdev, PHY_CONTROL, &data);
+ /* should read 0002 */
+ et131x_mii_read(etdev, PHY_MPHY_CONTROL_REG, &data);
+ et131x_mii_write(etdev, PHY_CONTROL, 0x1840);
- MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0007);
+ et131x_mii_write(etdev, PHY_MPHY_CONTROL_REG, 0x0007);
/* here the writing of the array starts.... */
index = 0;
- while (ConfigPhy[index][0] != 0x0000) {
+ while (config_phy[index][0] != 0x0000) {
/* write value */
- MiWrite(etdev, PHY_INDEX_REG, ConfigPhy[index][0]);
- MiWrite(etdev, PHY_DATA_REG, ConfigPhy[index][1]);
+ et131x_mii_write(etdev, PHY_INDEX_REG, config_phy[index][0]);
+ et131x_mii_write(etdev, PHY_DATA_REG, config_phy[index][1]);
/* read it back */
- MiWrite(etdev, PHY_INDEX_REG, ConfigPhy[index][0]);
- MiRead(etdev, PHY_DATA_REG, &data);
+ et131x_mii_write(etdev, PHY_INDEX_REG, config_phy[index][0]);
+ et131x_mii_read(etdev, PHY_DATA_REG, &data);
/* do a check on the value read back ? */
index++;
}
/* here the writing of the array ends... */
- MiRead(etdev, PHY_CONTROL, &data); /* 0x1840 */
- MiRead(etdev, PHY_MPHY_CONTROL_REG, &data);/* should read 0007 */
- MiWrite(etdev, PHY_CONTROL, 0x1040);
- MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0002);
+ et131x_mii_read(etdev, PHY_CONTROL, &data); /* 0x1840 */
+ /* should read 0007 */
+ et131x_mii_read(etdev, PHY_MPHY_CONTROL_REG, &data);
+ et131x_mii_write(etdev, PHY_CONTROL, 0x1040);
+ et131x_mii_write(etdev, PHY_MPHY_CONTROL_REG, 0x0002);
}
diff --git a/drivers/staging/et131x/et131x.h b/drivers/staging/et131x/et131x.h
index 289d511..c4f9032 100644
--- a/drivers/staging/et131x/et131x.h
+++ b/drivers/staging/et131x/et131x.h
@@ -90,14 +90,14 @@ void EnablePhyComa(struct et131x_adapter *adapter);
void DisablePhyComa(struct et131x_adapter *adapter);
/* et131x_phy.c */
-void ET1310_PhyInit(struct et131x_adapter *adapter);
-void ET1310_PhyReset(struct et131x_adapter *adapter);
-void ET1310_PhyPowerDown(struct et131x_adapter *adapter, bool down);
-void ET1310_PhyAdvertise1000BaseT(struct et131x_adapter *adapter,
- u16 duplex);
-void ET1310_PhyAccessMiBit(struct et131x_adapter *adapter,
- u16 action,
- u16 regnum, u16 bitnum, u8 *value);
+void et1310_phy_init(struct et131x_adapter *adapter);
+void et1310_phy_reset(struct et131x_adapter *adapter);
+void et1310_phy_power_down(struct et131x_adapter *adapter, bool down);
+void et1310_phy_advertise_1000BaseT(struct et131x_adapter *adapter,
+ u16 duplex);
+void et1310_phy_access_mii_bit(struct et131x_adapter *adapter,
+ u16 action,
+ u16 regnum, u16 bitnum, u8 *value);
int et131x_xcvr_find(struct et131x_adapter *adapter);
void et131x_setphy_normal(struct et131x_adapter *adapter);
@@ -105,23 +105,18 @@ void et131x_setphy_normal(struct et131x_adapter *adapter);
/* static inline function does not work because et131x_adapter is not always
* defined
*/
-int PhyMiRead(struct et131x_adapter *adapter, u8 xcvrAddr,
+int et131x_phy_mii_read(struct et131x_adapter *adapter, u8 xcvrAddr,
u8 xcvrReg, u16 *value);
-#define MiRead(adapter, xcvrReg, value) \
- PhyMiRead((adapter), (adapter)->stats.xcvr_addr, (xcvrReg), (value))
+#define et131x_mii_read(adapter, xcvrReg, value) \
+ et131x_phy_mii_read((adapter), \
+ (adapter)->stats.xcvr_addr, \
+ (xcvrReg), (value))
-int32_t MiWrite(struct et131x_adapter *adapter,
+int32_t et131x_mii_write(struct et131x_adapter *adapter,
u8 xcvReg, u16 value);
-void et131x_Mii_check(struct et131x_adapter *pAdapter,
+void et131x_mii_check(struct et131x_adapter *pAdapter,
u16 bmsr, u16 bmsr_ints);
-/* This last is not strictly required (the driver could call the TPAL
- * version instead), but this sets the adapter up correctly, and calls the
- * access routine indirectly. This protects the driver from changes in TPAL.
- */
-void SetPhy_10BaseTHalfDuplex(struct et131x_adapter *adapter);
-
-
/* et1310_rx.c */
int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter);
void et131x_rx_dma_memory_free(struct et131x_adapter *adapter);
diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c
index d98db85..9b01f22 100644
--- a/drivers/staging/et131x/et131x_initpci.c
+++ b/drivers/staging/et131x/et131x_initpci.c
@@ -401,28 +401,28 @@ int et131x_adapter_setup(struct et131x_adapter *etdev)
dev_warn(&etdev->pdev->dev, "Could not find the xcvr\n");
/* Prepare the TRUEPHY library. */
- ET1310_PhyInit(etdev);
+ et1310_phy_init(etdev);
/* Reset the phy now so changes take place */
- ET1310_PhyReset(etdev);
+ et1310_phy_reset(etdev);
/* Power down PHY */
- ET1310_PhyPowerDown(etdev, 1);
+ et1310_phy_power_down(etdev, 1);
/*
* We need to turn off 1000 base half dulplex, the mac does not
* support it. For the 10/100 part, turn off all gig advertisement
*/
if (etdev->pdev->device != ET131X_PCI_DEVICE_ID_FAST)
- ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_FULL);
+ et1310_phy_advertise_1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_FULL);
else
- ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
+ et1310_phy_advertise_1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
/* Power up PHY */
- ET1310_PhyPowerDown(etdev, 0);
+ et1310_phy_power_down(etdev, 0);
et131x_setphy_normal(etdev);
-; return status;
+ return status;
}
/**
diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c
index 48b4d78..0a810cc 100644
--- a/drivers/staging/et131x/et131x_isr.c
+++ b/drivers/staging/et131x/et131x_isr.c
@@ -385,11 +385,12 @@ void et131x_isr_handler(struct work_struct *work)
/* Read the PHY ISR to clear the reason for the
* interrupt.
*/
- MiRead(etdev, (uint8_t) offsetof(struct mi_regs, isr),
- &myisr);
+ et131x_mii_read(etdev,
+ (uint8_t) offsetof(struct mi_regs, isr),
+ &myisr);
if (!etdev->ReplicaPhyLoopbk) {
- MiRead(etdev,
+ et131x_mii_read(etdev,
(uint8_t) offsetof(struct mi_regs, bmsr),
&bmsr_data);
@@ -397,7 +398,7 @@ void et131x_isr_handler(struct work_struct *work)
etdev->bmsr = bmsr_data;
/* Do all the cable in / cable out stuff */
- et131x_Mii_check(etdev, bmsr_data, bmsr_ints);
+ et131x_mii_check(etdev, bmsr_data, bmsr_ints);
}
}
diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c
index 4e9e176..0f12b58 100644
--- a/drivers/staging/et131x/et131x_netdev.c
+++ b/drivers/staging/et131x/et131x_netdev.c
@@ -221,7 +221,7 @@ int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
if (!capable(CAP_NET_ADMIN))
status = -EPERM;
else
- status = MiRead(etdev,
+ status = et131x_mii_read(etdev,
data->reg_num, &data->val_out);
break;
@@ -229,7 +229,7 @@ int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
if (!capable(CAP_NET_ADMIN))
status = -EPERM;
else
- status = MiWrite(etdev, data->reg_num,
+ status = et131x_mii_write(etdev, data->reg_num,
data->val_in);
break;
--
1.7.4.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 03/10] staging: et131x: Converting et1310_pm.c function and local names from CamelCase
2011-07-10 15:35 [PATCH 0/10] staging: et131x: Kernel coding style cleanups Mark Einon
2011-07-10 15:35 ` [PATCH 01/10] staging: et131x: Converting et1310_mac.c function and local names from CamelCase Mark Einon
2011-07-10 15:35 ` [PATCH 02/10] staging: et131x: Converting et1310_phy.c " Mark Einon
@ 2011-07-10 15:35 ` Mark Einon
2011-07-10 15:35 ` [PATCH 04/10] staging: et131x: Remove unecessary *etdev NULL check in et1310_phy_init() Mark Einon
` (6 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Mark Einon @ 2011-07-10 15:35 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, o.hartmann, Mark Einon
Tested on an ET-131x device.
Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
drivers/staging/et131x/et1310_phy.c | 2 +-
drivers/staging/et131x/et1310_pm.c | 8 ++++----
drivers/staging/et131x/et131x.h | 8 ++++----
drivers/staging/et131x/et131x_initpci.c | 2 +-
drivers/staging/et131x/et131x_isr.c | 2 +-
5 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c
index d53656b..72892e0 100644
--- a/drivers/staging/et131x/et1310_phy.c
+++ b/drivers/staging/et131x/et1310_phy.c
@@ -811,7 +811,7 @@ void et131x_mii_check(struct et131x_adapter *etdev,
* plugged back in
*/
if (etdev->RegistryPhyComa == 1)
- EnablePhyComa(etdev);
+ et1310_enable_phy_coma(etdev);
}
}
diff --git a/drivers/staging/et131x/et1310_pm.c b/drivers/staging/et131x/et1310_pm.c
index 29d4d66..1bfcc67 100644
--- a/drivers/staging/et131x/et1310_pm.c
+++ b/drivers/staging/et131x/et1310_pm.c
@@ -87,7 +87,7 @@
#include "et131x.h"
/**
- * EnablePhyComa - called when network cable is unplugged
+ * et1310_enable_phy_coma - called when network cable is unplugged
* @etdev: pointer to our adapter structure
*
* driver receive an phy status change interrupt while in D0 and check that
@@ -106,7 +106,7 @@
* indicating linkup status, call the MPDisablePhyComa routine to
* restore JAGCore and gigE PHY
*/
-void EnablePhyComa(struct et131x_adapter *etdev)
+void et1310_enable_phy_coma(struct et131x_adapter *etdev)
{
unsigned long flags;
u32 pmcsr;
@@ -136,10 +136,10 @@ void EnablePhyComa(struct et131x_adapter *etdev)
}
/**
- * DisablePhyComa - Disable the Phy Coma Mode
+ * et1310_disable_phy_coma - Disable the Phy Coma Mode
* @etdev: pointer to our adapter structure
*/
-void DisablePhyComa(struct et131x_adapter *etdev)
+void et1310_disable_phy_coma(struct et131x_adapter *etdev)
{
u32 pmcsr;
diff --git a/drivers/staging/et131x/et131x.h b/drivers/staging/et131x/et131x.h
index c4f9032..240305e 100644
--- a/drivers/staging/et131x/et131x.h
+++ b/drivers/staging/et131x/et131x.h
@@ -85,11 +85,11 @@ void setup_device_for_unicast(struct et131x_adapter *adapter);
/* et131x_netdev.c */
struct net_device *et131x_device_alloc(void);
-/* et131x_pm.c */
-void EnablePhyComa(struct et131x_adapter *adapter);
-void DisablePhyComa(struct et131x_adapter *adapter);
+/* et1310_pm.c */
+void et1310_enable_phy_coma(struct et131x_adapter *adapter);
+void et1310_disable_phy_coma(struct et131x_adapter *adapter);
-/* et131x_phy.c */
+/* et1310_phy.c */
void et1310_phy_init(struct et131x_adapter *adapter);
void et1310_phy_reset(struct et131x_adapter *adapter);
void et1310_phy_power_down(struct et131x_adapter *adapter, bool down);
diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c
index 9b01f22..c39f5f0 100644
--- a/drivers/staging/et131x/et131x_initpci.c
+++ b/drivers/staging/et131x/et131x_initpci.c
@@ -288,7 +288,7 @@ void et131x_error_timer_handler(unsigned long data)
* interrupt'. How to do that under Linux?
*/
et131x_enable_interrupts(etdev);
- EnablePhyComa(etdev);
+ et1310_enable_phy_coma(etdev);
}
}
}
diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c
index 0a810cc..dd952f0 100644
--- a/drivers/staging/et131x/et131x_isr.c
+++ b/drivers/staging/et131x/et131x_isr.c
@@ -379,7 +379,7 @@ void et131x_isr_handler(struct work_struct *work)
* so, disable it because we will not be able
* to read PHY values until we are out.
*/
- DisablePhyComa(etdev);
+ et1310_disable_phy_coma(etdev);
}
/* Read the PHY ISR to clear the reason for the
--
1.7.4.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 04/10] staging: et131x: Remove unecessary *etdev NULL check in et1310_phy_init()
2011-07-10 15:35 [PATCH 0/10] staging: et131x: Kernel coding style cleanups Mark Einon
` (2 preceding siblings ...)
2011-07-10 15:35 ` [PATCH 03/10] staging: et131x: Converting et1310_pm.c " Mark Einon
@ 2011-07-10 15:35 ` Mark Einon
2011-07-10 15:35 ` [PATCH 05/10] staging: et131x: Converting et1310_rx.c function and local names from CamelCase Mark Einon
` (5 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Mark Einon @ 2011-07-10 15:35 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, o.hartmann, Mark Einon
It is impossible to get to this function with the pointer being NULL.
Tested on an ET-131x device.
Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
drivers/staging/et131x/et1310_phy.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c
index 72892e0..61ee744 100644
--- a/drivers/staging/et131x/et1310_phy.c
+++ b/drivers/staging/et131x/et1310_phy.c
@@ -908,9 +908,6 @@ void et1310_phy_init(struct et131x_adapter *etdev)
{
u16 data, index;
- if (etdev == NULL)
- return;
-
/* get the identity (again ?) */
et131x_mii_read(etdev, PHY_ID_1, &data);
et131x_mii_read(etdev, PHY_ID_2, &data);
--
1.7.4.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 05/10] staging: et131x: Converting et1310_rx.c function and local names from CamelCase
2011-07-10 15:35 [PATCH 0/10] staging: et131x: Kernel coding style cleanups Mark Einon
` (3 preceding siblings ...)
2011-07-10 15:35 ` [PATCH 04/10] staging: et131x: Remove unecessary *etdev NULL check in et1310_phy_init() Mark Einon
@ 2011-07-10 15:35 ` Mark Einon
2011-07-10 15:35 ` [PATCH 06/10] staging: et131x: Make static some local functions in et1310_rx.c Mark Einon
` (4 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Mark Einon @ 2011-07-10 15:35 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, o.hartmann, Mark Einon
Also renamed some items to improve readability, and other minor tidy-ups.
Tested on an ET-131x device.
Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
drivers/staging/et131x/et1310_phy.c | 2 +-
drivers/staging/et131x/et1310_rx.c | 191 +++++++++++++++----------------
drivers/staging/et131x/et131x.h | 4 +-
drivers/staging/et131x/et131x_initpci.c | 2 +-
4 files changed, 97 insertions(+), 102 deletions(-)
diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c
index 61ee744..f6c35b6 100644
--- a/drivers/staging/et131x/et1310_phy.c
+++ b/drivers/staging/et131x/et1310_phy.c
@@ -853,7 +853,7 @@ void et131x_mii_check(struct et131x_adapter *etdev,
et1310_phy_and_or_reg(etdev, 0x16, 0xcfff,
0x2000);
- SetRxDmaTimer(etdev);
+ et131x_set_rx_dma_timer(etdev);
config_mac_regs2(etdev);
}
}
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c
index 7e386e0..e5bafc8 100644
--- a/drivers/staging/et131x/et1310_rx.c
+++ b/drivers/staging/et131x/et1310_rx.c
@@ -88,22 +88,22 @@
#include "et1310_rx.h"
#include "et131x.h"
-static inline u32 bump_fbr(u32 *fbr, u32 limit)
+static inline u32 bump_free_buff_ring(u32 *free_buff_ring, u32 limit)
{
- u32 v = *fbr;
- v++;
+ u32 tmp_free_buff_ring = *free_buff_ring;
+ tmp_free_buff_ring++;
/* This works for all cases where limit < 1024. The 1023 case
works because 1023++ is 1024 which means the if condition is not
taken but the carry of the bit into the wrap bit toggles the wrap
value correctly */
- if ((v & ET_DMA10_MASK) > limit) {
- v &= ~ET_DMA10_MASK;
- v ^= ET_DMA10_WRAP;
+ if ((tmp_free_buff_ring & ET_DMA10_MASK) > limit) {
+ tmp_free_buff_ring &= ~ET_DMA10_MASK;
+ tmp_free_buff_ring ^= ET_DMA10_WRAP;
}
/* For the 1023 case */
- v &= (ET_DMA10_MASK|ET_DMA10_WRAP);
- *fbr = v;
- return v;
+ tmp_free_buff_ring &= (ET_DMA10_MASK|ET_DMA10_WRAP);
+ *free_buff_ring = tmp_free_buff_ring;
+ return tmp_free_buff_ring;
}
/**
@@ -119,7 +119,7 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
{
u32 i, j;
u32 bufsize;
- u32 pktStatRingSize, FBRChunkSize;
+ u32 pktstat_ringsize, fbr_chunksize;
struct rx_ring *rx_ring;
/* Setup some convenience pointers */
@@ -239,9 +239,9 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
for (i = 0; i < (rx_ring->Fbr1NumEntries / FBR_CHUNKS);
i++) {
- u64 Fbr1Offset;
- u64 Fbr1TempPa;
- u32 Fbr1Align;
+ u64 fbr1_offset;
+ u64 fbr1_tmp_physaddr;
+ u32 fbr1_align;
/* This code allocates an area of memory big enough for N
* free buffers + (buffer_size - 1) so that the buffers can
@@ -251,14 +251,14 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
* reduce this overhead.
*/
if (rx_ring->Fbr1BufferSize > 4096)
- Fbr1Align = 4096;
+ fbr1_align = 4096;
else
- Fbr1Align = rx_ring->Fbr1BufferSize;
+ fbr1_align = rx_ring->Fbr1BufferSize;
- FBRChunkSize =
- (FBR_CHUNKS * rx_ring->Fbr1BufferSize) + Fbr1Align - 1;
+ fbr_chunksize =
+ (FBR_CHUNKS * rx_ring->Fbr1BufferSize) + fbr1_align - 1;
rx_ring->Fbr1MemVa[i] =
- pci_alloc_consistent(adapter->pdev, FBRChunkSize,
+ pci_alloc_consistent(adapter->pdev, fbr_chunksize,
&rx_ring->Fbr1MemPa[i]);
if (!rx_ring->Fbr1MemVa[i]) {
@@ -268,11 +268,11 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
}
/* See NOTE in "Save Physical Address" comment above */
- Fbr1TempPa = rx_ring->Fbr1MemPa[i];
+ fbr1_tmp_physaddr = rx_ring->Fbr1MemPa[i];
et131x_align_allocated_memory(adapter,
- &Fbr1TempPa,
- &Fbr1Offset, (Fbr1Align - 1));
+ &fbr1_tmp_physaddr,
+ &fbr1_offset, (fbr1_align - 1));
for (j = 0; j < FBR_CHUNKS; j++) {
u32 index = (i * FBR_CHUNKS) + j;
@@ -282,16 +282,17 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
*/
rx_ring->fbr[1]->virt[index] =
(u8 *) rx_ring->Fbr1MemVa[i] +
- (j * rx_ring->Fbr1BufferSize) + Fbr1Offset;
+ (j * rx_ring->Fbr1BufferSize) + fbr1_offset;
/* now store the physical address in the descriptor
* so the device can access it
*/
rx_ring->fbr[1]->bus_high[index] =
- (u32) (Fbr1TempPa >> 32);
- rx_ring->fbr[1]->bus_low[index] = (u32) Fbr1TempPa;
+ (u32) (fbr1_tmp_physaddr >> 32);
+ rx_ring->fbr[1]->bus_low[index] =
+ (u32) fbr1_tmp_physaddr;
- Fbr1TempPa += rx_ring->Fbr1BufferSize;
+ fbr1_tmp_physaddr += rx_ring->Fbr1BufferSize;
rx_ring->fbr[1]->buffer1[index] =
rx_ring->fbr[1]->virt[index];
@@ -304,12 +305,13 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
/* Same for FBR0 (if in use) */
for (i = 0; i < (rx_ring->Fbr0NumEntries / FBR_CHUNKS);
i++) {
- u64 Fbr0Offset;
- u64 Fbr0TempPa;
+ u64 fbr0_offset;
+ u64 fbr0_tmp_physaddr;
- FBRChunkSize = ((FBR_CHUNKS + 1) * rx_ring->Fbr0BufferSize) - 1;
+ fbr_chunksize =
+ ((FBR_CHUNKS + 1) * rx_ring->Fbr0BufferSize) - 1;
rx_ring->Fbr0MemVa[i] =
- pci_alloc_consistent(adapter->pdev, FBRChunkSize,
+ pci_alloc_consistent(adapter->pdev, fbr_chunksize,
&rx_ring->Fbr0MemPa[i]);
if (!rx_ring->Fbr0MemVa[i]) {
@@ -319,11 +321,11 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
}
/* See NOTE in "Save Physical Address" comment above */
- Fbr0TempPa = rx_ring->Fbr0MemPa[i];
+ fbr0_tmp_physaddr = rx_ring->Fbr0MemPa[i];
et131x_align_allocated_memory(adapter,
- &Fbr0TempPa,
- &Fbr0Offset,
+ &fbr0_tmp_physaddr,
+ &fbr0_offset,
rx_ring->Fbr0BufferSize - 1);
for (j = 0; j < FBR_CHUNKS; j++) {
@@ -331,13 +333,14 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
rx_ring->fbr[0]->virt[index] =
(u8 *) rx_ring->Fbr0MemVa[i] +
- (j * rx_ring->Fbr0BufferSize) + Fbr0Offset;
+ (j * rx_ring->Fbr0BufferSize) + fbr0_offset;
rx_ring->fbr[0]->bus_high[index] =
- (u32) (Fbr0TempPa >> 32);
- rx_ring->fbr[0]->bus_low[index] = (u32) Fbr0TempPa;
+ (u32) (fbr0_tmp_physaddr >> 32);
+ rx_ring->fbr[0]->bus_low[index] =
+ (u32) fbr0_tmp_physaddr;
- Fbr0TempPa += rx_ring->Fbr0BufferSize;
+ fbr0_tmp_physaddr += rx_ring->Fbr0BufferSize;
rx_ring->fbr[0]->buffer1[index] =
rx_ring->fbr[0]->virt[index];
@@ -348,11 +351,11 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
#endif
/* Allocate an area of memory for FIFO of Packet Status ring entries */
- pktStatRingSize =
+ pktstat_ringsize =
sizeof(struct pkt_stat_desc) * adapter->rx_ring.PsrNumEntries;
rx_ring->pPSRingVa = pci_alloc_consistent(adapter->pdev,
- pktStatRingSize,
+ pktstat_ringsize,
&rx_ring->pPSRingPa);
if (!rx_ring->pPSRingVa) {
@@ -360,7 +363,8 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
"Cannot alloc memory for Packet Status Ring\n");
return -ENOMEM;
}
- printk(KERN_INFO "PSR %lx\n", (unsigned long) rx_ring->pPSRingPa);
+ printk(KERN_INFO "Packet Status Ring %lx\n",
+ (unsigned long) rx_ring->pPSRingPa);
/*
* NOTE : pci_alloc_consistent(), used above to alloc DMA regions,
@@ -411,7 +415,7 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter)
{
u32 index;
u32 bufsize;
- u32 pktStatRingSize;
+ u32 pktstat_ringsize;
struct rfd *rfd;
struct rx_ring *rx_ring;
@@ -436,16 +440,16 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter)
for (index = 0; index <
(rx_ring->Fbr1NumEntries / FBR_CHUNKS); index++) {
if (rx_ring->Fbr1MemVa[index]) {
- u32 Fbr1Align;
+ u32 fbr1_align;
if (rx_ring->Fbr1BufferSize > 4096)
- Fbr1Align = 4096;
+ fbr1_align = 4096;
else
- Fbr1Align = rx_ring->Fbr1BufferSize;
+ fbr1_align = rx_ring->Fbr1BufferSize;
bufsize =
(rx_ring->Fbr1BufferSize * FBR_CHUNKS) +
- Fbr1Align - 1;
+ fbr1_align - 1;
pci_free_consistent(adapter->pdev,
bufsize,
@@ -506,10 +510,10 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter)
/* Free Packet Status Ring */
if (rx_ring->pPSRingVa) {
- pktStatRingSize =
+ pktstat_ringsize =
sizeof(struct pkt_stat_desc) * adapter->rx_ring.PsrNumEntries;
- pci_free_consistent(adapter->pdev, pktStatRingSize,
+ pci_free_consistent(adapter->pdev, pktstat_ringsize,
rx_ring->pPSRingVa, rx_ring->pPSRingPa);
rx_ring->pPSRingVa = NULL;
@@ -597,10 +601,10 @@ int et131x_init_recv(struct et131x_adapter *adapter)
}
/**
- * ConfigRxDmaRegs - Start of Rx_DMA init sequence
+ * et131x_config_rx_dma_regs - Start of Rx_DMA init sequence
* @etdev: pointer to our adapter structure
*/
-void ConfigRxDmaRegs(struct et131x_adapter *etdev)
+void et131x_config_rx_dma_regs(struct et131x_adapter *etdev)
{
struct rxdma_regs __iomem *rx_dma = &etdev->regs->rxdma;
struct rx_ring *rx_local = &etdev->rx_ring;
@@ -708,10 +712,10 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev)
}
/**
- * SetRxDmaTimer - Set the heartbeat timer according to line rate.
+ * et131x_set_rx_dma_timer - Set the heartbeat timer according to line rate.
* @etdev: pointer to our adapter structure
*/
-void SetRxDmaTimer(struct et131x_adapter *etdev)
+void et131x_set_rx_dma_timer(struct et131x_adapter *etdev)
{
/* For version B silicon, we do not use the RxDMA timer for 10 and 100
* Mbits/s line rates. We do not enable and RxDMA interrupt coalescing.
@@ -732,8 +736,8 @@ void nic_return_rfd(struct et131x_adapter *etdev, struct rfd *rfd)
{
struct rx_ring *rx_local = &etdev->rx_ring;
struct rxdma_regs __iomem *rx_dma = &etdev->regs->rxdma;
- u16 bi = rfd->bufferindex;
- u8 ri = rfd->ringindex;
+ u16 buff_index = rfd->bufferindex;
+ u8 ring_index = rfd->ringindex;
unsigned long flags;
/* We don't use any of the OOB data besides status. Otherwise, we
@@ -741,12 +745,12 @@ void nic_return_rfd(struct et131x_adapter *etdev, struct rfd *rfd)
*/
if (
#ifdef USE_FBR0
- (ri == 0 && bi < rx_local->Fbr0NumEntries) ||
+ (ring_index == 0 && buff_index < rx_local->Fbr0NumEntries) ||
#endif
- (ri == 1 && bi < rx_local->Fbr1NumEntries)) {
+ (ring_index == 1 && buff_index < rx_local->Fbr1NumEntries)) {
spin_lock_irqsave(&etdev->FbrLock, flags);
- if (ri == 1) {
+ if (ring_index == 1) {
struct fbr_desc *next =
(struct fbr_desc *) (rx_local->pFbr1RingVa) +
INDEX10(rx_local->local_Fbr1_full);
@@ -755,11 +759,11 @@ void nic_return_rfd(struct et131x_adapter *etdev, struct rfd *rfd)
* the PA / Buffer Index for the returned buffer into
* the oldest (next to be freed)FBR entry
*/
- next->addr_hi = rx_local->fbr[1]->bus_high[bi];
- next->addr_lo = rx_local->fbr[1]->bus_low[bi];
- next->word2 = bi;
+ next->addr_hi = rx_local->fbr[1]->bus_high[buff_index];
+ next->addr_lo = rx_local->fbr[1]->bus_low[buff_index];
+ next->word2 = buff_index;
- writel(bump_fbr(&rx_local->local_Fbr1_full,
+ writel(bump_free_buff_ring(&rx_local->local_Fbr1_full,
rx_local->Fbr1NumEntries - 1),
&rx_dma->fbr1_full_offset);
}
@@ -773,11 +777,11 @@ void nic_return_rfd(struct et131x_adapter *etdev, struct rfd *rfd)
* the PA / Buffer Index for the returned buffer into
* the oldest (next to be freed) FBR entry
*/
- next->addr_hi = rx_local->fbr[0]->bus_high[bi];
- next->addr_lo = rx_local->fbr[0]->bus_low[bi];
- next->word2 = bi;
+ next->addr_hi = rx_local->fbr[0]->bus_high[buff_index];
+ next->addr_lo = rx_local->fbr[0]->bus_low[buff_index];
+ next->word2 = buff_index;
- writel(bump_fbr(&rx_local->local_Fbr0_full,
+ writel(bump_free_buff_ring(&rx_local->local_Fbr0_full,
rx_local->Fbr0NumEntries - 1),
&rx_dma->fbr0_full_offset);
}
@@ -785,7 +789,7 @@ void nic_return_rfd(struct et131x_adapter *etdev, struct rfd *rfd)
spin_unlock_irqrestore(&etdev->FbrLock, flags);
} else {
dev_err(&etdev->pdev->dev,
- "NICReturnRFD illegal Buffer Index returned\n");
+ "%s illegal Buffer Index returned\n", __func__);
}
/* The processing on this RFD is done, so put it back on the tail of
@@ -878,8 +882,8 @@ struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
u8 *buf;
unsigned long flags;
struct list_head *element;
- u8 rindex;
- u16 bindex;
+ u8 ring_index;
+ u16 buff_index;
u32 len;
u32 word0;
u32 word1;
@@ -905,8 +909,8 @@ struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
* accurate
*/
len = psr->word1 & 0xFFFF;
- rindex = (psr->word1 >> 26) & 0x03;
- bindex = (psr->word1 >> 16) & 0x3FF;
+ ring_index = (psr->word1 >> 26) & 0x03;
+ buff_index = (psr->word1 >> 16) & 0x3FF;
word0 = psr->word0;
/* Indicate that we have used this PSR entry. */
@@ -922,18 +926,18 @@ struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
&etdev->regs->rxdma.psr_full_offset);
#ifndef USE_FBR0
- if (rindex != 1)
+ if (ring_index != 1)
return NULL;
#endif
#ifdef USE_FBR0
- if (rindex > 1 ||
- (rindex == 0 &&
- bindex > rx_local->Fbr0NumEntries - 1) ||
- (rindex == 1 &&
- bindex > rx_local->Fbr1NumEntries - 1))
+ if (ring_index > 1 ||
+ (ring_index == 0 &&
+ buff_index > rx_local->Fbr0NumEntries - 1) ||
+ (ring_index == 1 &&
+ buff_index > rx_local->Fbr1NumEntries - 1))
#else
- if (rindex != 1 || bindex > rx_local->Fbr1NumEntries - 1)
+ if (ring_index != 1 || buff_index > rx_local->Fbr1NumEntries - 1)
#endif
{
/* Illegal buffer or ring index cannot be used by S/W*/
@@ -941,7 +945,7 @@ struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
"NICRxPkts PSR Entry %d indicates "
"length of %d and/or bad bi(%d)\n",
rx_local->local_psr_full & 0xFFF,
- len, bindex);
+ len, buff_index);
return NULL;
}
@@ -962,8 +966,8 @@ struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
spin_unlock_irqrestore(&etdev->rcv_lock, flags);
- rfd->bufferindex = bindex;
- rfd->ringindex = rindex;
+ rfd->bufferindex = buff_index;
+ rfd->ringindex = ring_index;
/* In V1 silicon, there is a bug which screws up filtering of
* runt packets. Therefore runt packet filtering is disabled
@@ -977,7 +981,7 @@ struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
if (len) {
if (etdev->ReplicaPhyLoopbk == 1) {
- buf = rx_local->fbr[rindex]->virt[bindex];
+ buf = rx_local->fbr[ring_index]->virt[buff_index];
if (memcmp(&buf[6], etdev->addr, ETH_ALEN) == 0) {
if (memcmp(&buf[42], "Replica packet",
@@ -1000,28 +1004,20 @@ struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
if ((etdev->PacketFilter & ET131X_PACKET_TYPE_MULTICAST)
&& !(etdev->PacketFilter & ET131X_PACKET_TYPE_PROMISCUOUS)
&& !(etdev->PacketFilter & ET131X_PACKET_TYPE_ALL_MULTICAST)) {
- buf = rx_local->fbr[rindex]->
- virt[bindex];
+ buf = rx_local->fbr[ring_index]->
+ virt[buff_index];
/* Loop through our list to see if the
* destination address of this packet
* matches one in our list.
*/
- for (i = 0;
- i < etdev->MCAddressCount;
- i++) {
- if (buf[0] ==
- etdev->MCList[i][0]
- && buf[1] ==
- etdev->MCList[i][1]
- && buf[2] ==
- etdev->MCList[i][2]
- && buf[3] ==
- etdev->MCList[i][3]
- && buf[4] ==
- etdev->MCList[i][4]
- && buf[5] ==
- etdev->MCList[i][5]) {
+ for (i = 0; i < etdev->MCAddressCount; i++) {
+ if (buf[0] == etdev->MCList[i][0]
+ && buf[1] == etdev->MCList[i][1]
+ && buf[2] == etdev->MCList[i][2]
+ && buf[3] == etdev->MCList[i][3]
+ && buf[4] == etdev->MCList[i][4]
+ && buf[5] == etdev->MCList[i][5]) {
break;
}
}
@@ -1067,7 +1063,7 @@ struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
etdev->net_stats.rx_bytes += rfd->len;
memcpy(skb_put(skb, rfd->len),
- rx_local->fbr[rindex]->virt[bindex],
+ rx_local->fbr[ring_index]->virt[buff_index],
rfd->len);
skb->dev = etdev->netdev;
@@ -1092,7 +1088,6 @@ struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
void et131x_reset_recv(struct et131x_adapter *etdev)
{
WARN_ON(list_empty(&etdev->rx_ring.RecvList));
-
}
/**
diff --git a/drivers/staging/et131x/et131x.h b/drivers/staging/et131x/et131x.h
index 240305e..c33594b 100644
--- a/drivers/staging/et131x/et131x.h
+++ b/drivers/staging/et131x/et131x.h
@@ -126,8 +126,8 @@ void et131x_rfd_resources_free(struct et131x_adapter *adapter,
struct rfd *rfd);
int et131x_init_recv(struct et131x_adapter *adapter);
-void ConfigRxDmaRegs(struct et131x_adapter *adapter);
-void SetRxDmaTimer(struct et131x_adapter *adapter);
+void et131x_config_rx_dma_regs(struct et131x_adapter *adapter);
+void et131x_set_rx_dma_timer(struct et131x_adapter *adapter);
void et131x_rx_dma_disable(struct et131x_adapter *adapter);
void et131x_rx_dma_enable(struct et131x_adapter *adapter);
diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c
index c39f5f0..75b2c48 100644
--- a/drivers/staging/et131x/et131x_initpci.c
+++ b/drivers/staging/et131x/et131x_initpci.c
@@ -389,7 +389,7 @@ int et131x_adapter_setup(struct et131x_adapter *etdev)
config_rxmac_regs(etdev);
config_txmac_regs(etdev);
- ConfigRxDmaRegs(etdev);
+ et131x_config_rx_dma_regs(etdev);
ConfigTxDmaRegs(etdev);
config_macstat_regs(etdev);
--
1.7.4.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 06/10] staging: et131x: Make static some local functions in et1310_rx.c
2011-07-10 15:35 [PATCH 0/10] staging: et131x: Kernel coding style cleanups Mark Einon
` (4 preceding siblings ...)
2011-07-10 15:35 ` [PATCH 05/10] staging: et131x: Converting et1310_rx.c function and local names from CamelCase Mark Einon
@ 2011-07-10 15:35 ` Mark Einon
2011-07-10 15:35 ` [PATCH 07/10] staging: et131x: Converting et1310_rx.h variable names from CamelCase Mark Einon
` (3 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Mark Einon @ 2011-07-10 15:35 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, o.hartmann, Mark Einon
Tested on an ET-131x device.
Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
drivers/staging/et131x/et1310_rx.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c
index e5bafc8..926ea66 100644
--- a/drivers/staging/et131x/et1310_rx.c
+++ b/drivers/staging/et131x/et1310_rx.c
@@ -732,7 +732,7 @@ void et131x_set_rx_dma_timer(struct et131x_adapter *etdev)
* @etdev: pointer to our adapter
* @rfd: pointer to the RFD
*/
-void nic_return_rfd(struct et131x_adapter *etdev, struct rfd *rfd)
+static void nic_return_rfd(struct et131x_adapter *etdev, struct rfd *rfd)
{
struct rx_ring *rx_local = &etdev->rx_ring;
struct rxdma_regs __iomem *rx_dma = &etdev->regs->rxdma;
@@ -872,7 +872,7 @@ void et131x_rx_dma_enable(struct et131x_adapter *etdev)
* the packet to it, puts the RFD in the RecvPendList, and also returns
* the pointer to the RFD.
*/
-struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
+static struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
{
struct rx_ring *rx_local = &etdev->rx_ring;
struct rx_status_block *status;
--
1.7.4.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 07/10] staging: et131x: Converting et1310_rx.h variable names from CamelCase
2011-07-10 15:35 [PATCH 0/10] staging: et131x: Kernel coding style cleanups Mark Einon
` (5 preceding siblings ...)
2011-07-10 15:35 ` [PATCH 06/10] staging: et131x: Make static some local functions in et1310_rx.c Mark Einon
@ 2011-07-10 15:35 ` Mark Einon
2011-07-10 15:35 ` [PATCH 08/10] staging: et131x: add et1310_ prefix to et1310_mac.c functions Mark Einon
` (2 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Mark Einon @ 2011-07-10 15:35 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, o.hartmann, Mark Einon
Tested on an ET-131x device.
Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
drivers/staging/et131x/et1310_rx.c | 338 ++++++++++++++++++-----------------
drivers/staging/et131x/et1310_rx.h | 62 ++++----
drivers/staging/et131x/et131x_isr.c | 2 +-
3 files changed, 205 insertions(+), 197 deletions(-)
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c
index 926ea66..694bb02 100644
--- a/drivers/staging/et131x/et1310_rx.c
+++ b/drivers/staging/et131x/et1310_rx.c
@@ -151,40 +151,40 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
if (adapter->RegistryJumboPacket < 2048) {
#ifdef USE_FBR0
- rx_ring->Fbr0BufferSize = 256;
- rx_ring->Fbr0NumEntries = 512;
+ rx_ring->fbr0_buffsize = 256;
+ rx_ring->fbr0_num_entries = 512;
#endif
- rx_ring->Fbr1BufferSize = 2048;
- rx_ring->Fbr1NumEntries = 512;
+ rx_ring->fbr1_buffsize = 2048;
+ rx_ring->fbr1_num_entries = 512;
} else if (adapter->RegistryJumboPacket < 4096) {
#ifdef USE_FBR0
- rx_ring->Fbr0BufferSize = 512;
- rx_ring->Fbr0NumEntries = 1024;
+ rx_ring->fbr0_buffsize = 512;
+ rx_ring->fbr0_num_entries = 1024;
#endif
- rx_ring->Fbr1BufferSize = 4096;
- rx_ring->Fbr1NumEntries = 512;
+ rx_ring->fbr1_buffsize = 4096;
+ rx_ring->fbr1_num_entries = 512;
} else {
#ifdef USE_FBR0
- rx_ring->Fbr0BufferSize = 1024;
- rx_ring->Fbr0NumEntries = 768;
+ rx_ring->fbr0_buffsize = 1024;
+ rx_ring->fbr0_num_entries = 768;
#endif
- rx_ring->Fbr1BufferSize = 16384;
- rx_ring->Fbr1NumEntries = 128;
+ rx_ring->fbr1_buffsize = 16384;
+ rx_ring->fbr1_num_entries = 128;
}
#ifdef USE_FBR0
- adapter->rx_ring.PsrNumEntries = adapter->rx_ring.Fbr0NumEntries +
- adapter->rx_ring.Fbr1NumEntries;
+ adapter->rx_ring.psr_num_entries = adapter->rx_ring.fbr0_num_entries +
+ adapter->rx_ring.fbr1_num_entries;
#else
- adapter->rx_ring.PsrNumEntries = adapter->rx_ring.Fbr1NumEntries;
+ adapter->rx_ring.psr_num_entries = adapter->rx_ring.fbr1_num_entries;
#endif
/* Allocate an area of memory for Free Buffer Ring 1 */
- bufsize = (sizeof(struct fbr_desc) * rx_ring->Fbr1NumEntries) + 0xfff;
- rx_ring->pFbr1RingVa = pci_alloc_consistent(adapter->pdev,
- bufsize,
- &rx_ring->pFbr1RingPa);
- if (!rx_ring->pFbr1RingVa) {
+ bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr1_num_entries) + 0xfff;
+ rx_ring->fbr1_ring_virtaddr = pci_alloc_consistent(adapter->pdev,
+ bufsize,
+ &rx_ring->fbr1_ring_physaddr);
+ if (!rx_ring->fbr1_ring_virtaddr) {
dev_err(&adapter->pdev->dev,
"Cannot alloc memory for Free Buffer Ring 1\n");
return -ENOMEM;
@@ -197,23 +197,24 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
* are ever returned, make sure the high part is retrieved here
* before storing the adjusted address.
*/
- rx_ring->Fbr1Realpa = rx_ring->pFbr1RingPa;
+ rx_ring->fbr1_real_physaddr = rx_ring->fbr1_ring_physaddr;
/* Align Free Buffer Ring 1 on a 4K boundary */
et131x_align_allocated_memory(adapter,
- &rx_ring->Fbr1Realpa,
- &rx_ring->Fbr1offset, 0x0FFF);
+ &rx_ring->fbr1_real_physaddr,
+ &rx_ring->fbr1_offset, 0x0FFF);
- rx_ring->pFbr1RingVa = (void *)((u8 *) rx_ring->pFbr1RingVa +
- rx_ring->Fbr1offset);
+ rx_ring->fbr1_ring_virtaddr =
+ (void *)((u8 *) rx_ring->fbr1_ring_virtaddr +
+ rx_ring->fbr1_offset);
#ifdef USE_FBR0
/* Allocate an area of memory for Free Buffer Ring 0 */
- bufsize = (sizeof(struct fbr_desc) * rx_ring->Fbr0NumEntries) + 0xfff;
- rx_ring->pFbr0RingVa = pci_alloc_consistent(adapter->pdev,
- bufsize,
- &rx_ring->pFbr0RingPa);
- if (!rx_ring->pFbr0RingVa) {
+ bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr0_num_entries) + 0xfff;
+ rx_ring->fbr0_ring_virtaddr = pci_alloc_consistent(adapter->pdev,
+ bufsize,
+ &rx_ring->fbr0_ring_physaddr);
+ if (!rx_ring->fbr0_ring_virtaddr) {
dev_err(&adapter->pdev->dev,
"Cannot alloc memory for Free Buffer Ring 0\n");
return -ENOMEM;
@@ -226,19 +227,18 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
* are ever returned, make sure the high part is retrieved here before
* storing the adjusted address.
*/
- rx_ring->Fbr0Realpa = rx_ring->pFbr0RingPa;
+ rx_ring->fbr0_real_physaddr = rx_ring->fbr0_ring_physaddr;
/* Align Free Buffer Ring 0 on a 4K boundary */
et131x_align_allocated_memory(adapter,
- &rx_ring->Fbr0Realpa,
- &rx_ring->Fbr0offset, 0x0FFF);
+ &rx_ring->fbr0_real_physaddr,
+ &rx_ring->fbr0_offset, 0x0FFF);
- rx_ring->pFbr0RingVa = (void *)((u8 *) rx_ring->pFbr0RingVa +
- rx_ring->Fbr0offset);
+ rx_ring->fbr0_ring_virtaddr =
+ (void *)((u8 *) rx_ring->fbr0_ring_virtaddr +
+ rx_ring->fbr0_offset);
#endif
-
- for (i = 0; i < (rx_ring->Fbr1NumEntries / FBR_CHUNKS);
- i++) {
+ for (i = 0; i < (rx_ring->fbr1_num_entries / FBR_CHUNKS); i++) {
u64 fbr1_offset;
u64 fbr1_tmp_physaddr;
u32 fbr1_align;
@@ -250,25 +250,25 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
* the size of FBR0. By allocating N buffers at once, we
* reduce this overhead.
*/
- if (rx_ring->Fbr1BufferSize > 4096)
+ if (rx_ring->fbr1_buffsize > 4096)
fbr1_align = 4096;
else
- fbr1_align = rx_ring->Fbr1BufferSize;
+ fbr1_align = rx_ring->fbr1_buffsize;
fbr_chunksize =
- (FBR_CHUNKS * rx_ring->Fbr1BufferSize) + fbr1_align - 1;
- rx_ring->Fbr1MemVa[i] =
+ (FBR_CHUNKS * rx_ring->fbr1_buffsize) + fbr1_align - 1;
+ rx_ring->fbr1_mem_virtaddrs[i] =
pci_alloc_consistent(adapter->pdev, fbr_chunksize,
- &rx_ring->Fbr1MemPa[i]);
+ &rx_ring->fbr1_mem_physaddrs[i]);
- if (!rx_ring->Fbr1MemVa[i]) {
+ if (!rx_ring->fbr1_mem_virtaddrs[i]) {
dev_err(&adapter->pdev->dev,
"Could not alloc memory\n");
return -ENOMEM;
}
/* See NOTE in "Save Physical Address" comment above */
- fbr1_tmp_physaddr = rx_ring->Fbr1MemPa[i];
+ fbr1_tmp_physaddr = rx_ring->fbr1_mem_physaddrs[i];
et131x_align_allocated_memory(adapter,
&fbr1_tmp_physaddr,
@@ -281,8 +281,8 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
* access later
*/
rx_ring->fbr[1]->virt[index] =
- (u8 *) rx_ring->Fbr1MemVa[i] +
- (j * rx_ring->Fbr1BufferSize) + fbr1_offset;
+ (u8 *) rx_ring->fbr1_mem_virtaddrs[i] +
+ (j * rx_ring->fbr1_buffsize) + fbr1_offset;
/* now store the physical address in the descriptor
* so the device can access it
@@ -292,7 +292,7 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
rx_ring->fbr[1]->bus_low[index] =
(u32) fbr1_tmp_physaddr;
- fbr1_tmp_physaddr += rx_ring->Fbr1BufferSize;
+ fbr1_tmp_physaddr += rx_ring->fbr1_buffsize;
rx_ring->fbr[1]->buffer1[index] =
rx_ring->fbr[1]->virt[index];
@@ -303,44 +303,43 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
#ifdef USE_FBR0
/* Same for FBR0 (if in use) */
- for (i = 0; i < (rx_ring->Fbr0NumEntries / FBR_CHUNKS);
- i++) {
+ for (i = 0; i < (rx_ring->fbr0_num_entries / FBR_CHUNKS); i++) {
u64 fbr0_offset;
u64 fbr0_tmp_physaddr;
fbr_chunksize =
- ((FBR_CHUNKS + 1) * rx_ring->Fbr0BufferSize) - 1;
- rx_ring->Fbr0MemVa[i] =
+ ((FBR_CHUNKS + 1) * rx_ring->fbr0_buffsize) - 1;
+ rx_ring->fbr0_mem_virtaddrs[i] =
pci_alloc_consistent(adapter->pdev, fbr_chunksize,
- &rx_ring->Fbr0MemPa[i]);
+ &rx_ring->fbr0_mem_physaddrs[i]);
- if (!rx_ring->Fbr0MemVa[i]) {
+ if (!rx_ring->fbr0_mem_virtaddrs[i]) {
dev_err(&adapter->pdev->dev,
"Could not alloc memory\n");
return -ENOMEM;
}
/* See NOTE in "Save Physical Address" comment above */
- fbr0_tmp_physaddr = rx_ring->Fbr0MemPa[i];
+ fbr0_tmp_physaddr = rx_ring->fbr0_mem_physaddrs[i];
et131x_align_allocated_memory(adapter,
&fbr0_tmp_physaddr,
&fbr0_offset,
- rx_ring->Fbr0BufferSize - 1);
+ rx_ring->fbr0_buffsize - 1);
for (j = 0; j < FBR_CHUNKS; j++) {
u32 index = (i * FBR_CHUNKS) + j;
rx_ring->fbr[0]->virt[index] =
- (u8 *) rx_ring->Fbr0MemVa[i] +
- (j * rx_ring->Fbr0BufferSize) + fbr0_offset;
+ (u8 *) rx_ring->fbr0_mem_virtaddrs[i] +
+ (j * rx_ring->fbr0_buffsize) + fbr0_offset;
rx_ring->fbr[0]->bus_high[index] =
(u32) (fbr0_tmp_physaddr >> 32);
rx_ring->fbr[0]->bus_low[index] =
(u32) fbr0_tmp_physaddr;
- fbr0_tmp_physaddr += rx_ring->Fbr0BufferSize;
+ fbr0_tmp_physaddr += rx_ring->fbr0_buffsize;
rx_ring->fbr[0]->buffer1[index] =
rx_ring->fbr[0]->virt[index];
@@ -352,19 +351,19 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
/* Allocate an area of memory for FIFO of Packet Status ring entries */
pktstat_ringsize =
- sizeof(struct pkt_stat_desc) * adapter->rx_ring.PsrNumEntries;
+ sizeof(struct pkt_stat_desc) * adapter->rx_ring.psr_num_entries;
- rx_ring->pPSRingVa = pci_alloc_consistent(adapter->pdev,
+ rx_ring->ps_ring_virtaddr = pci_alloc_consistent(adapter->pdev,
pktstat_ringsize,
- &rx_ring->pPSRingPa);
+ &rx_ring->ps_ring_physaddr);
- if (!rx_ring->pPSRingVa) {
+ if (!rx_ring->ps_ring_virtaddr) {
dev_err(&adapter->pdev->dev,
"Cannot alloc memory for Packet Status Ring\n");
return -ENOMEM;
}
printk(KERN_INFO "Packet Status Ring %lx\n",
- (unsigned long) rx_ring->pPSRingPa);
+ (unsigned long) rx_ring->ps_ring_physaddr);
/*
* NOTE : pci_alloc_consistent(), used above to alloc DMA regions,
@@ -382,7 +381,7 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
"Cannot alloc memory for Status Block\n");
return -ENOMEM;
}
- rx_ring->NumRfd = NIC_DEFAULT_NUM_RFD;
+ rx_ring->num_rfd = NIC_DEFAULT_NUM_RFD;
printk(KERN_INFO "PRS %lx\n", (unsigned long)rx_ring->rx_status_bus);
/* Recv
@@ -391,7 +390,7 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
* freed to the lookaside list.
* RFDs will be allocated from this pool.
*/
- rx_ring->RecvLookaside = kmem_cache_create(adapter->netdev->name,
+ rx_ring->recv_lookaside = kmem_cache_create(adapter->netdev->name,
sizeof(struct rfd),
0,
SLAB_CACHE_DMA |
@@ -403,7 +402,7 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
/* The RFDs are going to be put on lists later on, so initialize the
* lists now.
*/
- INIT_LIST_HEAD(&rx_ring->RecvList);
+ INIT_LIST_HEAD(&rx_ring->recv_list);
return 0;
}
@@ -423,100 +422,104 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter)
rx_ring = &adapter->rx_ring;
/* Free RFDs and associated packet descriptors */
- WARN_ON(rx_ring->nReadyRecv != rx_ring->NumRfd);
+ WARN_ON(rx_ring->num_ready_recv != rx_ring->num_rfd);
- while (!list_empty(&rx_ring->RecvList)) {
- rfd = (struct rfd *) list_entry(rx_ring->RecvList.next,
+ while (!list_empty(&rx_ring->recv_list)) {
+ rfd = (struct rfd *) list_entry(rx_ring->recv_list.next,
struct rfd, list_node);
list_del(&rfd->list_node);
rfd->skb = NULL;
- kmem_cache_free(adapter->rx_ring.RecvLookaside, rfd);
+ kmem_cache_free(adapter->rx_ring.recv_lookaside, rfd);
}
/* Free Free Buffer Ring 1 */
- if (rx_ring->pFbr1RingVa) {
+ if (rx_ring->fbr1_ring_virtaddr) {
/* First the packet memory */
for (index = 0; index <
- (rx_ring->Fbr1NumEntries / FBR_CHUNKS); index++) {
- if (rx_ring->Fbr1MemVa[index]) {
+ (rx_ring->fbr1_num_entries / FBR_CHUNKS); index++) {
+ if (rx_ring->fbr1_mem_virtaddrs[index]) {
u32 fbr1_align;
- if (rx_ring->Fbr1BufferSize > 4096)
+ if (rx_ring->fbr1_buffsize > 4096)
fbr1_align = 4096;
else
- fbr1_align = rx_ring->Fbr1BufferSize;
+ fbr1_align = rx_ring->fbr1_buffsize;
bufsize =
- (rx_ring->Fbr1BufferSize * FBR_CHUNKS) +
+ (rx_ring->fbr1_buffsize * FBR_CHUNKS) +
fbr1_align - 1;
pci_free_consistent(adapter->pdev,
- bufsize,
- rx_ring->Fbr1MemVa[index],
- rx_ring->Fbr1MemPa[index]);
+ bufsize,
+ rx_ring->fbr1_mem_virtaddrs[index],
+ rx_ring->fbr1_mem_physaddrs[index]);
- rx_ring->Fbr1MemVa[index] = NULL;
+ rx_ring->fbr1_mem_virtaddrs[index] = NULL;
}
}
/* Now the FIFO itself */
- rx_ring->pFbr1RingVa = (void *)((u8 *)
- rx_ring->pFbr1RingVa - rx_ring->Fbr1offset);
+ rx_ring->fbr1_ring_virtaddr = (void *)((u8 *)
+ rx_ring->fbr1_ring_virtaddr - rx_ring->fbr1_offset);
- bufsize = (sizeof(struct fbr_desc) * rx_ring->Fbr1NumEntries)
+ bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr1_num_entries)
+ 0xfff;
pci_free_consistent(adapter->pdev, bufsize,
- rx_ring->pFbr1RingVa, rx_ring->pFbr1RingPa);
+ rx_ring->fbr1_ring_virtaddr,
+ rx_ring->fbr1_ring_physaddr);
- rx_ring->pFbr1RingVa = NULL;
+ rx_ring->fbr1_ring_virtaddr = NULL;
}
#ifdef USE_FBR0
/* Now the same for Free Buffer Ring 0 */
- if (rx_ring->pFbr0RingVa) {
+ if (rx_ring->fbr0_ring_virtaddr) {
/* First the packet memory */
for (index = 0; index <
- (rx_ring->Fbr0NumEntries / FBR_CHUNKS); index++) {
- if (rx_ring->Fbr0MemVa[index]) {
+ (rx_ring->fbr0_num_entries / FBR_CHUNKS); index++) {
+ if (rx_ring->fbr0_mem_virtaddrs[index]) {
bufsize =
- (rx_ring->Fbr0BufferSize *
+ (rx_ring->fbr0_buffsize *
(FBR_CHUNKS + 1)) - 1;
pci_free_consistent(adapter->pdev,
- bufsize,
- rx_ring->Fbr0MemVa[index],
- rx_ring->Fbr0MemPa[index]);
+ bufsize,
+ rx_ring->fbr0_mem_virtaddrs[index],
+ rx_ring->fbr0_mem_physaddrs[index]);
- rx_ring->Fbr0MemVa[index] = NULL;
+ rx_ring->fbr0_mem_virtaddrs[index] = NULL;
}
}
/* Now the FIFO itself */
- rx_ring->pFbr0RingVa = (void *)((u8 *)
- rx_ring->pFbr0RingVa - rx_ring->Fbr0offset);
+ rx_ring->fbr0_ring_virtaddr = (void *)((u8 *)
+ rx_ring->fbr0_ring_virtaddr - rx_ring->fbr0_offset);
- bufsize = (sizeof(struct fbr_desc) * rx_ring->Fbr0NumEntries)
+ bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr0_num_entries)
+ 0xfff;
pci_free_consistent(adapter->pdev,
bufsize,
- rx_ring->pFbr0RingVa, rx_ring->pFbr0RingPa);
+ rx_ring->fbr0_ring_virtaddr,
+ rx_ring->fbr0_ring_physaddr);
- rx_ring->pFbr0RingVa = NULL;
+ rx_ring->fbr0_ring_virtaddr = NULL;
}
#endif
/* Free Packet Status Ring */
- if (rx_ring->pPSRingVa) {
+ if (rx_ring->ps_ring_virtaddr) {
pktstat_ringsize =
- sizeof(struct pkt_stat_desc) * adapter->rx_ring.PsrNumEntries;
+ sizeof(struct pkt_stat_desc) *
+ adapter->rx_ring.psr_num_entries;
pci_free_consistent(adapter->pdev, pktstat_ringsize,
- rx_ring->pPSRingVa, rx_ring->pPSRingPa);
+ rx_ring->ps_ring_virtaddr,
+ rx_ring->ps_ring_physaddr);
- rx_ring->pPSRingVa = NULL;
+ rx_ring->ps_ring_virtaddr = NULL;
}
/* Free area of memory for the writeback of status information */
@@ -533,7 +536,7 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter)
/* Destroy the lookaside (RFD) pool */
if (adapter->flags & fMP_ADAPTER_RECV_LOOKASIDE) {
- kmem_cache_destroy(rx_ring->RecvLookaside);
+ kmem_cache_destroy(rx_ring->recv_lookaside);
adapter->flags &= ~fMP_ADAPTER_RECV_LOOKASIDE;
}
@@ -545,7 +548,7 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter)
kfree(rx_ring->fbr[1]);
/* Reset Counters */
- rx_ring->nReadyRecv = 0;
+ rx_ring->num_ready_recv = 0;
}
/**
@@ -566,8 +569,8 @@ int et131x_init_recv(struct et131x_adapter *adapter)
rx_ring = &adapter->rx_ring;
/* Setup each RFD */
- for (rfdct = 0; rfdct < rx_ring->NumRfd; rfdct++) {
- rfd = kmem_cache_alloc(rx_ring->RecvLookaside,
+ for (rfdct = 0; rfdct < rx_ring->num_rfd; rfdct++) {
+ rfd = kmem_cache_alloc(rx_ring->recv_lookaside,
GFP_ATOMIC | GFP_DMA);
if (!rfd) {
@@ -579,21 +582,21 @@ int et131x_init_recv(struct et131x_adapter *adapter)
rfd->skb = NULL;
- /* Add this RFD to the RecvList */
- list_add_tail(&rfd->list_node, &rx_ring->RecvList);
+ /* Add this RFD to the recv_list */
+ list_add_tail(&rfd->list_node, &rx_ring->recv_list);
/* Increment both the available RFD's, and the total RFD's. */
- rx_ring->nReadyRecv++;
+ rx_ring->num_ready_recv++;
numrfd++;
}
if (numrfd > NIC_MIN_NUM_RFD)
status = 0;
- rx_ring->NumRfd = numrfd;
+ rx_ring->num_rfd = numrfd;
if (status != 0) {
- kmem_cache_free(rx_ring->RecvLookaside, rfd);
+ kmem_cache_free(rx_ring->recv_lookaside, rfd);
dev_err(&adapter->pdev->dev,
"Allocation problems in et131x_init_recv\n");
}
@@ -632,10 +635,10 @@ void et131x_config_rx_dma_regs(struct et131x_adapter *etdev)
/* Set the address and parameters of the packet status ring into the
* 1310's registers
*/
- writel((u32) ((u64)rx_local->pPSRingPa >> 32),
+ writel((u32) ((u64)rx_local->ps_ring_physaddr >> 32),
&rx_dma->psr_base_hi);
- writel((u32) rx_local->pPSRingPa, &rx_dma->psr_base_lo);
- writel(rx_local->PsrNumEntries - 1, &rx_dma->psr_num_des);
+ writel((u32) rx_local->ps_ring_physaddr, &rx_dma->psr_base_lo);
+ writel(rx_local->psr_num_entries - 1, &rx_dma->psr_num_des);
writel(0, &rx_dma->psr_full_offset);
psr_num_des = readl(&rx_dma->psr_num_des) & 0xFFF;
@@ -648,8 +651,8 @@ void et131x_config_rx_dma_regs(struct et131x_adapter *etdev)
rx_local->local_psr_full = 0;
/* Now's the best time to initialize FBR1 contents */
- fbr_entry = (struct fbr_desc *) rx_local->pFbr1RingVa;
- for (entry = 0; entry < rx_local->Fbr1NumEntries; entry++) {
+ fbr_entry = (struct fbr_desc *) rx_local->fbr1_ring_virtaddr;
+ for (entry = 0; entry < rx_local->fbr1_num_entries; entry++) {
fbr_entry->addr_hi = rx_local->fbr[1]->bus_high[entry];
fbr_entry->addr_lo = rx_local->fbr[1]->bus_low[entry];
fbr_entry->word2 = entry;
@@ -659,39 +662,43 @@ void et131x_config_rx_dma_regs(struct et131x_adapter *etdev)
/* Set the address and parameters of Free buffer ring 1 (and 0 if
* required) into the 1310's registers
*/
- writel((u32) (rx_local->Fbr1Realpa >> 32), &rx_dma->fbr1_base_hi);
- writel((u32) rx_local->Fbr1Realpa, &rx_dma->fbr1_base_lo);
- writel(rx_local->Fbr1NumEntries - 1, &rx_dma->fbr1_num_des);
+ writel((u32) (rx_local->fbr1_real_physaddr >> 32),
+ &rx_dma->fbr1_base_hi);
+ writel((u32) rx_local->fbr1_real_physaddr, &rx_dma->fbr1_base_lo);
+ writel(rx_local->fbr1_num_entries - 1, &rx_dma->fbr1_num_des);
writel(ET_DMA10_WRAP, &rx_dma->fbr1_full_offset);
/* This variable tracks the free buffer ring 1 full position, so it
* has to match the above.
*/
- rx_local->local_Fbr1_full = ET_DMA10_WRAP;
- writel(((rx_local->Fbr1NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1,
- &rx_dma->fbr1_min_des);
+ rx_local->local_fbr1_full = ET_DMA10_WRAP;
+ writel(
+ ((rx_local->fbr1_num_entries * LO_MARK_PERCENT_FOR_RX) / 100) - 1,
+ &rx_dma->fbr1_min_des);
#ifdef USE_FBR0
/* Now's the best time to initialize FBR0 contents */
- fbr_entry = (struct fbr_desc *) rx_local->pFbr0RingVa;
- for (entry = 0; entry < rx_local->Fbr0NumEntries; entry++) {
+ fbr_entry = (struct fbr_desc *) rx_local->fbr0_ring_virtaddr;
+ for (entry = 0; entry < rx_local->fbr0_num_entries; entry++) {
fbr_entry->addr_hi = rx_local->fbr[0]->bus_high[entry];
fbr_entry->addr_lo = rx_local->fbr[0]->bus_low[entry];
fbr_entry->word2 = entry;
fbr_entry++;
}
- writel((u32) (rx_local->Fbr0Realpa >> 32), &rx_dma->fbr0_base_hi);
- writel((u32) rx_local->Fbr0Realpa, &rx_dma->fbr0_base_lo);
- writel(rx_local->Fbr0NumEntries - 1, &rx_dma->fbr0_num_des);
+ writel((u32) (rx_local->fbr0_real_physaddr >> 32),
+ &rx_dma->fbr0_base_hi);
+ writel((u32) rx_local->fbr0_real_physaddr, &rx_dma->fbr0_base_lo);
+ writel(rx_local->fbr0_num_entries - 1, &rx_dma->fbr0_num_des);
writel(ET_DMA10_WRAP, &rx_dma->fbr0_full_offset);
/* This variable tracks the free buffer ring 0 full position, so it
* has to match the above.
*/
- rx_local->local_Fbr0_full = ET_DMA10_WRAP;
- writel(((rx_local->Fbr0NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1,
- &rx_dma->fbr0_min_des);
+ rx_local->local_fbr0_full = ET_DMA10_WRAP;
+ writel(
+ ((rx_local->fbr0_num_entries * LO_MARK_PERCENT_FOR_RX) / 100) - 1,
+ &rx_dma->fbr0_min_des);
#endif
/* Program the number of packets we will receive before generating an
@@ -745,15 +752,15 @@ static void nic_return_rfd(struct et131x_adapter *etdev, struct rfd *rfd)
*/
if (
#ifdef USE_FBR0
- (ring_index == 0 && buff_index < rx_local->Fbr0NumEntries) ||
+ (ring_index == 0 && buff_index < rx_local->fbr0_num_entries) ||
#endif
- (ring_index == 1 && buff_index < rx_local->Fbr1NumEntries)) {
+ (ring_index == 1 && buff_index < rx_local->fbr1_num_entries)) {
spin_lock_irqsave(&etdev->FbrLock, flags);
if (ring_index == 1) {
struct fbr_desc *next =
- (struct fbr_desc *) (rx_local->pFbr1RingVa) +
- INDEX10(rx_local->local_Fbr1_full);
+ (struct fbr_desc *) (rx_local->fbr1_ring_virtaddr) +
+ INDEX10(rx_local->local_fbr1_full);
/* Handle the Free Buffer Ring advancement here. Write
* the PA / Buffer Index for the returned buffer into
@@ -763,15 +770,15 @@ static void nic_return_rfd(struct et131x_adapter *etdev, struct rfd *rfd)
next->addr_lo = rx_local->fbr[1]->bus_low[buff_index];
next->word2 = buff_index;
- writel(bump_free_buff_ring(&rx_local->local_Fbr1_full,
- rx_local->Fbr1NumEntries - 1),
+ writel(bump_free_buff_ring(&rx_local->local_fbr1_full,
+ rx_local->fbr1_num_entries - 1),
&rx_dma->fbr1_full_offset);
}
#ifdef USE_FBR0
else {
struct fbr_desc *next = (struct fbr_desc *)
- rx_local->pFbr0RingVa +
- INDEX10(rx_local->local_Fbr0_full);
+ rx_local->fbr0_ring_virtaddr +
+ INDEX10(rx_local->local_fbr0_full);
/* Handle the Free Buffer Ring advancement here. Write
* the PA / Buffer Index for the returned buffer into
@@ -781,8 +788,8 @@ static void nic_return_rfd(struct et131x_adapter *etdev, struct rfd *rfd)
next->addr_lo = rx_local->fbr[0]->bus_low[buff_index];
next->word2 = buff_index;
- writel(bump_free_buff_ring(&rx_local->local_Fbr0_full,
- rx_local->Fbr0NumEntries - 1),
+ writel(bump_free_buff_ring(&rx_local->local_fbr0_full,
+ rx_local->fbr0_num_entries - 1),
&rx_dma->fbr0_full_offset);
}
#endif
@@ -796,11 +803,11 @@ static void nic_return_rfd(struct et131x_adapter *etdev, struct rfd *rfd)
* our list
*/
spin_lock_irqsave(&etdev->rcv_lock, flags);
- list_add_tail(&rfd->list_node, &rx_local->RecvList);
- rx_local->nReadyRecv++;
+ list_add_tail(&rfd->list_node, &rx_local->recv_list);
+ rx_local->num_ready_recv++;
spin_unlock_irqrestore(&etdev->rcv_lock, flags);
- WARN_ON(rx_local->nReadyRecv > rx_local->NumRfd);
+ WARN_ON(rx_local->num_ready_recv > rx_local->num_rfd);
}
/**
@@ -832,19 +839,19 @@ void et131x_rx_dma_enable(struct et131x_adapter *etdev)
/* Setup the receive dma configuration register for normal operation */
u32 csr = 0x2000; /* FBR1 enable */
- if (etdev->rx_ring.Fbr1BufferSize == 4096)
+ if (etdev->rx_ring.fbr1_buffsize == 4096)
csr |= 0x0800;
- else if (etdev->rx_ring.Fbr1BufferSize == 8192)
+ else if (etdev->rx_ring.fbr1_buffsize == 8192)
csr |= 0x1000;
- else if (etdev->rx_ring.Fbr1BufferSize == 16384)
+ else if (etdev->rx_ring.fbr1_buffsize == 16384)
csr |= 0x1800;
#ifdef USE_FBR0
csr |= 0x0400; /* FBR0 enable */
- if (etdev->rx_ring.Fbr0BufferSize == 256)
+ if (etdev->rx_ring.fbr0_buffsize == 256)
csr |= 0x0100;
- else if (etdev->rx_ring.Fbr0BufferSize == 512)
+ else if (etdev->rx_ring.fbr0_buffsize == 512)
csr |= 0x0200;
- else if (etdev->rx_ring.Fbr0BufferSize == 1024)
+ else if (etdev->rx_ring.fbr0_buffsize == 1024)
csr |= 0x0300;
#endif
writel(csr, &etdev->regs->rxdma.csr);
@@ -868,7 +875,7 @@ void et131x_rx_dma_enable(struct et131x_adapter *etdev)
* Returns rfd, a pointer to our MPRFD.
*
* Checks the hardware for available packets, using completion ring
- * If packets are available, it gets an RFD from the RecvList, attaches
+ * If packets are available, it gets an RFD from the recv_list, attaches
* the packet to it, puts the RFD in the RecvPendList, and also returns
* the pointer to the RFD.
*/
@@ -893,7 +900,7 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
* Status Ring, and also the two Free Buffer rings.
*/
status = rx_local->rx_status_block;
- word1 = status->Word1 >> 16; /* Get the useful bits */
+ word1 = status->word1 >> 16; /* Get the useful bits */
/* Check the PSR and wrap bits do not match */
if ((word1 & 0x1FFF) == (rx_local->local_psr_full & 0x1FFF))
@@ -901,7 +908,7 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
return NULL;
/* The packet status ring indicates that data is available. */
- psr = (struct pkt_stat_desc *) (rx_local->pPSRingVa) +
+ psr = (struct pkt_stat_desc *) (rx_local->ps_ring_virtaddr) +
(rx_local->local_psr_full & 0xFFF);
/* Grab any information that is required once the PSR is
@@ -916,7 +923,8 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
/* Indicate that we have used this PSR entry. */
/* FIXME wrap 12 */
add_12bit(&rx_local->local_psr_full, 1);
- if ((rx_local->local_psr_full & 0xFFF) > rx_local->PsrNumEntries - 1) {
+ if (
+ (rx_local->local_psr_full & 0xFFF) > rx_local->psr_num_entries - 1) {
/* Clear psr full and toggle the wrap bit */
rx_local->local_psr_full &= ~0xFFF;
rx_local->local_psr_full ^= 0x1000;
@@ -933,11 +941,11 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
#ifdef USE_FBR0
if (ring_index > 1 ||
(ring_index == 0 &&
- buff_index > rx_local->Fbr0NumEntries - 1) ||
+ buff_index > rx_local->fbr0_num_entries - 1) ||
(ring_index == 1 &&
- buff_index > rx_local->Fbr1NumEntries - 1))
+ buff_index > rx_local->fbr1_num_entries - 1))
#else
- if (ring_index != 1 || buff_index > rx_local->Fbr1NumEntries - 1)
+ if (ring_index != 1 || buff_index > rx_local->fbr1_num_entries - 1)
#endif
{
/* Illegal buffer or ring index cannot be used by S/W*/
@@ -953,7 +961,7 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
spin_lock_irqsave(&etdev->rcv_lock, flags);
rfd = NULL;
- element = rx_local->RecvList.next;
+ element = rx_local->recv_list.next;
rfd = (struct rfd *) list_entry(element, struct rfd, list_node);
if (rfd == NULL) {
@@ -962,7 +970,7 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
}
list_del(&rfd->list_node);
- rx_local->nReadyRecv--;
+ rx_local->num_ready_recv--;
spin_unlock_irqrestore(&etdev->rcv_lock, flags);
@@ -1087,7 +1095,7 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
*/
void et131x_reset_recv(struct et131x_adapter *etdev)
{
- WARN_ON(list_empty(&etdev->rx_ring.RecvList));
+ WARN_ON(list_empty(&etdev->rx_ring.recv_list));
}
/**
@@ -1104,8 +1112,8 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev)
/* Process up to available RFD's */
while (count < NUM_PACKETS_HANDLED) {
- if (list_empty(&etdev->rx_ring.RecvList)) {
- WARN_ON(etdev->rx_ring.nReadyRecv != 0);
+ if (list_empty(&etdev->rx_ring.recv_list)) {
+ WARN_ON(etdev->rx_ring.num_ready_recv != 0);
done = false;
break;
}
@@ -1129,7 +1137,7 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev)
etdev->net_stats.rx_packets++;
/* Set the status on the packet, either resources or success */
- if (etdev->rx_ring.nReadyRecv < RFD_LOW_WATER_MARK) {
+ if (etdev->rx_ring.num_ready_recv < RFD_LOW_WATER_MARK) {
dev_warn(&etdev->pdev->dev,
"RFD's are running out\n");
}
@@ -1137,11 +1145,11 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev)
}
if (count == NUM_PACKETS_HANDLED || !done) {
- etdev->rx_ring.UnfinishedReceives = true;
+ etdev->rx_ring.unfinished_receives = true;
writel(PARM_TX_TIME_INT_DEF * NANO_IN_A_MICRO,
&etdev->regs->global.watchdog_timer);
} else
/* Watchdog timer will disable itself if appropriate. */
- etdev->rx_ring.UnfinishedReceives = false;
+ etdev->rx_ring.unfinished_receives = false;
}
diff --git a/drivers/staging/et131x/et1310_rx.h b/drivers/staging/et131x/et1310_rx.h
index e8c653d..1448aa9 100644
--- a/drivers/staging/et131x/et1310_rx.h
+++ b/drivers/staging/et131x/et1310_rx.h
@@ -174,8 +174,8 @@ struct pkt_stat_desc {
* DMA engine it sits in free memory, and is pointed to by 0x101c / 0x1020
*/
struct rx_status_block {
- u32 Word0;
- u32 Word1;
+ u32 word0;
+ u32 word1;
};
/*
@@ -190,54 +190,54 @@ struct fbr_lookup {
};
/*
- * struct rx_ring is the ssructure representing the adaptor's local
+ * struct rx_ring is the sructure representing the adaptor's local
* reference(s) to the rings
*/
struct rx_ring {
#ifdef USE_FBR0
- void *pFbr0RingVa;
- dma_addr_t pFbr0RingPa;
- void *Fbr0MemVa[MAX_DESC_PER_RING_RX / FBR_CHUNKS];
- dma_addr_t Fbr0MemPa[MAX_DESC_PER_RING_RX / FBR_CHUNKS];
- uint64_t Fbr0Realpa;
- uint64_t Fbr0offset;
- u32 local_Fbr0_full;
- u32 Fbr0NumEntries;
- u32 Fbr0BufferSize;
+ void *fbr0_ring_virtaddr;
+ dma_addr_t fbr0_ring_physaddr;
+ void *fbr0_mem_virtaddrs[MAX_DESC_PER_RING_RX / FBR_CHUNKS];
+ dma_addr_t fbr0_mem_physaddrs[MAX_DESC_PER_RING_RX / FBR_CHUNKS];
+ uint64_t fbr0_real_physaddr;
+ uint64_t fbr0_offset;
+ u32 local_fbr0_full;
+ u32 fbr0_num_entries;
+ u32 fbr0_buffsize;
#endif
- void *pFbr1RingVa;
- dma_addr_t pFbr1RingPa;
- void *Fbr1MemVa[MAX_DESC_PER_RING_RX / FBR_CHUNKS];
- dma_addr_t Fbr1MemPa[MAX_DESC_PER_RING_RX / FBR_CHUNKS];
- uint64_t Fbr1Realpa;
- uint64_t Fbr1offset;
+ void *fbr1_ring_virtaddr;
+ dma_addr_t fbr1_ring_physaddr;
+ void *fbr1_mem_virtaddrs[MAX_DESC_PER_RING_RX / FBR_CHUNKS];
+ dma_addr_t fbr1_mem_physaddrs[MAX_DESC_PER_RING_RX / FBR_CHUNKS];
+ uint64_t fbr1_real_physaddr;
+ uint64_t fbr1_offset;
struct fbr_lookup *fbr[2]; /* One per ring */
- u32 local_Fbr1_full;
- u32 Fbr1NumEntries;
- u32 Fbr1BufferSize;
+ u32 local_fbr1_full;
+ u32 fbr1_num_entries;
+ u32 fbr1_buffsize;
- void *pPSRingVa;
- dma_addr_t pPSRingPa;
+ void *ps_ring_virtaddr;
+ dma_addr_t ps_ring_physaddr;
u32 local_psr_full;
- u32 PsrNumEntries;
+ u32 psr_num_entries;
struct rx_status_block *rx_status_block;
dma_addr_t rx_status_bus;
- struct list_head RecvBufferPool;
+ struct list_head recv_buff_pool;
/* RECV */
- struct list_head RecvList;
- u32 nReadyRecv;
+ struct list_head recv_list;
+ u32 num_ready_recv;
- u32 NumRfd;
+ u32 num_rfd;
- bool UnfinishedReceives;
+ bool unfinished_receives;
- struct list_head RecvPacketPool;
+ struct list_head recv_packet_pool;
/* lookaside lists */
- struct kmem_cache *RecvLookaside;
+ struct kmem_cache *recv_lookaside;
};
#endif /* __ET1310_RX_H__ */
diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c
index dd952f0..33d432f 100644
--- a/drivers/staging/et131x/et131x_isr.c
+++ b/drivers/staging/et131x/et131x_isr.c
@@ -200,7 +200,7 @@ irqreturn_t et131x_isr(int irq, void *dev_id)
if (++tcb->stale > 1)
status |= ET_INTR_TXDMA_ISR;
- if (adapter->rx_ring.UnfinishedReceives)
+ if (adapter->rx_ring.unfinished_receives)
status |= ET_INTR_RXDMA_XFR_DONE;
else if (tcb == NULL)
writel(0, &adapter->regs->global.watchdog_timer);
--
1.7.4.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 08/10] staging: et131x: add et1310_ prefix to et1310_mac.c functions
2011-07-10 15:35 [PATCH 0/10] staging: et131x: Kernel coding style cleanups Mark Einon
` (6 preceding siblings ...)
2011-07-10 15:35 ` [PATCH 07/10] staging: et131x: Converting et1310_rx.h variable names from CamelCase Mark Einon
@ 2011-07-10 15:35 ` Mark Einon
2011-07-10 15:35 ` [PATCH 09/10] staging: et131x: Converting et1310_tx.c function and local names from CamelCase Mark Einon
2011-07-10 15:35 ` [PATCH 10/10] staging: et131x: Converting et1310_adapter.h variable " Mark Einon
9 siblings, 0 replies; 12+ messages in thread
From: Mark Einon @ 2011-07-10 15:35 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, o.hartmann, Mark Einon
Making finger pointing that bit easier.
Tested on an ET-131x device.
Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
drivers/staging/et131x/et1310_mac.c | 32 +++++++++++++++---------------
drivers/staging/et131x/et1310_phy.c | 4 +-
drivers/staging/et131x/et131x.h | 20 +++++++++---------
drivers/staging/et131x/et131x_initpci.c | 10 ++++----
drivers/staging/et131x/et131x_isr.c | 2 +-
drivers/staging/et131x/et131x_netdev.c | 4 +-
6 files changed, 36 insertions(+), 36 deletions(-)
diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c
index 21b6153..8d8bc8b 100644
--- a/drivers/staging/et131x/et1310_mac.c
+++ b/drivers/staging/et131x/et1310_mac.c
@@ -99,10 +99,10 @@
#define COUNTER_MASK_12_BIT (COUNTER_WRAP_12_BIT - 1)
/**
- * config_mac_regs1 - Initialize the first part of MAC regs
+ * et1310_config_mac_regs1 - Initialize the first part of MAC regs
* @etdev: pointer to our adapter structure
*/
-void config_mac_regs1(struct et131x_adapter *etdev)
+void et1310_config_mac_regs1(struct et131x_adapter *etdev)
{
struct mac_regs __iomem *macregs = &etdev->regs->mac;
u32 station1;
@@ -159,10 +159,10 @@ void config_mac_regs1(struct et131x_adapter *etdev)
}
/**
- * config_mac_regs2 - Initialize the second part of MAC regs
+ * et1310_config_mac_regs2 - Initialize the second part of MAC regs
* @etdev: pointer to our adapter structure
*/
-void config_mac_regs2(struct et131x_adapter *etdev)
+void et1310_config_mac_regs2(struct et131x_adapter *etdev)
{
int32_t delay = 0;
struct mac_regs __iomem *mac = &etdev->regs->mac;
@@ -235,7 +235,7 @@ void config_mac_regs2(struct et131x_adapter *etdev)
}
}
-void config_rxmac_regs(struct et131x_adapter *etdev)
+void et1310_config_rxmac_regs(struct et131x_adapter *etdev)
{
struct rxmac_regs __iomem *rxmac = &etdev->regs->rxmac;
u32 sa_lo;
@@ -295,7 +295,7 @@ void config_rxmac_regs(struct et131x_adapter *etdev)
/* Let's initialize the Unicast Packet filtering address */
if (etdev->PacketFilter & ET131X_PACKET_TYPE_DIRECTED) {
- setup_device_for_unicast(etdev);
+ et1310_setup_device_for_unicast(etdev);
pf_ctrl |= 4; /* Unicast filter */
} else {
writel(0, &rxmac->uni_pf_addr1);
@@ -306,7 +306,7 @@ void config_rxmac_regs(struct et131x_adapter *etdev)
/* Let's initialize the Multicast hash */
if (!(etdev->PacketFilter & ET131X_PACKET_TYPE_ALL_MULTICAST)) {
pf_ctrl |= 2; /* Multicast filter */
- setup_device_for_multicast(etdev);
+ et1310_setup_device_for_multicast(etdev);
}
/* Runt packet filtering. Didn't work in version A silicon. */
@@ -365,7 +365,7 @@ void config_rxmac_regs(struct et131x_adapter *etdev)
writel(0x9, &rxmac->ctrl);
}
-void config_txmac_regs(struct et131x_adapter *etdev)
+void et1310_config_txmac_regs(struct et131x_adapter *etdev)
{
struct txmac_regs *txmac = &etdev->regs->txmac;
@@ -379,7 +379,7 @@ void config_txmac_regs(struct et131x_adapter *etdev)
writel(0x40, &txmac->cf_param);
}
-void config_macstat_regs(struct et131x_adapter *etdev)
+void et1310_config_macstat_regs(struct et131x_adapter *etdev)
{
struct macstat_regs __iomem *macstat =
&etdev->regs->macstat;
@@ -444,7 +444,7 @@ void config_macstat_regs(struct et131x_adapter *etdev)
writel(0xFFFE7E8B, &macstat->carry_reg2_mask);
}
-void config_flow_control(struct et131x_adapter *etdev)
+void et1310_config_flow_control(struct et131x_adapter *etdev)
{
if (etdev->duplex_mode == 0) {
etdev->flowcontrol = FLOW_NONE;
@@ -480,10 +480,10 @@ void config_flow_control(struct et131x_adapter *etdev)
}
/**
- * update_macstat_host_counters - Update the local copy of the statistics
+ * et1310_update_macstat_host_counters - Update the local copy of the statistics
* @etdev: pointer to the adapter structure
*/
-void update_macstat_host_counters(struct et131x_adapter *etdev)
+void et1310_update_macstat_host_counters(struct et131x_adapter *etdev)
{
struct ce_stats *stats = &etdev->stats;
struct macstat_regs __iomem *macstat =
@@ -508,14 +508,14 @@ void update_macstat_host_counters(struct et131x_adapter *etdev)
}
/**
- * handle_macstat_interrupt
+ * et1310_handle_macstat_interrupt
* @etdev: pointer to the adapter structure
*
* One of the MACSTAT counters has wrapped. Update the local copy of
* the statistics held in the adapter structure, checking the "wrap"
* bit for each counter.
*/
-void handle_macstat_interrupt(struct et131x_adapter *etdev)
+void et1310_handle_macstat_interrupt(struct et131x_adapter *etdev)
{
u32 carry_reg1;
u32 carry_reg2;
@@ -565,7 +565,7 @@ void handle_macstat_interrupt(struct et131x_adapter *etdev)
etdev->stats.collisions += COUNTER_WRAP_12_BIT;
}
-void setup_device_for_multicast(struct et131x_adapter *etdev)
+void et1310_setup_device_for_multicast(struct et131x_adapter *etdev)
{
struct rxmac_regs __iomem *rxmac = &etdev->regs->rxmac;
uint32_t nIndex;
@@ -613,7 +613,7 @@ void setup_device_for_multicast(struct et131x_adapter *etdev)
}
}
-void setup_device_for_unicast(struct et131x_adapter *etdev)
+void et1310_setup_device_for_unicast(struct et131x_adapter *etdev)
{
struct rxmac_regs __iomem *rxmac = &etdev->regs->rxmac;
u32 uni_pf1;
diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c
index f6c35b6..3653426 100644
--- a/drivers/staging/et131x/et1310_phy.c
+++ b/drivers/staging/et131x/et1310_phy.c
@@ -846,7 +846,7 @@ void et131x_mii_check(struct et131x_adapter *etdev,
et131x_mii_write(etdev, 0x12, register18);
}
- config_flow_control(etdev);
+ et1310_config_flow_control(etdev);
if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS &&
etdev->RegistryJumboPacket > 2048)
@@ -854,7 +854,7 @@ void et131x_mii_check(struct et131x_adapter *etdev,
0x2000);
et131x_set_rx_dma_timer(etdev);
- config_mac_regs2(etdev);
+ et1310_config_mac_regs2(etdev);
}
}
}
diff --git a/drivers/staging/et131x/et131x.h b/drivers/staging/et131x/et131x.h
index c33594b..b201136 100644
--- a/drivers/staging/et131x/et131x.h
+++ b/drivers/staging/et131x/et131x.h
@@ -71,16 +71,16 @@ irqreturn_t et131x_isr(int irq, void *dev_id);
void et131x_isr_handler(struct work_struct *work);
/* et1310_mac.c */
-void config_mac_regs1(struct et131x_adapter *adapter);
-void config_mac_regs2(struct et131x_adapter *adapter);
-void config_rxmac_regs(struct et131x_adapter *adapter);
-void config_txmac_regs(struct et131x_adapter *adapter);
-void config_macstat_regs(struct et131x_adapter *adapter);
-void config_flow_control(struct et131x_adapter *adapter);
-void update_macstat_host_counters(struct et131x_adapter *adapter);
-void handle_macstat_interrupt(struct et131x_adapter *adapter);
-void setup_device_for_multicast(struct et131x_adapter *adapter);
-void setup_device_for_unicast(struct et131x_adapter *adapter);
+void et1310_config_mac_regs1(struct et131x_adapter *adapter);
+void et1310_config_mac_regs2(struct et131x_adapter *adapter);
+void et1310_config_rxmac_regs(struct et131x_adapter *adapter);
+void et1310_config_txmac_regs(struct et131x_adapter *adapter);
+void et1310_config_macstat_regs(struct et131x_adapter *adapter);
+void et1310_config_flow_control(struct et131x_adapter *adapter);
+void et1310_update_macstat_host_counters(struct et131x_adapter *adapter);
+void et1310_handle_macstat_interrupt(struct et131x_adapter *adapter);
+void et1310_setup_device_for_multicast(struct et131x_adapter *adapter);
+void et1310_setup_device_for_unicast(struct et131x_adapter *adapter);
/* et131x_netdev.c */
struct net_device *et131x_device_alloc(void);
diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c
index 75b2c48..a8700b6 100644
--- a/drivers/staging/et131x/et131x_initpci.c
+++ b/drivers/staging/et131x/et131x_initpci.c
@@ -269,7 +269,7 @@ void et131x_error_timer_handler(unsigned long data)
pm_csr = readl(&etdev->regs->global.pm_csr);
if ((pm_csr & ET_PM_PHY_SW_COMA) == 0)
- update_macstat_host_counters(etdev);
+ et1310_update_macstat_host_counters(etdev);
else
dev_err(&etdev->pdev->dev,
"No interrupts, in PHY coma, pm_csr = 0x%x\n", pm_csr);
@@ -380,19 +380,19 @@ int et131x_adapter_setup(struct et131x_adapter *etdev)
/* Configure the JAGCore */
ConfigGlobalRegs(etdev);
- config_mac_regs1(etdev);
+ et1310_config_mac_regs1(etdev);
/* Configure the MMC registers */
/* All we need to do is initialize the Memory Control Register */
writel(ET_MMC_ENABLE, &etdev->regs->mmc.mmc_ctrl);
- config_rxmac_regs(etdev);
- config_txmac_regs(etdev);
+ et1310_config_rxmac_regs(etdev);
+ et1310_config_txmac_regs(etdev);
et131x_config_rx_dma_regs(etdev);
ConfigTxDmaRegs(etdev);
- config_macstat_regs(etdev);
+ et1310_config_macstat_regs(etdev);
/* Move the following code to Timer function?? */
status = et131x_xcvr_find(etdev);
diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c
index 33d432f..9b316be 100644
--- a/drivers/staging/et131x/et131x_isr.c
+++ b/drivers/staging/et131x/et131x_isr.c
@@ -461,7 +461,7 @@ void et131x_isr_handler(struct work_struct *work)
* to maintain the top, software managed bits of the
* counter(s).
*/
- handle_macstat_interrupt(etdev);
+ et1310_handle_macstat_interrupt(etdev);
}
/* Handle SLV Timeout Interrupt */
diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c
index 0f12b58..546acb3 100644
--- a/drivers/staging/et131x/et131x_netdev.c
+++ b/drivers/staging/et131x/et131x_netdev.c
@@ -301,14 +301,14 @@ int et131x_set_packet_filter(struct et131x_adapter *adapter)
if (filter & ET131X_PACKET_TYPE_ALL_MULTICAST)
pf_ctrl &= ~2; /* Multicast filter bit */
else {
- setup_device_for_multicast(adapter);
+ et1310_setup_device_for_multicast(adapter);
pf_ctrl |= 2;
ctrl &= ~0x04;
}
/* Set us up with Unicast packet filtering */
if (filter & ET131X_PACKET_TYPE_DIRECTED) {
- setup_device_for_unicast(adapter);
+ et1310_setup_device_for_unicast(adapter);
pf_ctrl |= 4;
ctrl &= ~0x04;
}
--
1.7.4.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 09/10] staging: et131x: Converting et1310_tx.c function and local names from CamelCase
2011-07-10 15:35 [PATCH 0/10] staging: et131x: Kernel coding style cleanups Mark Einon
` (7 preceding siblings ...)
2011-07-10 15:35 ` [PATCH 08/10] staging: et131x: add et1310_ prefix to et1310_mac.c functions Mark Einon
@ 2011-07-10 15:35 ` Mark Einon
2011-07-10 15:35 ` [PATCH 10/10] staging: et131x: Converting et1310_adapter.h variable " Mark Einon
9 siblings, 0 replies; 12+ messages in thread
From: Mark Einon @ 2011-07-10 15:35 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, o.hartmann, Mark Einon
Also some minor code clean-ups.
Tested on an ET-131x device.
Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
drivers/staging/et131x/et1310_tx.c | 268 +++++++++++++++----------------
drivers/staging/et131x/et131x.h | 2 +-
drivers/staging/et131x/et131x_initpci.c | 2 +-
3 files changed, 132 insertions(+), 140 deletions(-)
diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c
index 8fb3051..da9b4af 100644
--- a/drivers/staging/et131x/et1310_tx.c
+++ b/drivers/staging/et131x/et1310_tx.c
@@ -88,12 +88,6 @@
#include "et1310_tx.h"
#include "et131x.h"
-static inline void et131x_free_send_packet(struct et131x_adapter *etdev,
- struct tcb *tcb);
-static int et131x_send_packet(struct sk_buff *skb,
- struct et131x_adapter *etdev);
-static int nic_send_packet(struct et131x_adapter *etdev, struct tcb *tcb);
-
/**
* et131x_tx_dma_memory_alloc
* @adapter: pointer to our private adapter structure
@@ -186,13 +180,13 @@ void et131x_tx_dma_memory_free(struct et131x_adapter *adapter)
}
/**
- * ConfigTxDmaRegs - Set up the tx dma section of the JAGCore.
+ * et131x_config_tx_dma_regs - Set up the tx dma section of the JAGCore.
* @etdev: pointer to our private adapter structure
*
* Configure the transmit engine with the ring buffers we have created
* and prepare it for use.
*/
-void ConfigTxDmaRegs(struct et131x_adapter *etdev)
+void et131x_config_tx_dma_regs(struct et131x_adapter *etdev)
{
struct txdma_regs __iomem *txdma = &etdev->regs->txdma;
@@ -277,131 +271,6 @@ void et131x_init_send(struct et131x_adapter *adapter)
}
/**
- * et131x_send_packets - This function is called by the OS to send packets
- * @skb: the packet(s) to send
- * @netdev:device on which to TX the above packet(s)
- *
- * Return 0 in almost all cases; non-zero value in extreme hard failure only
- */
-int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev)
-{
- int status = 0;
- struct et131x_adapter *etdev = NULL;
-
- etdev = netdev_priv(netdev);
-
- /* Send these packets
- *
- * NOTE: The Linux Tx entry point is only given one packet at a time
- * to Tx, so the PacketCount and it's array used makes no sense here
- */
-
- /* TCB is not available */
- if (etdev->tx_ring.used >= NUM_TCB) {
- /* NOTE: If there's an error on send, no need to queue the
- * packet under Linux; if we just send an error up to the
- * netif layer, it will resend the skb to us.
- */
- status = -ENOMEM;
- } else {
- /* We need to see if the link is up; if it's not, make the
- * netif layer think we're good and drop the packet
- */
- if ((etdev->flags & fMP_ADAPTER_FAIL_SEND_MASK) ||
- !netif_carrier_ok(netdev)) {
- dev_kfree_skb_any(skb);
- skb = NULL;
-
- etdev->net_stats.tx_dropped++;
- } else {
- status = et131x_send_packet(skb, etdev);
- if (status != 0 && status != -ENOMEM) {
- /* On any other error, make netif think we're
- * OK and drop the packet
- */
- dev_kfree_skb_any(skb);
- skb = NULL;
- etdev->net_stats.tx_dropped++;
- }
- }
- }
- return status;
-}
-
-/**
- * et131x_send_packet - Do the work to send a packet
- * @skb: the packet(s) to send
- * @etdev: a pointer to the device's private adapter structure
- *
- * Return 0 in almost all cases; non-zero value in extreme hard failure only.
- *
- * Assumption: Send spinlock has been acquired
- */
-static int et131x_send_packet(struct sk_buff *skb,
- struct et131x_adapter *etdev)
-{
- int status;
- struct tcb *tcb = NULL;
- u16 *shbufva;
- unsigned long flags;
-
- /* All packets must have at least a MAC address and a protocol type */
- if (skb->len < ETH_HLEN)
- return -EIO;
-
- /* Get a TCB for this packet */
- spin_lock_irqsave(&etdev->TCBReadyQLock, flags);
-
- tcb = etdev->tx_ring.tcb_qhead;
-
- if (tcb == NULL) {
- spin_unlock_irqrestore(&etdev->TCBReadyQLock, flags);
- return -ENOMEM;
- }
-
- etdev->tx_ring.tcb_qhead = tcb->next;
-
- if (etdev->tx_ring.tcb_qhead == NULL)
- etdev->tx_ring.tcb_qtail = NULL;
-
- spin_unlock_irqrestore(&etdev->TCBReadyQLock, flags);
-
- tcb->skb = skb;
-
- if (skb->data != NULL && skb->len - skb->data_len >= 6) {
- shbufva = (u16 *) skb->data;
-
- if ((shbufva[0] == 0xffff) &&
- (shbufva[1] == 0xffff) && (shbufva[2] == 0xffff)) {
- tcb->flags |= fMP_DEST_BROAD;
- } else if ((shbufva[0] & 0x3) == 0x0001) {
- tcb->flags |= fMP_DEST_MULTI;
- }
- }
-
- tcb->next = NULL;
-
- /* Call the NIC specific send handler. */
- status = nic_send_packet(etdev, tcb);
-
- if (status != 0) {
- spin_lock_irqsave(&etdev->TCBReadyQLock, flags);
-
- if (etdev->tx_ring.tcb_qtail)
- etdev->tx_ring.tcb_qtail->next = tcb;
- else
- /* Apparently ready Q is empty. */
- etdev->tx_ring.tcb_qhead = tcb;
-
- etdev->tx_ring.tcb_qtail = tcb;
- spin_unlock_irqrestore(&etdev->TCBReadyQLock, flags);
- return status;
- }
- WARN_ON(etdev->tx_ring.used > NUM_TCB);
- return 0;
-}
-
-/**
* nic_send_packet - NIC specific send handler for version B silicon.
* @etdev: pointer to our adapter
* @tcb: pointer to struct tcb
@@ -618,16 +487,139 @@ static int nic_send_packet(struct et131x_adapter *etdev, struct tcb *tcb)
return 0;
}
+/**
+ * send_packet - Do the work to send a packet
+ * @skb: the packet(s) to send
+ * @etdev: a pointer to the device's private adapter structure
+ *
+ * Return 0 in almost all cases; non-zero value in extreme hard failure only.
+ *
+ * Assumption: Send spinlock has been acquired
+ */
+static int send_packet(struct sk_buff *skb, struct et131x_adapter *etdev)
+{
+ int status;
+ struct tcb *tcb = NULL;
+ u16 *shbufva;
+ unsigned long flags;
+
+ /* All packets must have at least a MAC address and a protocol type */
+ if (skb->len < ETH_HLEN)
+ return -EIO;
+
+ /* Get a TCB for this packet */
+ spin_lock_irqsave(&etdev->TCBReadyQLock, flags);
+
+ tcb = etdev->tx_ring.tcb_qhead;
+
+ if (tcb == NULL) {
+ spin_unlock_irqrestore(&etdev->TCBReadyQLock, flags);
+ return -ENOMEM;
+ }
+
+ etdev->tx_ring.tcb_qhead = tcb->next;
+
+ if (etdev->tx_ring.tcb_qhead == NULL)
+ etdev->tx_ring.tcb_qtail = NULL;
+
+ spin_unlock_irqrestore(&etdev->TCBReadyQLock, flags);
+
+ tcb->skb = skb;
+
+ if (skb->data != NULL && skb->len - skb->data_len >= 6) {
+ shbufva = (u16 *) skb->data;
+
+ if ((shbufva[0] == 0xffff) &&
+ (shbufva[1] == 0xffff) && (shbufva[2] == 0xffff)) {
+ tcb->flags |= fMP_DEST_BROAD;
+ } else if ((shbufva[0] & 0x3) == 0x0001) {
+ tcb->flags |= fMP_DEST_MULTI;
+ }
+ }
+
+ tcb->next = NULL;
+
+ /* Call the NIC specific send handler. */
+ status = nic_send_packet(etdev, tcb);
+
+ if (status != 0) {
+ spin_lock_irqsave(&etdev->TCBReadyQLock, flags);
+
+ if (etdev->tx_ring.tcb_qtail)
+ etdev->tx_ring.tcb_qtail->next = tcb;
+ else
+ /* Apparently ready Q is empty. */
+ etdev->tx_ring.tcb_qhead = tcb;
+
+ etdev->tx_ring.tcb_qtail = tcb;
+ spin_unlock_irqrestore(&etdev->TCBReadyQLock, flags);
+ return status;
+ }
+ WARN_ON(etdev->tx_ring.used > NUM_TCB);
+ return 0;
+}
+
+/**
+ * et131x_send_packets - This function is called by the OS to send packets
+ * @skb: the packet(s) to send
+ * @netdev:device on which to TX the above packet(s)
+ *
+ * Return 0 in almost all cases; non-zero value in extreme hard failure only
+ */
+int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev)
+{
+ int status = 0;
+ struct et131x_adapter *etdev = NULL;
+
+ etdev = netdev_priv(netdev);
+
+ /* Send these packets
+ *
+ * NOTE: The Linux Tx entry point is only given one packet at a time
+ * to Tx, so the PacketCount and it's array used makes no sense here
+ */
+
+ /* TCB is not available */
+ if (etdev->tx_ring.used >= NUM_TCB) {
+ /* NOTE: If there's an error on send, no need to queue the
+ * packet under Linux; if we just send an error up to the
+ * netif layer, it will resend the skb to us.
+ */
+ status = -ENOMEM;
+ } else {
+ /* We need to see if the link is up; if it's not, make the
+ * netif layer think we're good and drop the packet
+ */
+ if ((etdev->flags & fMP_ADAPTER_FAIL_SEND_MASK) ||
+ !netif_carrier_ok(netdev)) {
+ dev_kfree_skb_any(skb);
+ skb = NULL;
+
+ etdev->net_stats.tx_dropped++;
+ } else {
+ status = send_packet(skb, etdev);
+ if (status != 0 && status != -ENOMEM) {
+ /* On any other error, make netif think we're
+ * OK and drop the packet
+ */
+ dev_kfree_skb_any(skb);
+ skb = NULL;
+ etdev->net_stats.tx_dropped++;
+ }
+ }
+ }
+ return status;
+}
/**
- * et131x_free_send_packet - Recycle a struct tcb
+ * free_send_packet - Recycle a struct tcb
* @etdev: pointer to our adapter
* @tcb: pointer to struct tcb
*
* Complete the packet if necessary
* Assumption - Send spinlock has been acquired
*/
-inline void et131x_free_send_packet(struct et131x_adapter *etdev,
+static inline void free_send_packet(struct et131x_adapter *etdev,
struct tcb *tcb)
{
unsigned long flags;
@@ -717,7 +709,7 @@ void et131x_free_busy_send_packets(struct et131x_adapter *etdev)
spin_unlock_irqrestore(&etdev->TCBSendQLock, flags);
freed++;
- et131x_free_send_packet(etdev, tcb);
+ free_send_packet(etdev, tcb);
spin_lock_irqsave(&etdev->TCBSendQLock, flags);
@@ -766,7 +758,7 @@ void et131x_handle_send_interrupt(struct et131x_adapter *etdev)
etdev->tx_ring.send_tail = NULL;
spin_unlock_irqrestore(&etdev->TCBSendQLock, flags);
- et131x_free_send_packet(etdev, tcb);
+ free_send_packet(etdev, tcb);
spin_lock_irqsave(&etdev->TCBSendQLock, flags);
/* Goto the next packet */
@@ -781,7 +773,7 @@ void et131x_handle_send_interrupt(struct et131x_adapter *etdev)
etdev->tx_ring.send_tail = NULL;
spin_unlock_irqrestore(&etdev->TCBSendQLock, flags);
- et131x_free_send_packet(etdev, tcb);
+ free_send_packet(etdev, tcb);
spin_lock_irqsave(&etdev->TCBSendQLock, flags);
/* Goto the next packet */
diff --git a/drivers/staging/et131x/et131x.h b/drivers/staging/et131x/et131x.h
index b201136..bd5330c 100644
--- a/drivers/staging/et131x/et131x.h
+++ b/drivers/staging/et131x/et131x.h
@@ -138,7 +138,7 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *adapter);
/* et131x_tx.c */
int et131x_tx_dma_memory_alloc(struct et131x_adapter *adapter);
void et131x_tx_dma_memory_free(struct et131x_adapter *adapter);
-void ConfigTxDmaRegs(struct et131x_adapter *adapter);
+void et131x_config_tx_dma_regs(struct et131x_adapter *adapter);
void et131x_init_send(struct et131x_adapter *adapter);
void et131x_tx_dma_disable(struct et131x_adapter *adapter);
void et131x_tx_dma_enable(struct et131x_adapter *adapter);
diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c
index a8700b6..dcf3131 100644
--- a/drivers/staging/et131x/et131x_initpci.c
+++ b/drivers/staging/et131x/et131x_initpci.c
@@ -390,7 +390,7 @@ int et131x_adapter_setup(struct et131x_adapter *etdev)
et1310_config_txmac_regs(etdev);
et131x_config_rx_dma_regs(etdev);
- ConfigTxDmaRegs(etdev);
+ et131x_config_tx_dma_regs(etdev);
et1310_config_macstat_regs(etdev);
--
1.7.4.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 10/10] staging: et131x: Converting et1310_adapter.h variable names from CamelCase
2011-07-10 15:35 [PATCH 0/10] staging: et131x: Kernel coding style cleanups Mark Einon
` (8 preceding siblings ...)
2011-07-10 15:35 ` [PATCH 09/10] staging: et131x: Converting et1310_tx.c function and local names from CamelCase Mark Einon
@ 2011-07-10 15:35 ` Mark Einon
2011-08-23 18:41 ` Greg KH
9 siblings, 1 reply; 12+ messages in thread
From: Mark Einon @ 2011-07-10 15:35 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, o.hartmann, Mark Einon
Tested on an ET-131x device.
Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
drivers/staging/et131x/et1310_mac.c | 77 +++++++++++++-------------
drivers/staging/et131x/et1310_phy.c | 36 ++++++------
drivers/staging/et131x/et1310_pm.c | 8 ++--
drivers/staging/et131x/et1310_rx.c | 54 +++++++++++--------
drivers/staging/et131x/et1310_tx.c | 44 ++++++++--------
drivers/staging/et131x/et131x_adapter.h | 91 +++++++++++++++----------------
drivers/staging/et131x/et131x_initpci.c | 52 +++++++++---------
drivers/staging/et131x/et131x_isr.c | 10 ++--
drivers/staging/et131x/et131x_netdev.c | 71 +++++++++++++------------
9 files changed, 228 insertions(+), 215 deletions(-)
diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c
index 8d8bc8b..254f294 100644
--- a/drivers/staging/et131x/et1310_mac.c
+++ b/drivers/staging/et131x/et1310_mac.c
@@ -149,10 +149,10 @@ void et1310_config_mac_regs1(struct et131x_adapter *etdev)
* being truncated. Allow the MAC to pass 4 more than our max packet
* size. This is 4 for the Ethernet CRC.
*
- * Packets larger than (RegistryJumboPacket) that do not contain a
+ * Packets larger than (registry_jumbo_packet) that do not contain a
* VLAN ID will be dropped by the Rx function.
*/
- writel(etdev->RegistryJumboPacket + 4, ¯egs->max_fm_len);
+ writel(etdev->registry_jumbo_packet + 4, ¯egs->max_fm_len);
/* clear out MAC config reset */
writel(0, ¯egs->cfg1);
@@ -294,7 +294,7 @@ void et1310_config_rxmac_regs(struct et131x_adapter *etdev)
writel(0, &rxmac->pf_ctrl);
/* Let's initialize the Unicast Packet filtering address */
- if (etdev->PacketFilter & ET131X_PACKET_TYPE_DIRECTED) {
+ if (etdev->packet_filter & ET131X_PACKET_TYPE_DIRECTED) {
et1310_setup_device_for_unicast(etdev);
pf_ctrl |= 4; /* Unicast filter */
} else {
@@ -304,7 +304,7 @@ void et1310_config_rxmac_regs(struct et131x_adapter *etdev)
}
/* Let's initialize the Multicast hash */
- if (!(etdev->PacketFilter & ET131X_PACKET_TYPE_ALL_MULTICAST)) {
+ if (!(etdev->packet_filter & ET131X_PACKET_TYPE_ALL_MULTICAST)) {
pf_ctrl |= 2; /* Multicast filter */
et1310_setup_device_for_multicast(etdev);
}
@@ -313,7 +313,7 @@ void et1310_config_rxmac_regs(struct et131x_adapter *etdev)
pf_ctrl |= (NIC_MIN_PACKET_SIZE + 4) << 16;
pf_ctrl |= 8; /* Fragment filter */
- if (etdev->RegistryJumboPacket > 8192)
+ if (etdev->registry_jumbo_packet > 8192)
/* In order to transmit jumbo packets greater than 8k, the
* FIFO between RxMAC and RxDMA needs to be reduced in size
* to (16k - Jumbo packet size). In order to implement this,
@@ -489,22 +489,22 @@ void et1310_update_macstat_host_counters(struct et131x_adapter *etdev)
struct macstat_regs __iomem *macstat =
&etdev->regs->macstat;
- stats->collisions += readl(&macstat->tx_total_collisions);
- stats->first_collision += readl(&macstat->tx_single_collisions);
- stats->tx_deferred += readl(&macstat->tx_deferred);
- stats->excessive_collisions += readl(&macstat->tx_multiple_collisions);
- stats->late_collisions += readl(&macstat->tx_late_collisions);
- stats->tx_uflo += readl(&macstat->tx_undersize_frames);
- stats->max_pkt_error += readl(&macstat->tx_oversize_frames);
-
- stats->alignment_err += readl(&macstat->rx_align_errs);
- stats->crc_err += readl(&macstat->rx_code_errs);
- stats->norcvbuf += readl(&macstat->rx_drops);
- stats->rx_ov_flow += readl(&macstat->rx_oversize_packets);
- stats->code_violations += readl(&macstat->rx_fcs_errs);
- stats->length_err += readl(&macstat->rx_frame_len_errs);
-
- stats->other_errors += readl(&macstat->rx_fragment_packets);
+ stats->tx_collisions += readl(&macstat->tx_total_collisions);
+ stats->tx_first_collisions += readl(&macstat->tx_single_collisions);
+ stats->tx_deferred += readl(&macstat->tx_deferred);
+ stats->tx_excessive_collisions +=
+ readl(&macstat->tx_multiple_collisions);
+ stats->tx_late_collisions += readl(&macstat->tx_late_collisions);
+ stats->tx_underflows += readl(&macstat->tx_undersize_frames);
+ stats->tx_max_pkt_errs += readl(&macstat->tx_oversize_frames);
+
+ stats->rx_align_errs += readl(&macstat->rx_align_errs);
+ stats->rx_crc_errs += readl(&macstat->rx_code_errs);
+ stats->rcvd_pkts_dropped += readl(&macstat->rx_drops);
+ stats->rx_overflows += readl(&macstat->rx_oversize_packets);
+ stats->rx_code_violations += readl(&macstat->rx_fcs_errs);
+ stats->rx_length_errs += readl(&macstat->rx_frame_len_errs);
+ stats->rx_other_errs += readl(&macstat->rx_fragment_packets);
}
/**
@@ -536,33 +536,33 @@ void et1310_handle_macstat_interrupt(struct et131x_adapter *etdev)
* block indicates that one of the counters has wrapped.
*/
if (carry_reg1 & (1 << 14))
- etdev->stats.code_violations += COUNTER_WRAP_16_BIT;
+ etdev->stats.rx_code_violations += COUNTER_WRAP_16_BIT;
if (carry_reg1 & (1 << 8))
- etdev->stats.alignment_err += COUNTER_WRAP_12_BIT;
+ etdev->stats.rx_align_errs += COUNTER_WRAP_12_BIT;
if (carry_reg1 & (1 << 7))
- etdev->stats.length_err += COUNTER_WRAP_16_BIT;
+ etdev->stats.rx_length_errs += COUNTER_WRAP_16_BIT;
if (carry_reg1 & (1 << 2))
- etdev->stats.other_errors += COUNTER_WRAP_16_BIT;
+ etdev->stats.rx_other_errs += COUNTER_WRAP_16_BIT;
if (carry_reg1 & (1 << 6))
- etdev->stats.crc_err += COUNTER_WRAP_16_BIT;
+ etdev->stats.rx_crc_errs += COUNTER_WRAP_16_BIT;
if (carry_reg1 & (1 << 3))
- etdev->stats.rx_ov_flow += COUNTER_WRAP_16_BIT;
+ etdev->stats.rx_overflows += COUNTER_WRAP_16_BIT;
if (carry_reg1 & (1 << 0))
- etdev->stats.norcvbuf += COUNTER_WRAP_16_BIT;
+ etdev->stats.rcvd_pkts_dropped += COUNTER_WRAP_16_BIT;
if (carry_reg2 & (1 << 16))
- etdev->stats.max_pkt_error += COUNTER_WRAP_12_BIT;
+ etdev->stats.tx_max_pkt_errs += COUNTER_WRAP_12_BIT;
if (carry_reg2 & (1 << 15))
- etdev->stats.tx_uflo += COUNTER_WRAP_12_BIT;
+ etdev->stats.tx_underflows += COUNTER_WRAP_12_BIT;
if (carry_reg2 & (1 << 6))
- etdev->stats.first_collision += COUNTER_WRAP_12_BIT;
+ etdev->stats.tx_first_collisions += COUNTER_WRAP_12_BIT;
if (carry_reg2 & (1 << 8))
- etdev->stats.tx_deferred += COUNTER_WRAP_12_BIT;
+ etdev->stats.tx_deferred += COUNTER_WRAP_12_BIT;
if (carry_reg2 & (1 << 5))
- etdev->stats.excessive_collisions += COUNTER_WRAP_12_BIT;
+ etdev->stats.tx_excessive_collisions += COUNTER_WRAP_12_BIT;
if (carry_reg2 & (1 << 4))
- etdev->stats.late_collisions += COUNTER_WRAP_12_BIT;
+ etdev->stats.tx_late_collisions += COUNTER_WRAP_12_BIT;
if (carry_reg2 & (1 << 2))
- etdev->stats.collisions += COUNTER_WRAP_12_BIT;
+ etdev->stats.tx_collisions += COUNTER_WRAP_12_BIT;
}
void et1310_setup_device_for_multicast(struct et131x_adapter *etdev)
@@ -581,10 +581,11 @@ void et1310_setup_device_for_multicast(struct et131x_adapter *etdev)
* specified) then we should pass NO multi-cast addresses to the
* driver.
*/
- if (etdev->PacketFilter & ET131X_PACKET_TYPE_MULTICAST) {
+ if (etdev->packet_filter & ET131X_PACKET_TYPE_MULTICAST) {
/* Loop through our multicast array and set up the device */
- for (nIndex = 0; nIndex < etdev->MCAddressCount; nIndex++) {
- result = ether_crc(6, etdev->MCList[nIndex]);
+ for (nIndex = 0; nIndex < etdev->multicast_addr_count;
+ nIndex++) {
+ result = ether_crc(6, etdev->multicast_list[nIndex]);
result = (result & 0x3F800000) >> 23;
diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c
index 3653426..9d2ce08 100644
--- a/drivers/staging/et131x/et1310_phy.c
+++ b/drivers/staging/et131x/et1310_phy.c
@@ -596,7 +596,7 @@ static void et131x_xcvr_init(struct et131x_adapter *etdev)
}
/* Determine if we need to go into a force mode and set it */
- if (etdev->AiForceSpeed == 0 && etdev->AiForceDpx == 0) {
+ if (etdev->ai_force_speed == 0 && etdev->ai_force_duplex == 0) {
if (etdev->wanted_flow == FLOW_TXONLY ||
etdev->wanted_flow == FLOW_BOTH)
et1310_phy_access_mii_bit(etdev,
@@ -623,7 +623,7 @@ static void et131x_xcvr_init(struct et131x_adapter *etdev)
et1310_phy_auto_neg(etdev, false);
/* Set to the correct force mode. */
- if (etdev->AiForceDpx != 1) {
+ if (etdev->ai_force_duplex != 1) {
if (etdev->wanted_flow == FLOW_TXONLY ||
etdev->wanted_flow == FLOW_BOTH)
et1310_phy_access_mii_bit(etdev,
@@ -645,16 +645,16 @@ static void et131x_xcvr_init(struct et131x_adapter *etdev)
4, 11, NULL);
}
et1310_phy_power_down(etdev, 1);
- switch (etdev->AiForceSpeed) {
+ switch (etdev->ai_force_speed) {
case 10:
/* First we need to turn off all other advertisement */
et1310_phy_advertise_1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
et1310_phy_advertise_100BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
- if (etdev->AiForceDpx == 1) {
+ if (etdev->ai_force_duplex == 1) {
/* Set our advertise values accordingly */
et1310_phy_advertise_10BaseT(etdev,
TRUEPHY_ADV_DUPLEX_HALF);
- } else if (etdev->AiForceDpx == 2) {
+ } else if (etdev->ai_force_duplex == 2) {
/* Set our advertise values accordingly */
et1310_phy_advertise_10BaseT(etdev,
TRUEPHY_ADV_DUPLEX_FULL);
@@ -674,13 +674,13 @@ static void et131x_xcvr_init(struct et131x_adapter *etdev)
/* first we need to turn off all other advertisement */
et1310_phy_advertise_1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
et1310_phy_advertise_10BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
- if (etdev->AiForceDpx == 1) {
+ if (etdev->ai_force_duplex == 1) {
/* Set our advertise values accordingly */
et1310_phy_advertise_100BaseT(etdev,
TRUEPHY_ADV_DUPLEX_HALF);
/* Set speed */
et1310_phy_speed_select(etdev, TRUEPHY_SPEED_100MBPS);
- } else if (etdev->AiForceDpx == 2) {
+ } else if (etdev->ai_force_duplex == 2) {
/* Set our advertise values accordingly */
et1310_phy_advertise_100BaseT(etdev,
TRUEPHY_ADV_DUPLEX_FULL);
@@ -741,11 +741,11 @@ void et131x_mii_check(struct et131x_adapter *etdev,
/* Update our state variables and indicate the
* connected state
*/
- spin_lock_irqsave(&etdev->Lock, flags);
+ spin_lock_irqsave(&etdev->lock, flags);
- etdev->MediaState = NETIF_STATUS_MEDIA_CONNECT;
+ etdev->media_state = NETIF_STATUS_MEDIA_CONNECT;
- spin_unlock_irqrestore(&etdev->Lock, flags);
+ spin_unlock_irqrestore(&etdev->lock, flags);
netif_carrier_on(etdev->netdev);
} else {
@@ -774,11 +774,11 @@ void et131x_mii_check(struct et131x_adapter *etdev,
* Timer expires, we can report disconnected (handled
* in the LinkDetectionDPC).
*/
- if ((etdev->MediaState == NETIF_STATUS_MEDIA_DISCONNECT)) {
- spin_lock_irqsave(&etdev->Lock, flags);
- etdev->MediaState =
+ if (etdev->media_state == NETIF_STATUS_MEDIA_DISCONNECT) {
+ spin_lock_irqsave(&etdev->lock, flags);
+ etdev->media_state =
NETIF_STATUS_MEDIA_DISCONNECT;
- spin_unlock_irqrestore(&etdev->Lock,
+ spin_unlock_irqrestore(&etdev->lock,
flags);
netif_carrier_off(etdev->netdev);
@@ -810,15 +810,15 @@ void et131x_mii_check(struct et131x_adapter *etdev,
/* Setup the PHY into coma mode until the cable is
* plugged back in
*/
- if (etdev->RegistryPhyComa == 1)
+ if (etdev->registry_phy_coma == 1)
et1310_enable_phy_coma(etdev);
}
}
if ((bmsr_ints & MI_BMSR_AUTO_NEG_COMPLETE) ||
- (etdev->AiForceDpx == 3 && (bmsr_ints & MI_BMSR_LINK_STATUS))) {
+ (etdev->ai_force_duplex == 3 && (bmsr_ints & MI_BMSR_LINK_STATUS))) {
if ((bmsr & MI_BMSR_AUTO_NEG_COMPLETE) ||
- etdev->AiForceDpx == 3) {
+ etdev->ai_force_duplex == 3) {
et1310_phy_link_status(etdev,
&link_status, &autoneg_status,
&speed, &duplex, &mdi_mdix,
@@ -849,7 +849,7 @@ void et131x_mii_check(struct et131x_adapter *etdev,
et1310_config_flow_control(etdev);
if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS &&
- etdev->RegistryJumboPacket > 2048)
+ etdev->registry_jumbo_packet > 2048)
et1310_phy_and_or_reg(etdev, 0x16, 0xcfff,
0x2000);
diff --git a/drivers/staging/et131x/et1310_pm.c b/drivers/staging/et131x/et1310_pm.c
index 1bfcc67..914aff6 100644
--- a/drivers/staging/et131x/et1310_pm.c
+++ b/drivers/staging/et131x/et1310_pm.c
@@ -116,8 +116,8 @@ void et1310_enable_phy_coma(struct et131x_adapter *etdev)
/* Save the GbE PHY speed and duplex modes. Need to restore this
* when cable is plugged back in
*/
- etdev->pdown_speed = etdev->AiForceSpeed;
- etdev->pdown_duplex = etdev->AiForceDpx;
+ etdev->pdown_speed = etdev->ai_force_speed;
+ etdev->pdown_duplex = etdev->ai_force_duplex;
/* Stop sending packets. */
spin_lock_irqsave(&etdev->send_hw_lock, flags);
@@ -153,8 +153,8 @@ void et1310_disable_phy_coma(struct et131x_adapter *etdev)
/* Restore the GbE PHY speed and duplex modes;
* Reset JAGCore; re-configure and initialize JAGCore and gigE PHY
*/
- etdev->AiForceSpeed = etdev->pdown_speed;
- etdev->AiForceDpx = etdev->pdown_duplex;
+ etdev->ai_force_speed = etdev->pdown_speed;
+ etdev->ai_force_duplex = etdev->pdown_duplex;
/* Re-initialize the send structures */
et131x_init_send(etdev);
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c
index 694bb02..0924309 100644
--- a/drivers/staging/et131x/et1310_rx.c
+++ b/drivers/staging/et131x/et1310_rx.c
@@ -149,14 +149,14 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
* the number of entries halves. FBR0 increases in size, however.
*/
- if (adapter->RegistryJumboPacket < 2048) {
+ if (adapter->registry_jumbo_packet < 2048) {
#ifdef USE_FBR0
rx_ring->fbr0_buffsize = 256;
rx_ring->fbr0_num_entries = 512;
#endif
rx_ring->fbr1_buffsize = 2048;
rx_ring->fbr1_num_entries = 512;
- } else if (adapter->RegistryJumboPacket < 4096) {
+ } else if (adapter->registry_jumbo_packet < 4096) {
#ifdef USE_FBR0
rx_ring->fbr0_buffsize = 512;
rx_ring->fbr0_num_entries = 1024;
@@ -755,7 +755,7 @@ static void nic_return_rfd(struct et131x_adapter *etdev, struct rfd *rfd)
(ring_index == 0 && buff_index < rx_local->fbr0_num_entries) ||
#endif
(ring_index == 1 && buff_index < rx_local->fbr1_num_entries)) {
- spin_lock_irqsave(&etdev->FbrLock, flags);
+ spin_lock_irqsave(&etdev->fbr_lock, flags);
if (ring_index == 1) {
struct fbr_desc *next =
@@ -793,7 +793,7 @@ static void nic_return_rfd(struct et131x_adapter *etdev, struct rfd *rfd)
&rx_dma->fbr0_full_offset);
}
#endif
- spin_unlock_irqrestore(&etdev->FbrLock, flags);
+ spin_unlock_irqrestore(&etdev->fbr_lock, flags);
} else {
dev_err(&etdev->pdev->dev,
"%s illegal Buffer Index returned\n", __func__);
@@ -983,18 +983,18 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
* also counted here.
*/
if (len < (NIC_MIN_PACKET_SIZE + 4)) {
- etdev->stats.other_errors++;
+ etdev->stats.rx_other_errs++;
len = 0;
}
if (len) {
- if (etdev->ReplicaPhyLoopbk == 1) {
+ if (etdev->replica_phy_loopbk == 1) {
buf = rx_local->fbr[ring_index]->virt[buff_index];
if (memcmp(&buf[6], etdev->addr, ETH_ALEN) == 0) {
if (memcmp(&buf[42], "Replica packet",
ETH_HLEN)) {
- etdev->ReplicaPhyLoopbkPF = 1;
+ etdev->replica_phy_loopbk_passfail = 1;
}
}
}
@@ -1009,9 +1009,12 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
* filters. Generally filter is 0x2b when in
* promiscuous mode.
*/
- if ((etdev->PacketFilter & ET131X_PACKET_TYPE_MULTICAST)
- && !(etdev->PacketFilter & ET131X_PACKET_TYPE_PROMISCUOUS)
- && !(etdev->PacketFilter & ET131X_PACKET_TYPE_ALL_MULTICAST)) {
+ if ((etdev->packet_filter &
+ ET131X_PACKET_TYPE_MULTICAST)
+ && !(etdev->packet_filter &
+ ET131X_PACKET_TYPE_PROMISCUOUS)
+ && !(etdev->packet_filter &
+ ET131X_PACKET_TYPE_ALL_MULTICAST)) {
buf = rx_local->fbr[ring_index]->
virt[buff_index];
@@ -1019,13 +1022,20 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
* destination address of this packet
* matches one in our list.
*/
- for (i = 0; i < etdev->MCAddressCount; i++) {
- if (buf[0] == etdev->MCList[i][0]
- && buf[1] == etdev->MCList[i][1]
- && buf[2] == etdev->MCList[i][2]
- && buf[3] == etdev->MCList[i][3]
- && buf[4] == etdev->MCList[i][4]
- && buf[5] == etdev->MCList[i][5]) {
+ for (i = 0; i < etdev->multicast_addr_count;
+ i++) {
+ if (buf[0] ==
+ etdev->multicast_list[i][0]
+ && buf[1] ==
+ etdev->multicast_list[i][1]
+ && buf[2] ==
+ etdev->multicast_list[i][2]
+ && buf[3] ==
+ etdev->multicast_list[i][3]
+ && buf[4] ==
+ etdev->multicast_list[i][4]
+ && buf[5] ==
+ etdev->multicast_list[i][5]) {
break;
}
}
@@ -1038,21 +1048,21 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *etdev)
* so we free our RFD when we return
* from this function.
*/
- if (i == etdev->MCAddressCount)
+ if (i == etdev->multicast_addr_count)
len = 0;
}
if (len > 0)
- etdev->stats.multircv++;
+ etdev->stats.multicast_pkts_rcvd++;
} else if (word0 & ALCATEL_BROADCAST_PKT)
- etdev->stats.brdcstrcv++;
+ etdev->stats.broadcast_pkts_rcvd++;
else
/* Not sure what this counter measures in
* promiscuous mode. Perhaps we should check
* the MAC address to see if it is directed
* to us in promiscuous mode.
*/
- etdev->stats.unircv++;
+ etdev->stats.unicast_pkts_rcvd++;
}
if (len > 0) {
@@ -1128,7 +1138,7 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev)
* If length is zero, return the RFD in order to advance the
* Free buffer ring.
*/
- if (!etdev->PacketFilter ||
+ if (!etdev->packet_filter ||
!netif_carrier_ok(etdev->netdev) ||
rfd->len == 0)
continue;
diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c
index da9b4af..eb8552b 100644
--- a/drivers/staging/et131x/et1310_tx.c
+++ b/drivers/staging/et131x/et1310_tx.c
@@ -456,7 +456,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, struct tcb *tcb)
} else
tcb->index = etdev->tx_ring.send_idx - 1;
- spin_lock(&etdev->TCBSendQLock);
+ spin_lock(&etdev->tcb_send_qlock);
if (etdev->tx_ring.send_tail)
etdev->tx_ring.send_tail->next = tcb;
@@ -469,7 +469,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, struct tcb *tcb)
etdev->tx_ring.used++;
- spin_unlock(&etdev->TCBSendQLock);
+ spin_unlock(&etdev->tcb_send_qlock);
/* Write the new write pointer back to the device. */
writel(etdev->tx_ring.send_idx,
@@ -508,12 +508,12 @@ static int send_packet(struct sk_buff *skb, struct et131x_adapter *etdev)
return -EIO;
/* Get a TCB for this packet */
- spin_lock_irqsave(&etdev->TCBReadyQLock, flags);
+ spin_lock_irqsave(&etdev->tcb_ready_qlock, flags);
tcb = etdev->tx_ring.tcb_qhead;
if (tcb == NULL) {
- spin_unlock_irqrestore(&etdev->TCBReadyQLock, flags);
+ spin_unlock_irqrestore(&etdev->tcb_ready_qlock, flags);
return -ENOMEM;
}
@@ -522,7 +522,7 @@ static int send_packet(struct sk_buff *skb, struct et131x_adapter *etdev)
if (etdev->tx_ring.tcb_qhead == NULL)
etdev->tx_ring.tcb_qtail = NULL;
- spin_unlock_irqrestore(&etdev->TCBReadyQLock, flags);
+ spin_unlock_irqrestore(&etdev->tcb_ready_qlock, flags);
tcb->skb = skb;
@@ -543,7 +543,7 @@ static int send_packet(struct sk_buff *skb, struct et131x_adapter *etdev)
status = nic_send_packet(etdev, tcb);
if (status != 0) {
- spin_lock_irqsave(&etdev->TCBReadyQLock, flags);
+ spin_lock_irqsave(&etdev->tcb_ready_qlock, flags);
if (etdev->tx_ring.tcb_qtail)
etdev->tx_ring.tcb_qtail->next = tcb;
@@ -552,7 +552,7 @@ static int send_packet(struct sk_buff *skb, struct et131x_adapter *etdev)
etdev->tx_ring.tcb_qhead = tcb;
etdev->tx_ring.tcb_qtail = tcb;
- spin_unlock_irqrestore(&etdev->TCBReadyQLock, flags);
+ spin_unlock_irqrestore(&etdev->tcb_ready_qlock, flags);
return status;
}
WARN_ON(etdev->tx_ring.used > NUM_TCB);
@@ -627,11 +627,11 @@ static inline void free_send_packet(struct et131x_adapter *etdev,
struct net_device_stats *stats = &etdev->net_stats;
if (tcb->flags & fMP_DEST_BROAD)
- atomic_inc(&etdev->stats.brdcstxmt);
+ atomic_inc(&etdev->stats.broadcast_pkts_xmtd);
else if (tcb->flags & fMP_DEST_MULTI)
- atomic_inc(&etdev->stats.multixmt);
+ atomic_inc(&etdev->stats.multicast_pkts_xmtd);
else
- atomic_inc(&etdev->stats.unixmt);
+ atomic_inc(&etdev->stats.unicast_pkts_xmtd);
if (tcb->skb) {
stats->tx_bytes += tcb->skb->len;
@@ -663,7 +663,7 @@ static inline void free_send_packet(struct et131x_adapter *etdev,
memset(tcb, 0, sizeof(struct tcb));
/* Add the TCB to the Ready Q */
- spin_lock_irqsave(&etdev->TCBReadyQLock, flags);
+ spin_lock_irqsave(&etdev->tcb_ready_qlock, flags);
etdev->net_stats.tx_packets++;
@@ -675,7 +675,7 @@ static inline void free_send_packet(struct et131x_adapter *etdev,
etdev->tx_ring.tcb_qtail = tcb;
- spin_unlock_irqrestore(&etdev->TCBReadyQLock, flags);
+ spin_unlock_irqrestore(&etdev->tcb_ready_qlock, flags);
WARN_ON(etdev->tx_ring.used < 0);
}
@@ -692,7 +692,7 @@ void et131x_free_busy_send_packets(struct et131x_adapter *etdev)
u32 freed = 0;
/* Any packets being sent? Check the first TCB on the send list */
- spin_lock_irqsave(&etdev->TCBSendQLock, flags);
+ spin_lock_irqsave(&etdev->tcb_send_qlock, flags);
tcb = etdev->tx_ring.send_head;
@@ -706,19 +706,19 @@ void et131x_free_busy_send_packets(struct et131x_adapter *etdev)
etdev->tx_ring.used--;
- spin_unlock_irqrestore(&etdev->TCBSendQLock, flags);
+ spin_unlock_irqrestore(&etdev->tcb_send_qlock, flags);
freed++;
free_send_packet(etdev, tcb);
- spin_lock_irqsave(&etdev->TCBSendQLock, flags);
+ spin_lock_irqsave(&etdev->tcb_send_qlock, flags);
tcb = etdev->tx_ring.send_head;
}
WARN_ON(freed == NUM_TCB);
- spin_unlock_irqrestore(&etdev->TCBSendQLock, flags);
+ spin_unlock_irqrestore(&etdev->tcb_send_qlock, flags);
etdev->tx_ring.used = 0;
}
@@ -745,7 +745,7 @@ void et131x_handle_send_interrupt(struct et131x_adapter *etdev)
/* Has the ring wrapped? Process any descriptors that do not have
* the same "wrap" indicator as the current completion indicator
*/
- spin_lock_irqsave(&etdev->TCBSendQLock, flags);
+ spin_lock_irqsave(&etdev->tcb_send_qlock, flags);
tcb = etdev->tx_ring.send_head;
@@ -757,9 +757,9 @@ void et131x_handle_send_interrupt(struct et131x_adapter *etdev)
if (tcb->next == NULL)
etdev->tx_ring.send_tail = NULL;
- spin_unlock_irqrestore(&etdev->TCBSendQLock, flags);
+ spin_unlock_irqrestore(&etdev->tcb_send_qlock, flags);
free_send_packet(etdev, tcb);
- spin_lock_irqsave(&etdev->TCBSendQLock, flags);
+ spin_lock_irqsave(&etdev->tcb_send_qlock, flags);
/* Goto the next packet */
tcb = etdev->tx_ring.send_head;
@@ -772,9 +772,9 @@ void et131x_handle_send_interrupt(struct et131x_adapter *etdev)
if (tcb->next == NULL)
etdev->tx_ring.send_tail = NULL;
- spin_unlock_irqrestore(&etdev->TCBSendQLock, flags);
+ spin_unlock_irqrestore(&etdev->tcb_send_qlock, flags);
free_send_packet(etdev, tcb);
- spin_lock_irqsave(&etdev->TCBSendQLock, flags);
+ spin_lock_irqsave(&etdev->tcb_send_qlock, flags);
/* Goto the next packet */
tcb = etdev->tx_ring.send_head;
@@ -784,6 +784,6 @@ void et131x_handle_send_interrupt(struct et131x_adapter *etdev)
if (etdev->tx_ring.used <= NUM_TCB / 3)
netif_wake_queue(etdev->netdev);
- spin_unlock_irqrestore(&etdev->TCBSendQLock, flags);
+ spin_unlock_irqrestore(&etdev->tcb_send_qlock, flags);
}
diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h
index 408c50b..5dfa153 100644
--- a/drivers/staging/et131x/et131x_adapter.h
+++ b/drivers/staging/et131x/et131x_adapter.h
@@ -105,40 +105,39 @@ struct ce_stats {
* MUST have 32, then we'll need another way to perform atomic
* operations
*/
- u32 unircv; /* # multicast packets received */
- atomic_t unixmt; /* # multicast packets for Tx */
- u32 multircv; /* # multicast packets received */
- atomic_t multixmt; /* # multicast packets for Tx */
- u32 brdcstrcv; /* # broadcast packets received */
- atomic_t brdcstxmt; /* # broadcast packets for Tx */
- u32 norcvbuf; /* # Rx packets discarded */
- u32 noxmtbuf; /* # Tx packets discarded */
+ u32 unicast_pkts_rcvd;
+ atomic_t unicast_pkts_xmtd;
+ u32 multicast_pkts_rcvd;
+ atomic_t multicast_pkts_xmtd;
+ u32 broadcast_pkts_rcvd;
+ atomic_t broadcast_pkts_xmtd;
+ u32 rcvd_pkts_dropped;
/* Transceiver state informations. */
- u8 xcvr_addr;
- u32 xcvr_id;
+ u8 xcvr_addr;
+ u32 xcvr_id;
/* Tx Statistics. */
- u32 tx_uflo; /* Tx Underruns */
+ u32 tx_underflows;
- u32 collisions;
- u32 excessive_collisions;
- u32 first_collision;
- u32 late_collisions;
- u32 max_pkt_error;
- u32 tx_deferred;
+ u32 tx_collisions;
+ u32 tx_excessive_collisions;
+ u32 tx_first_collisions;
+ u32 tx_late_collisions;
+ u32 tx_max_pkt_errs;
+ u32 tx_deferred;
/* Rx Statistics. */
- u32 rx_ov_flow; /* Rx Overflow */
+ u32 rx_overflows;
- u32 length_err;
- u32 alignment_err;
- u32 crc_err;
- u32 code_violations;
- u32 other_errors;
+ u32 rx_length_errs;
+ u32 rx_align_errs;
+ u32 rx_crc_errs;
+ u32 rx_code_violations;
+ u32 rx_other_errs;
- u32 SynchrounousIterations;
- u32 InterruptStatus;
+ u32 synchronous_iterations;
+ u32 interrupt_status;
};
@@ -151,7 +150,7 @@ struct et131x_adapter {
/* Flags that indicate current state of the adapter */
u32 flags;
- u32 HwErrCount;
+ u32 hw_errs;
/* Configuration */
u8 rom_addr[ETH_ALEN];
@@ -160,52 +159,52 @@ struct et131x_adapter {
u8 eeprom_data[2];
/* Spinlocks */
- spinlock_t Lock;
+ spinlock_t lock;
- spinlock_t TCBSendQLock;
- spinlock_t TCBReadyQLock;
+ spinlock_t tcb_send_qlock;
+ spinlock_t tcb_ready_qlock;
spinlock_t send_hw_lock;
spinlock_t rcv_lock;
- spinlock_t RcvPendLock;
- spinlock_t FbrLock;
+ spinlock_t rcv_pend_lock;
+ spinlock_t fbr_lock;
- spinlock_t PHYLock;
+ spinlock_t phy_lock;
/* Packet Filter and look ahead size */
- u32 PacketFilter;
+ u32 packet_filter;
u32 linkspeed;
u32 duplex_mode;
/* multicast list */
- u32 MCAddressCount;
- u8 MCList[NIC_MAX_MCAST_LIST][ETH_ALEN];
+ u32 multicast_addr_count;
+ u8 multicast_list[NIC_MAX_MCAST_LIST][ETH_ALEN];
/* Pointer to the device's PCI register space */
struct address_map __iomem *regs;
/* Registry parameters */
- u8 SpeedDuplex; /* speed/duplex */
+ u8 speed_duplex; /* speed/duplex */
u8 wanted_flow; /* Flow we want for 802.3x flow control */
- u8 RegistryPhyComa; /* Phy Coma mode enable/disable */
+ u8 registry_phy_coma; /* Phy Coma mode enable/disable */
- u32 RegistryRxMemEnd; /* Size of internal rx memory */
- u32 RegistryJumboPacket; /* Max supported ethernet packet size */
+ u32 registry_rx_mem_end; /* Size of internal rx memory */
+ u32 registry_jumbo_packet; /* Max supported ethernet packet size */
/* Derived from the registry: */
- u8 AiForceDpx; /* duplex setting */
- u16 AiForceSpeed; /* 'Speed', user over-ride of line speed */
+ u8 ai_force_duplex; /* duplex setting */
+ u16 ai_force_speed; /* 'Speed', user over-ride of line speed */
u8 flowcontrol; /* flow control validated by the far-end */
enum {
NETIF_STATUS_INVALID = 0,
NETIF_STATUS_MEDIA_CONNECT,
NETIF_STATUS_MEDIA_DISCONNECT,
NETIF_STATUS_MAX
- } MediaState;
+ } media_state;
/* Minimize init-time */
- struct timer_list ErrorTimer;
+ struct timer_list error_timer;
/* variable putting the phy into coma mode when boot up with no cable
* plugged in after 5 seconds
@@ -219,7 +218,7 @@ struct et131x_adapter {
u16 pdown_speed;
u8 pdown_duplex;
- u32 CachedMaskValue;
+ u32 cached_mask_value;
/* Xcvr status at last poll */
u16 bmsr;
@@ -231,8 +230,8 @@ struct et131x_adapter {
struct rx_ring rx_ring;
/* Loopback specifics */
- u8 ReplicaPhyLoopbk; /* Replica Enable */
- u8 ReplicaPhyLoopbkPF; /* Replica Enable Pass/Fail */
+ u8 replica_phy_loopbk; /* Replica Enable */
+ u8 replica_phy_loopbk_passfail; /* Replica Enable Pass/Fail */
/* Stats */
struct ce_stats stats;
diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c
index dcf3131..d12610d 100644
--- a/drivers/staging/et131x/et131x_initpci.c
+++ b/drivers/staging/et131x/et131x_initpci.c
@@ -275,14 +275,14 @@ void et131x_error_timer_handler(unsigned long data)
"No interrupts, in PHY coma, pm_csr = 0x%x\n", pm_csr);
if (!(etdev->bmsr & MI_BMSR_LINK_STATUS) &&
- etdev->RegistryPhyComa &&
+ etdev->registry_phy_coma &&
etdev->boot_coma < 11) {
etdev->boot_coma++;
}
if (etdev->boot_coma == 10) {
if (!(etdev->bmsr & MI_BMSR_LINK_STATUS)
- && etdev->RegistryPhyComa) {
+ && etdev->registry_phy_coma) {
if ((pm_csr & ET_PM_PHY_SW_COMA) == 0) {
/* NOTE - This was originally a 'sync with
* interrupt'. How to do that under Linux?
@@ -294,7 +294,7 @@ void et131x_error_timer_handler(unsigned long data)
}
/* This is a periodic timer, so reschedule */
- mod_timer(&etdev->ErrorTimer, jiffies +
+ mod_timer(&etdev->error_timer, jiffies +
TX_ERROR_PERIOD * HZ / 1000);
}
@@ -308,12 +308,12 @@ void et131x_link_detection_handler(unsigned long data)
struct et131x_adapter *etdev = (struct et131x_adapter *) data;
unsigned long flags;
- if (etdev->MediaState == 0) {
- spin_lock_irqsave(&etdev->Lock, flags);
+ if (etdev->media_state == 0) {
+ spin_lock_irqsave(&etdev->lock, flags);
- etdev->MediaState = NETIF_STATUS_MEDIA_DISCONNECT;
+ etdev->media_state = NETIF_STATUS_MEDIA_DISCONNECT;
- spin_unlock_irqrestore(&etdev->Lock, flags);
+ spin_unlock_irqrestore(&etdev->lock, flags);
netif_carrier_off(etdev->netdev);
}
@@ -332,7 +332,7 @@ void ConfigGlobalRegs(struct et131x_adapter *etdev)
writel(0, ®s->rxq_start_addr);
writel(INTERNAL_MEM_SIZE - 1, ®s->txq_end_addr);
- if (etdev->RegistryJumboPacket < 2048) {
+ if (etdev->registry_jumbo_packet < 2048) {
/* Tx / RxDMA and Tx/Rx MAC interfaces have a 1k word
* block of RAM that the driver can split between Tx
* and Rx as it desires. Our default is to split it
@@ -340,7 +340,7 @@ void ConfigGlobalRegs(struct et131x_adapter *etdev)
*/
writel(PARM_RX_MEM_END_DEF, ®s->rxq_end_addr);
writel(PARM_RX_MEM_END_DEF + 1, ®s->txq_start_addr);
- } else if (etdev->RegistryJumboPacket < 8192) {
+ } else if (etdev->registry_jumbo_packet < 8192) {
/* For jumbo packets > 2k but < 8k, split 50-50. */
writel(INTERNAL_MEM_RX_OFFSET, ®s->rxq_end_addr);
writel(INTERNAL_MEM_RX_OFFSET + 1, ®s->txq_start_addr);
@@ -552,27 +552,27 @@ static struct et131x_adapter *et131x_adapter_init(struct net_device *netdev,
netdev->base_addr = pci_resource_start(pdev, 0);
/* Initialize spinlocks here */
- spin_lock_init(&etdev->Lock);
- spin_lock_init(&etdev->TCBSendQLock);
- spin_lock_init(&etdev->TCBReadyQLock);
+ spin_lock_init(&etdev->lock);
+ spin_lock_init(&etdev->tcb_send_qlock);
+ spin_lock_init(&etdev->tcb_ready_qlock);
spin_lock_init(&etdev->send_hw_lock);
spin_lock_init(&etdev->rcv_lock);
- spin_lock_init(&etdev->RcvPendLock);
- spin_lock_init(&etdev->FbrLock);
- spin_lock_init(&etdev->PHYLock);
+ spin_lock_init(&etdev->rcv_pend_lock);
+ spin_lock_init(&etdev->fbr_lock);
+ spin_lock_init(&etdev->phy_lock);
/* Parse configuration parameters into the private adapter struct */
if (et131x_speed_set)
dev_info(&etdev->pdev->dev,
"Speed set manually to : %d\n", et131x_speed_set);
- etdev->SpeedDuplex = et131x_speed_set;
- etdev->RegistryJumboPacket = 1514; /* 1514-9216 */
+ etdev->speed_duplex = et131x_speed_set;
+ etdev->registry_jumbo_packet = 1514; /* 1514-9216 */
/* Set the MAC address to a default */
memcpy(etdev->addr, default_mac, ETH_ALEN);
- /* Decode SpeedDuplex
+ /* Decode speed_duplex
*
* Set up as if we are auto negotiating always and then change if we
* go into force mode
@@ -581,11 +581,11 @@ static struct et131x_adapter *et131x_adapter_init(struct net_device *netdev,
* knock it down to 100 full.
*/
if (etdev->pdev->device == ET131X_PCI_DEVICE_ID_FAST &&
- etdev->SpeedDuplex == 5)
- etdev->SpeedDuplex = 4;
+ etdev->speed_duplex == 5)
+ etdev->speed_duplex = 4;
- etdev->AiForceSpeed = speed[etdev->SpeedDuplex];
- etdev->AiForceDpx = duplex[etdev->SpeedDuplex]; /* Auto FDX */
+ etdev->ai_force_speed = speed[etdev->speed_duplex];
+ etdev->ai_force_duplex = duplex[etdev->speed_duplex]; /* Auto FDX */
return etdev;
}
@@ -717,11 +717,11 @@ static int __devinit et131x_pci_setup(struct pci_dev *pdev,
et131x_adapter_setup(adapter);
/* Create a timer to count errors received by the NIC */
- init_timer(&adapter->ErrorTimer);
+ init_timer(&adapter->error_timer);
- adapter->ErrorTimer.expires = jiffies + TX_ERROR_PERIOD * HZ / 1000;
- adapter->ErrorTimer.function = et131x_error_timer_handler;
- adapter->ErrorTimer.data = (unsigned long)adapter;
+ adapter->error_timer.expires = jiffies + TX_ERROR_PERIOD * HZ / 1000;
+ adapter->error_timer.function = et131x_error_timer_handler;
+ adapter->error_timer.data = (unsigned long)adapter;
/* Initialize link state */
et131x_link_detection_handler((unsigned long)adapter);
diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c
index 9b316be..1584ab2 100644
--- a/drivers/staging/et131x/et131x_isr.c
+++ b/drivers/staging/et131x/et131x_isr.c
@@ -124,7 +124,7 @@ void et131x_enable_interrupts(struct et131x_adapter *adapter)
else
mask = INT_MASK_ENABLE_NO_FLOW;
- adapter->CachedMaskValue = mask;
+ adapter->cached_mask_value = mask;
writel(mask, &adapter->regs->global.int_mask);
}
@@ -138,7 +138,7 @@ void et131x_enable_interrupts(struct et131x_adapter *adapter)
void et131x_disable_interrupts(struct et131x_adapter *adapter)
{
/* Disable all global interrupts */
- adapter->CachedMaskValue = INT_MASK_DISABLE;
+ adapter->cached_mask_value = INT_MASK_DISABLE;
writel(INT_MASK_DISABLE, &adapter->regs->global.int_mask);
}
@@ -222,7 +222,7 @@ irqreturn_t et131x_isr(int irq, void *dev_id)
* DPC. We will clear the software copy of that in that
* routine.
*/
- adapter->stats.InterruptStatus = status;
+ adapter->stats.interrupt_status = status;
/* Schedule the ISR handler as a bottom-half task in the
* kernel's tq_immediate queue, and mark the queue for
@@ -244,7 +244,7 @@ void et131x_isr_handler(struct work_struct *work)
{
struct et131x_adapter *etdev =
container_of(work, struct et131x_adapter, task);
- u32 status = etdev->stats.InterruptStatus;
+ u32 status = etdev->stats.interrupt_status;
struct address_map __iomem *iomem = etdev->regs;
/*
@@ -389,7 +389,7 @@ void et131x_isr_handler(struct work_struct *work)
(uint8_t) offsetof(struct mi_regs, isr),
&myisr);
- if (!etdev->ReplicaPhyLoopbk) {
+ if (!etdev->replica_phy_loopbk) {
et131x_mii_read(etdev,
(uint8_t) offsetof(struct mi_regs, bmsr),
&bmsr_data);
diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c
index 546acb3..500c7d9 100644
--- a/drivers/staging/et131x/et131x_netdev.c
+++ b/drivers/staging/et131x/et131x_netdev.c
@@ -100,15 +100,18 @@ static struct net_device_stats *et131x_stats(struct net_device *netdev)
struct net_device_stats *stats = &adapter->net_stats;
struct ce_stats *devstat = &adapter->stats;
- stats->rx_errors = devstat->length_err + devstat->alignment_err +
- devstat->crc_err + devstat->code_violations + devstat->other_errors;
- stats->tx_errors = devstat->max_pkt_error;
- stats->multicast = devstat->multircv;
- stats->collisions = devstat->collisions;
-
- stats->rx_length_errors = devstat->length_err;
- stats->rx_over_errors = devstat->rx_ov_flow;
- stats->rx_crc_errors = devstat->crc_err;
+ stats->rx_errors = devstat->rx_length_errs +
+ devstat->rx_align_errs +
+ devstat->rx_crc_errs +
+ devstat->rx_code_violations +
+ devstat->rx_other_errs;
+ stats->tx_errors = devstat->tx_max_pkt_errs;
+ stats->multicast = devstat->multicast_pkts_rcvd;
+ stats->collisions = devstat->tx_collisions;
+
+ stats->rx_length_errors = devstat->rx_length_errs;
+ stats->rx_over_errors = devstat->rx_overflows;
+ stats->rx_crc_errors = devstat->rx_crc_errs;
/* NOTE: These stats don't have corresponding values in CE_STATS,
* so we're going to have to update these directly from within the
@@ -144,7 +147,7 @@ int et131x_open(struct net_device *netdev)
struct et131x_adapter *adapter = netdev_priv(netdev);
/* Start the timer to track NIC errors */
- add_timer(&adapter->ErrorTimer);
+ add_timer(&adapter->error_timer);
/* Register our IRQ */
result = request_irq(netdev->irq, et131x_isr, IRQF_SHARED,
@@ -194,7 +197,7 @@ int et131x_close(struct net_device *netdev)
free_irq(netdev->irq, netdev);
/* Stop the error timer */
- del_timer_sync(&adapter->ErrorTimer);
+ del_timer_sync(&adapter->error_timer);
return 0;
}
@@ -275,7 +278,7 @@ int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
int et131x_set_packet_filter(struct et131x_adapter *adapter)
{
int status = 0;
- uint32_t filter = adapter->PacketFilter;
+ uint32_t filter = adapter->packet_filter;
u32 ctrl;
u32 pf_ctrl;
@@ -337,67 +340,67 @@ int et131x_set_packet_filter(struct et131x_adapter *adapter)
void et131x_multicast(struct net_device *netdev)
{
struct et131x_adapter *adapter = netdev_priv(netdev);
- uint32_t PacketFilter = 0;
+ uint32_t packet_filter = 0;
unsigned long flags;
struct netdev_hw_addr *ha;
int i;
- spin_lock_irqsave(&adapter->Lock, flags);
+ spin_lock_irqsave(&adapter->lock, flags);
/* Before we modify the platform-independent filter flags, store them
* locally. This allows us to determine if anything's changed and if
* we even need to bother the hardware
*/
- PacketFilter = adapter->PacketFilter;
+ packet_filter = adapter->packet_filter;
/* Clear the 'multicast' flag locally; because we only have a single
* flag to check multicast, and multiple multicast addresses can be
* set, this is the easiest way to determine if more than one
* multicast address is being set.
*/
- PacketFilter &= ~ET131X_PACKET_TYPE_MULTICAST;
+ packet_filter &= ~ET131X_PACKET_TYPE_MULTICAST;
/* Check the net_device flags and set the device independent flags
* accordingly
*/
if (netdev->flags & IFF_PROMISC)
- adapter->PacketFilter |= ET131X_PACKET_TYPE_PROMISCUOUS;
+ adapter->packet_filter |= ET131X_PACKET_TYPE_PROMISCUOUS;
else
- adapter->PacketFilter &= ~ET131X_PACKET_TYPE_PROMISCUOUS;
+ adapter->packet_filter &= ~ET131X_PACKET_TYPE_PROMISCUOUS;
if (netdev->flags & IFF_ALLMULTI)
- adapter->PacketFilter |= ET131X_PACKET_TYPE_ALL_MULTICAST;
+ adapter->packet_filter |= ET131X_PACKET_TYPE_ALL_MULTICAST;
if (netdev_mc_count(netdev) > NIC_MAX_MCAST_LIST)
- adapter->PacketFilter |= ET131X_PACKET_TYPE_ALL_MULTICAST;
+ adapter->packet_filter |= ET131X_PACKET_TYPE_ALL_MULTICAST;
if (netdev_mc_count(netdev) < 1) {
- adapter->PacketFilter &= ~ET131X_PACKET_TYPE_ALL_MULTICAST;
- adapter->PacketFilter &= ~ET131X_PACKET_TYPE_MULTICAST;
+ adapter->packet_filter &= ~ET131X_PACKET_TYPE_ALL_MULTICAST;
+ adapter->packet_filter &= ~ET131X_PACKET_TYPE_MULTICAST;
} else
- adapter->PacketFilter |= ET131X_PACKET_TYPE_MULTICAST;
+ adapter->packet_filter |= ET131X_PACKET_TYPE_MULTICAST;
/* Set values in the private adapter struct */
i = 0;
netdev_for_each_mc_addr(ha, netdev) {
if (i == NIC_MAX_MCAST_LIST)
break;
- memcpy(adapter->MCList[i++], ha->addr, ETH_ALEN);
+ memcpy(adapter->multicast_list[i++], ha->addr, ETH_ALEN);
}
- adapter->MCAddressCount = i;
+ adapter->multicast_addr_count = i;
/* Are the new flags different from the previous ones? If not, then no
* action is required
*
- * NOTE - This block will always update the MCList with the hardware,
- * even if the addresses aren't the same.
+ * NOTE - This block will always update the multicast_list with the
+ * hardware, even if the addresses aren't the same.
*/
- if (PacketFilter != adapter->PacketFilter) {
+ if (packet_filter != adapter->packet_filter) {
/* Call the device's filter function */
et131x_set_packet_filter(adapter);
}
- spin_unlock_irqrestore(&adapter->Lock, flags);
+ spin_unlock_irqrestore(&adapter->lock, flags);
}
/**
@@ -459,7 +462,7 @@ void et131x_tx_timeout(struct net_device *netdev)
}
/* Is send stuck? */
- spin_lock_irqsave(&etdev->TCBSendQLock, flags);
+ spin_lock_irqsave(&etdev->tcb_send_qlock, flags);
tcb = etdev->tx_ring.send_head;
@@ -467,7 +470,7 @@ void et131x_tx_timeout(struct net_device *netdev)
tcb->count++;
if (tcb->count > NIC_SEND_HANG_THRESHOLD) {
- spin_unlock_irqrestore(&etdev->TCBSendQLock,
+ spin_unlock_irqrestore(&etdev->tcb_send_qlock,
flags);
dev_warn(&etdev->pdev->dev,
@@ -482,7 +485,7 @@ void et131x_tx_timeout(struct net_device *netdev)
}
}
- spin_unlock_irqrestore(&etdev->TCBSendQLock, flags);
+ spin_unlock_irqrestore(&etdev->tcb_send_qlock, flags);
}
/**
@@ -520,7 +523,7 @@ int et131x_change_mtu(struct net_device *netdev, int new_mtu)
et131x_adapter_memory_free(adapter);
/* Set the config parameter for Jumbo Packet support */
- adapter->RegistryJumboPacket = new_mtu + 14;
+ adapter->registry_jumbo_packet = new_mtu + 14;
et131x_soft_reset(adapter);
/* Alloc and init Rx DMA memory */
@@ -601,7 +604,7 @@ int et131x_set_mac_addr(struct net_device *netdev, void *new_mac)
et131x_adapter_memory_free(adapter);
/* Set the config parameter for Jumbo Packet support */
- /* adapter->RegistryJumboPacket = new_mtu + 14; */
+ /* adapter->registry_jumbo_packet = new_mtu + 14; */
/* blux: not needet here, we'll change the MAC */
et131x_soft_reset(adapter);
--
1.7.4.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 10/10] staging: et131x: Converting et1310_adapter.h variable names from CamelCase
2011-07-10 15:35 ` [PATCH 10/10] staging: et131x: Converting et1310_adapter.h variable " Mark Einon
@ 2011-08-23 18:41 ` Greg KH
0 siblings, 0 replies; 12+ messages in thread
From: Greg KH @ 2011-08-23 18:41 UTC (permalink / raw)
To: Mark Einon; +Cc: gregkh, devel, linux-kernel, o.hartmann
On Sun, Jul 10, 2011 at 04:35:35PM +0100, Mark Einon wrote:
> Tested on an ET-131x device.
>
> Signed-off-by: Mark Einon <mark.einon@gmail.com>
This patch didn't apply for some reason :(
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2011-08-23 18:46 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-10 15:35 [PATCH 0/10] staging: et131x: Kernel coding style cleanups Mark Einon
2011-07-10 15:35 ` [PATCH 01/10] staging: et131x: Converting et1310_mac.c function and local names from CamelCase Mark Einon
2011-07-10 15:35 ` [PATCH 02/10] staging: et131x: Converting et1310_phy.c " Mark Einon
2011-07-10 15:35 ` [PATCH 03/10] staging: et131x: Converting et1310_pm.c " Mark Einon
2011-07-10 15:35 ` [PATCH 04/10] staging: et131x: Remove unecessary *etdev NULL check in et1310_phy_init() Mark Einon
2011-07-10 15:35 ` [PATCH 05/10] staging: et131x: Converting et1310_rx.c function and local names from CamelCase Mark Einon
2011-07-10 15:35 ` [PATCH 06/10] staging: et131x: Make static some local functions in et1310_rx.c Mark Einon
2011-07-10 15:35 ` [PATCH 07/10] staging: et131x: Converting et1310_rx.h variable names from CamelCase Mark Einon
2011-07-10 15:35 ` [PATCH 08/10] staging: et131x: add et1310_ prefix to et1310_mac.c functions Mark Einon
2011-07-10 15:35 ` [PATCH 09/10] staging: et131x: Converting et1310_tx.c function and local names from CamelCase Mark Einon
2011-07-10 15:35 ` [PATCH 10/10] staging: et131x: Converting et1310_adapter.h variable " Mark Einon
2011-08-23 18:41 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox