Skip to content

Commit 10ce2c0

Browse files
aneftinJeff Kirsher
authored andcommitted
igc: Remove useless forward declaration
Move igc_phy_setup_autoneg, igc_wait_autoneg and igc_set_fc_watermarks up to avoid forward declaration. It is not necessary to forward declare these static methods. Signed-off-by: Sasha Neftin <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent dee2359 commit 10ce2c0

File tree

2 files changed

+129
-136
lines changed

2 files changed

+129
-136
lines changed

drivers/net/ethernet/intel/igc/igc_mac.c

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
#include "igc_mac.h"
88
#include "igc_hw.h"
99

10-
/* forward declaration */
11-
static s32 igc_set_fc_watermarks(struct igc_hw *hw);
12-
1310
/**
1411
* igc_disable_pcie_master - Disables PCI-express master access
1512
* @hw: pointer to the HW structure
@@ -74,6 +71,41 @@ void igc_init_rx_addrs(struct igc_hw *hw, u16 rar_count)
7471
hw->mac.ops.rar_set(hw, mac_addr, i);
7572
}
7673

74+
/**
75+
* igc_set_fc_watermarks - Set flow control high/low watermarks
76+
* @hw: pointer to the HW structure
77+
*
78+
* Sets the flow control high/low threshold (watermark) registers. If
79+
* flow control XON frame transmission is enabled, then set XON frame
80+
* transmission as well.
81+
*/
82+
static s32 igc_set_fc_watermarks(struct igc_hw *hw)
83+
{
84+
u32 fcrtl = 0, fcrth = 0;
85+
86+
/* Set the flow control receive threshold registers. Normally,
87+
* these registers will be set to a default threshold that may be
88+
* adjusted later by the driver's runtime code. However, if the
89+
* ability to transmit pause frames is not enabled, then these
90+
* registers will be set to 0.
91+
*/
92+
if (hw->fc.current_mode & igc_fc_tx_pause) {
93+
/* We need to set up the Receive Threshold high and low water
94+
* marks as well as (optionally) enabling the transmission of
95+
* XON frames.
96+
*/
97+
fcrtl = hw->fc.low_water;
98+
if (hw->fc.send_xon)
99+
fcrtl |= IGC_FCRTL_XONE;
100+
101+
fcrth = hw->fc.high_water;
102+
}
103+
wr32(IGC_FCRTL, fcrtl);
104+
wr32(IGC_FCRTH, fcrth);
105+
106+
return 0;
107+
}
108+
77109
/**
78110
* igc_setup_link - Setup flow control and link settings
79111
* @hw: pointer to the HW structure
@@ -194,41 +226,6 @@ s32 igc_force_mac_fc(struct igc_hw *hw)
194226
return ret_val;
195227
}
196228

197-
/**
198-
* igc_set_fc_watermarks - Set flow control high/low watermarks
199-
* @hw: pointer to the HW structure
200-
*
201-
* Sets the flow control high/low threshold (watermark) registers. If
202-
* flow control XON frame transmission is enabled, then set XON frame
203-
* transmission as well.
204-
*/
205-
static s32 igc_set_fc_watermarks(struct igc_hw *hw)
206-
{
207-
u32 fcrtl = 0, fcrth = 0;
208-
209-
/* Set the flow control receive threshold registers. Normally,
210-
* these registers will be set to a default threshold that may be
211-
* adjusted later by the driver's runtime code. However, if the
212-
* ability to transmit pause frames is not enabled, then these
213-
* registers will be set to 0.
214-
*/
215-
if (hw->fc.current_mode & igc_fc_tx_pause) {
216-
/* We need to set up the Receive Threshold high and low water
217-
* marks as well as (optionally) enabling the transmission of
218-
* XON frames.
219-
*/
220-
fcrtl = hw->fc.low_water;
221-
if (hw->fc.send_xon)
222-
fcrtl |= IGC_FCRTL_XONE;
223-
224-
fcrth = hw->fc.high_water;
225-
}
226-
wr32(IGC_FCRTL, fcrtl);
227-
wr32(IGC_FCRTH, fcrth);
228-
229-
return 0;
230-
}
231-
232229
/**
233230
* igc_clear_hw_cntrs_base - Clear base hardware counters
234231
* @hw: pointer to the HW structure

drivers/net/ethernet/intel/igc/igc_phy.c

Lines changed: 94 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33

44
#include "igc_phy.h"
55

6-
/* forward declaration */
7-
static s32 igc_phy_setup_autoneg(struct igc_hw *hw);
8-
static s32 igc_wait_autoneg(struct igc_hw *hw);
9-
106
/**
117
* igc_check_reset_block - Check if PHY reset is blocked
128
* @hw: pointer to the HW structure
@@ -207,100 +203,6 @@ s32 igc_phy_hw_reset(struct igc_hw *hw)
207203
return ret_val;
208204
}
209205

210-
/**
211-
* igc_copper_link_autoneg - Setup/Enable autoneg for copper link
212-
* @hw: pointer to the HW structure
213-
*
214-
* Performs initial bounds checking on autoneg advertisement parameter, then
215-
* configure to advertise the full capability. Setup the PHY to autoneg
216-
* and restart the negotiation process between the link partner. If
217-
* autoneg_wait_to_complete, then wait for autoneg to complete before exiting.
218-
*/
219-
static s32 igc_copper_link_autoneg(struct igc_hw *hw)
220-
{
221-
struct igc_phy_info *phy = &hw->phy;
222-
u16 phy_ctrl;
223-
s32 ret_val;
224-
225-
/* Perform some bounds checking on the autoneg advertisement
226-
* parameter.
227-
*/
228-
phy->autoneg_advertised &= phy->autoneg_mask;
229-
230-
/* If autoneg_advertised is zero, we assume it was not defaulted
231-
* by the calling code so we set to advertise full capability.
232-
*/
233-
if (phy->autoneg_advertised == 0)
234-
phy->autoneg_advertised = phy->autoneg_mask;
235-
236-
hw_dbg("Reconfiguring auto-neg advertisement params\n");
237-
ret_val = igc_phy_setup_autoneg(hw);
238-
if (ret_val) {
239-
hw_dbg("Error Setting up Auto-Negotiation\n");
240-
goto out;
241-
}
242-
hw_dbg("Restarting Auto-Neg\n");
243-
244-
/* Restart auto-negotiation by setting the Auto Neg Enable bit and
245-
* the Auto Neg Restart bit in the PHY control register.
246-
*/
247-
ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_ctrl);
248-
if (ret_val)
249-
goto out;
250-
251-
phy_ctrl |= (MII_CR_AUTO_NEG_EN | MII_CR_RESTART_AUTO_NEG);
252-
ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_ctrl);
253-
if (ret_val)
254-
goto out;
255-
256-
/* Does the user want to wait for Auto-Neg to complete here, or
257-
* check at a later time (for example, callback routine).
258-
*/
259-
if (phy->autoneg_wait_to_complete) {
260-
ret_val = igc_wait_autoneg(hw);
261-
if (ret_val) {
262-
hw_dbg("Error while waiting for autoneg to complete\n");
263-
goto out;
264-
}
265-
}
266-
267-
hw->mac.get_link_status = true;
268-
269-
out:
270-
return ret_val;
271-
}
272-
273-
/**
274-
* igc_wait_autoneg - Wait for auto-neg completion
275-
* @hw: pointer to the HW structure
276-
*
277-
* Waits for auto-negotiation to complete or for the auto-negotiation time
278-
* limit to expire, which ever happens first.
279-
*/
280-
static s32 igc_wait_autoneg(struct igc_hw *hw)
281-
{
282-
u16 i, phy_status;
283-
s32 ret_val = 0;
284-
285-
/* Break after autoneg completes or PHY_AUTO_NEG_LIMIT expires. */
286-
for (i = PHY_AUTO_NEG_LIMIT; i > 0; i--) {
287-
ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status);
288-
if (ret_val)
289-
break;
290-
ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status);
291-
if (ret_val)
292-
break;
293-
if (phy_status & MII_SR_AUTONEG_COMPLETE)
294-
break;
295-
msleep(100);
296-
}
297-
298-
/* PHY_AUTO_NEG_TIME expiration doesn't guarantee auto-negotiation
299-
* has completed.
300-
*/
301-
return ret_val;
302-
}
303-
304206
/**
305207
* igc_phy_setup_autoneg - Configure PHY for auto-negotiation
306208
* @hw: pointer to the HW structure
@@ -485,6 +387,100 @@ static s32 igc_phy_setup_autoneg(struct igc_hw *hw)
485387
return ret_val;
486388
}
487389

390+
/**
391+
* igc_wait_autoneg - Wait for auto-neg completion
392+
* @hw: pointer to the HW structure
393+
*
394+
* Waits for auto-negotiation to complete or for the auto-negotiation time
395+
* limit to expire, which ever happens first.
396+
*/
397+
static s32 igc_wait_autoneg(struct igc_hw *hw)
398+
{
399+
u16 i, phy_status;
400+
s32 ret_val = 0;
401+
402+
/* Break after autoneg completes or PHY_AUTO_NEG_LIMIT expires. */
403+
for (i = PHY_AUTO_NEG_LIMIT; i > 0; i--) {
404+
ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status);
405+
if (ret_val)
406+
break;
407+
ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status);
408+
if (ret_val)
409+
break;
410+
if (phy_status & MII_SR_AUTONEG_COMPLETE)
411+
break;
412+
msleep(100);
413+
}
414+
415+
/* PHY_AUTO_NEG_TIME expiration doesn't guarantee auto-negotiation
416+
* has completed.
417+
*/
418+
return ret_val;
419+
}
420+
421+
/**
422+
* igc_copper_link_autoneg - Setup/Enable autoneg for copper link
423+
* @hw: pointer to the HW structure
424+
*
425+
* Performs initial bounds checking on autoneg advertisement parameter, then
426+
* configure to advertise the full capability. Setup the PHY to autoneg
427+
* and restart the negotiation process between the link partner. If
428+
* autoneg_wait_to_complete, then wait for autoneg to complete before exiting.
429+
*/
430+
static s32 igc_copper_link_autoneg(struct igc_hw *hw)
431+
{
432+
struct igc_phy_info *phy = &hw->phy;
433+
u16 phy_ctrl;
434+
s32 ret_val;
435+
436+
/* Perform some bounds checking on the autoneg advertisement
437+
* parameter.
438+
*/
439+
phy->autoneg_advertised &= phy->autoneg_mask;
440+
441+
/* If autoneg_advertised is zero, we assume it was not defaulted
442+
* by the calling code so we set to advertise full capability.
443+
*/
444+
if (phy->autoneg_advertised == 0)
445+
phy->autoneg_advertised = phy->autoneg_mask;
446+
447+
hw_dbg("Reconfiguring auto-neg advertisement params\n");
448+
ret_val = igc_phy_setup_autoneg(hw);
449+
if (ret_val) {
450+
hw_dbg("Error Setting up Auto-Negotiation\n");
451+
goto out;
452+
}
453+
hw_dbg("Restarting Auto-Neg\n");
454+
455+
/* Restart auto-negotiation by setting the Auto Neg Enable bit and
456+
* the Auto Neg Restart bit in the PHY control register.
457+
*/
458+
ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_ctrl);
459+
if (ret_val)
460+
goto out;
461+
462+
phy_ctrl |= (MII_CR_AUTO_NEG_EN | MII_CR_RESTART_AUTO_NEG);
463+
ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_ctrl);
464+
if (ret_val)
465+
goto out;
466+
467+
/* Does the user want to wait for Auto-Neg to complete here, or
468+
* check at a later time (for example, callback routine).
469+
*/
470+
if (phy->autoneg_wait_to_complete) {
471+
ret_val = igc_wait_autoneg(hw);
472+
if (ret_val) {
473+
hw_dbg("Error while waiting for autoneg to complete\n");
474+
goto out;
475+
}
476+
}
477+
478+
hw->mac.get_link_status = true;
479+
480+
out:
481+
return ret_val;
482+
}
483+
488484
/**
489485
* igc_setup_copper_link - Configure copper link settings
490486
* @hw: pointer to the HW structure

0 commit comments

Comments
 (0)