staging: et131x: Kernel coding style cleanups
cover staging: et131x: Kernel coding style cleanups
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(-)
PATCH 1/10 staging: et131x: Converting et1310_mac.c function and local names from CamelCase
Tested on an ET-131x device.
--- 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(-)
drivers/staging/et131x/et1310_mac.c +111 -111
@@ -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;
drivers/staging/et131x/et1310_phy.c +2 -2
@@ -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); } } }
drivers/staging/et131x/et131x.h +10 -10
@@ -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 );
drivers/staging/et131x/et131x_initpci.c +6 -6
@@ -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);
drivers/staging/et131x/et131x_isr.c +1 -1
@@ -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 */
drivers/staging/et131x/et131x_netdev.c +2 -2
@@ -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 ; }
Signature · 1 line
1.7.4.4
PATCH 2/10 staging: et131x: Converting et1310_phy.c function and local names from CamelCase
In reply to Mark EinonTested on an ET-131x device.
--- 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(-)
drivers/staging/et131x/et1310_mac.c +5 -5
@@ -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 )) {
drivers/staging/et131x/et1310_phy.c +200 -202
830 lines not on this page · raw message
drivers/staging/et131x/et131x.h +15 -20
@@ -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);
drivers/staging/et131x/et131x_initpci.c +7 -7
@@ -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; }/**
drivers/staging/et131x/et131x_isr.c +5 -4
@@ -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); } }
drivers/staging/et131x/et131x_netdev.c +2 -2
@@ -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 ;
Signature · 1 line
1.7.4.4
PATCH 3/10 staging: et131x: Converting et1310_pm.c function and local names from CamelCase
In reply to Mark EinonTested on an ET-131x device.
--- 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(-)
drivers/staging/et131x/et1310_phy.c +1 -1
@@ -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); } }
drivers/staging/et131x/et1310_pm.c +4 -4
@@ -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;
drivers/staging/et131x/et131x.h +4 -4
@@ -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);
drivers/staging/et131x/et131x_initpci.c +1 -1
@@ -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); } } }
drivers/staging/et131x/et131x_isr.c +1 -1
@@ -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
Signature · 1 line
1.7.4.4
PATCH 4/10 staging: et131x: Remove unecessary *etdev NULL check in et1310_phy_init()
In reply to Mark EinonIt is impossible to get to this function with the pointer being NULL. Tested on an ET-131x device.
--- drivers/staging/et131x/et1310_phy.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
drivers/staging/et131x/et1310_phy.c +0 -3
@@ -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);
Signature · 1 line
1.7.4.4
PATCH 5/10 staging: et131x: Converting et1310_rx.c function and local names from CamelCase
In reply to Mark EinonAlso renamed some items to improve readability, and other minor tidy-ups. Tested on an ET-131x device.
--- 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(-)
drivers/staging/et131x/et1310_phy.c +1 -1
@@ -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); } }
drivers/staging/et131x/et1310_rx.c +93 -98
426 lines not on this page · raw message
drivers/staging/et131x/et131x.h +2 -2
@@ -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);
drivers/staging/et131x/et131x_initpci.c +1 -1
@@ -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);
Signature · 1 line
1.7.4.4
PATCH 6/10 staging: et131x: Make static some local functions in et1310_rx.c
In reply to Mark EinonTested on an ET-131x device.
--- drivers/staging/et131x/et1310_rx.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/et131x/et1310_rx.c +2 -2
@@ -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;
Signature · 1 line
1.7.4.4
PATCH 7/10 staging: et131x: Converting et1310_rx.h variable names from CamelCase
In reply to Mark EinonTested on an ET-131x device.
--- 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(-)
drivers/staging/et131x/et1310_rx.c +173 -165
@@ -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; }
drivers/staging/et131x/et1310_rx.h +31 -31
93 lines not on this page · raw message
drivers/staging/et131x/et131x_isr.c +1 -1
@@ -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);
Signature · 1 line
1.7.4.4
PATCH 8/10 staging: et131x: add et1310_ prefix to et1310_mac.c functions
In reply to Mark EinonMaking finger pointing that bit easier.
Tested on an ET-131x device.
--- 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(-)
drivers/staging/et131x/et1310_mac.c +16 -16
@@ -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;
drivers/staging/et131x/et1310_phy.c +2 -2
@@ -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); } } }
drivers/staging/et131x/et131x.h +10 -10
@@ -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 );
drivers/staging/et131x/et131x_initpci.c +5 -5
@@ -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);
drivers/staging/et131x/et131x_isr.c +1 -1
@@ -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 */
drivers/staging/et131x/et131x_netdev.c +2 -2
@@ -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 ; }
Signature · 1 line
1.7.4.4
PATCH 9/10 staging: et131x: Converting et1310_tx.c function and local names from CamelCase
In reply to Mark EinonAlso some minor code clean-ups.
Tested on an ET-131x device.
--- 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(-)
drivers/staging/et131x/et1310_tx.c +130 -138
@@ -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 */
drivers/staging/et131x/et131x.h +1 -1
@@ -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);
drivers/staging/et131x/et131x_initpci.c +1 -1
@@ -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);
Signature · 1 line
1.7.4.4
PATCH 10/10 staging: et131x: Converting et1310_adapter.h variable names from CamelCase
In reply to Mark EinonTested on an ET-131x device.
--- 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(-)
drivers/staging/et131x/et1310_mac.c +39 -38
@@ -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 ;
drivers/staging/et131x/et1310_phy.c +18 -18
@@ -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 );
drivers/staging/et131x/et1310_pm.c +4 -4
@@ -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);
drivers/staging/et131x/et1310_rx.c +32 -22
128 lines not on this page · raw message
drivers/staging/et131x/et1310_tx.c +22 -22
151 lines not on this page · raw message
drivers/staging/et131x/et131x_adapter.h +45 -46
159 lines not on this page · raw message
drivers/staging/et131x/et131x_initpci.c +26 -26
122 lines not on this page · raw message
drivers/staging/et131x/et131x_isr.c +5 -5
@@ -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);
drivers/staging/et131x/et131x_netdev.c +37 -34
175 lines not on this page · raw message
Signature · 1 line
1.7.4.4
Re: [PATCH 10/10] staging: et131x: Converting et1310_adapter.h variable names from CamelCase
Quoted 3 lines · Mark Einon
Tested on an ET-131x device.
Signed-off-by Mark Einon <[email protected]>
This patch didn't apply for some reason :(