net/ngbe: support link down/up
Add support to set device link down/up. Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
This commit is contained in:
parent
7fa2495bdd
commit
abea8974c7
@ -55,6 +55,10 @@ New Features
|
||||
Also, make sure to start the actual text at the margin.
|
||||
=======================================================
|
||||
|
||||
* **Updated Wangxun ngbe driver.**
|
||||
|
||||
* Added support to set device link down/up.
|
||||
|
||||
|
||||
Removed Items
|
||||
-------------
|
||||
|
@ -400,6 +400,7 @@ s32 ngbe_init_phy(struct ngbe_hw *hw)
|
||||
hw->phy.init_hw = ngbe_init_phy_rtl;
|
||||
hw->phy.check_link = ngbe_check_phy_link_rtl;
|
||||
hw->phy.setup_link = ngbe_setup_phy_link_rtl;
|
||||
hw->phy.set_phy_power = ngbe_set_phy_power_rtl;
|
||||
hw->phy.get_adv_pause = ngbe_get_phy_advertised_pause_rtl;
|
||||
hw->phy.get_lp_adv_pause = ngbe_get_phy_lp_advertised_pause_rtl;
|
||||
hw->phy.set_pause_adv = ngbe_set_phy_pause_adv_rtl;
|
||||
|
@ -393,3 +393,16 @@ s32 ngbe_check_phy_link_rtl(struct ngbe_hw *hw, u32 *speed, bool *link_up)
|
||||
return status;
|
||||
}
|
||||
|
||||
s32 ngbe_set_phy_power_rtl(struct ngbe_hw *hw, bool on)
|
||||
{
|
||||
u16 value = 0;
|
||||
|
||||
hw->phy.read_reg(hw, RTL_BMCR, 0, &value);
|
||||
if (on)
|
||||
value &= ~RTL_BMCR_PWDN;
|
||||
else
|
||||
value |= RTL_BMCR_PWDN;
|
||||
hw->phy.write_reg(hw, RTL_BMCR, 0, value);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
#define RTL_BMCR_RESET MS16(15, 0x1)
|
||||
#define RTL_BMCR_SPEED_SELECT0 MS16(13, 0x1)
|
||||
#define RTL_BMCR_ANE MS16(12, 0x1)
|
||||
#define RTL_BMCR_PWDN MS16(11, 0x1)
|
||||
#define RTL_BMCR_RESTART_AN MS16(9, 0x1)
|
||||
#define RTL_BMCR_DUPLEX MS16(8, 0x1)
|
||||
#define RTL_BMCR_SPEED_SELECT1 MS16(6, 0x1)
|
||||
@ -88,5 +89,6 @@ s32 ngbe_get_phy_lp_advertised_pause_rtl(struct ngbe_hw *hw, u8 *pause_bit);
|
||||
s32 ngbe_set_phy_pause_adv_rtl(struct ngbe_hw *hw, u16 pause_bit);
|
||||
s32 ngbe_check_phy_link_rtl(struct ngbe_hw *hw,
|
||||
u32 *speed, bool *link_up);
|
||||
s32 ngbe_set_phy_power_rtl(struct ngbe_hw *hw, bool on);
|
||||
|
||||
#endif /* _NGBE_PHY_RTL_H_ */
|
||||
|
@ -1219,6 +1219,32 @@ ngbe_dev_stop(struct rte_eth_dev *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set device link up: power on.
|
||||
*/
|
||||
static int
|
||||
ngbe_dev_set_link_up(struct rte_eth_dev *dev)
|
||||
{
|
||||
struct ngbe_hw *hw = ngbe_dev_hw(dev);
|
||||
|
||||
hw->phy.set_phy_power(hw, true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set device link down: power off.
|
||||
*/
|
||||
static int
|
||||
ngbe_dev_set_link_down(struct rte_eth_dev *dev)
|
||||
{
|
||||
struct ngbe_hw *hw = ngbe_dev_hw(dev);
|
||||
|
||||
hw->phy.set_phy_power(hw, false);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset and stop device.
|
||||
*/
|
||||
@ -3030,6 +3056,8 @@ static const struct eth_dev_ops ngbe_eth_dev_ops = {
|
||||
.dev_infos_get = ngbe_dev_info_get,
|
||||
.dev_start = ngbe_dev_start,
|
||||
.dev_stop = ngbe_dev_stop,
|
||||
.dev_set_link_up = ngbe_dev_set_link_up,
|
||||
.dev_set_link_down = ngbe_dev_set_link_down,
|
||||
.dev_close = ngbe_dev_close,
|
||||
.dev_reset = ngbe_dev_reset,
|
||||
.promiscuous_enable = ngbe_dev_promiscuous_enable,
|
||||
|
Loading…
Reference in New Issue
Block a user