mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
net: ngbe: implement libwx reset ops
Implement wx->do_reset() for library module calling. Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com> Reviewed-by: Larysa Zaremba <larysa.zaremba@intel.com> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Reviewed-by: Breno Leitao <leitao@debian.org> Link: https://patch.msgid.link/20260803064334.21876-2-jiawenwu@trustnetic.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
d6f97dd88b
commit
7d942a7bd9
|
|
@ -59,7 +59,6 @@ static int ngbe_set_ringparam(struct net_device *netdev,
|
|||
wx_set_ring(wx, new_tx_count, new_rx_count, temp_ring);
|
||||
kvfree(temp_ring);
|
||||
|
||||
wx_configure(wx);
|
||||
ngbe_up(wx);
|
||||
|
||||
clear_reset:
|
||||
|
|
|
|||
|
|
@ -133,6 +133,7 @@ static int ngbe_sw_init(struct wx *wx)
|
|||
|
||||
wx->mbx.size = WX_VXMAILBOX_SIZE;
|
||||
wx->setup_tc = ngbe_setup_tc;
|
||||
wx->do_reset = ngbe_do_reset;
|
||||
set_bit(0, &wx->fwd_bitmask);
|
||||
|
||||
return 0;
|
||||
|
|
@ -423,7 +424,7 @@ void ngbe_down(struct wx *wx)
|
|||
wx_clean_all_rx_rings(wx);
|
||||
}
|
||||
|
||||
void ngbe_up(struct wx *wx)
|
||||
static void ngbe_up_complete(struct wx *wx)
|
||||
{
|
||||
wx_configure_vectors(wx);
|
||||
|
||||
|
|
@ -490,7 +491,7 @@ static int ngbe_open(struct net_device *netdev)
|
|||
|
||||
wx_ptp_init(wx);
|
||||
|
||||
ngbe_up(wx);
|
||||
ngbe_up_complete(wx);
|
||||
|
||||
return 0;
|
||||
err_dis_phy:
|
||||
|
|
@ -503,6 +504,12 @@ static int ngbe_open(struct net_device *netdev)
|
|||
return err;
|
||||
}
|
||||
|
||||
void ngbe_up(struct wx *wx)
|
||||
{
|
||||
wx_configure(wx);
|
||||
ngbe_up_complete(wx);
|
||||
}
|
||||
|
||||
/**
|
||||
* ngbe_close - Disables a network interface
|
||||
* @netdev: network interface device structure
|
||||
|
|
@ -590,6 +597,8 @@ int ngbe_setup_tc(struct net_device *dev, u8 tc)
|
|||
*/
|
||||
if (netif_running(dev))
|
||||
ngbe_close(dev);
|
||||
else
|
||||
ngbe_reset(wx);
|
||||
|
||||
wx_clear_interrupt_scheme(wx);
|
||||
|
||||
|
|
@ -606,6 +615,30 @@ int ngbe_setup_tc(struct net_device *dev, u8 tc)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void ngbe_reinit_locked(struct wx *wx)
|
||||
{
|
||||
netif_trans_update(wx->netdev);
|
||||
|
||||
mutex_lock(&wx->reset_lock);
|
||||
set_bit(WX_STATE_RESETTING, wx->state);
|
||||
|
||||
ngbe_down(wx);
|
||||
ngbe_up(wx);
|
||||
|
||||
clear_bit(WX_STATE_RESETTING, wx->state);
|
||||
mutex_unlock(&wx->reset_lock);
|
||||
}
|
||||
|
||||
void ngbe_do_reset(struct net_device *netdev)
|
||||
{
|
||||
struct wx *wx = netdev_priv(netdev);
|
||||
|
||||
if (netif_running(netdev))
|
||||
ngbe_reinit_locked(wx);
|
||||
else
|
||||
ngbe_reset(wx);
|
||||
}
|
||||
|
||||
static const struct net_device_ops ngbe_netdev_ops = {
|
||||
.ndo_open = ngbe_open,
|
||||
.ndo_stop = ngbe_close,
|
||||
|
|
|
|||
|
|
@ -125,5 +125,6 @@ extern char ngbe_driver_name[];
|
|||
void ngbe_down(struct wx *wx);
|
||||
void ngbe_up(struct wx *wx);
|
||||
int ngbe_setup_tc(struct net_device *dev, u8 tc);
|
||||
void ngbe_do_reset(struct net_device *netdev);
|
||||
|
||||
#endif /* _NGBE_TYPE_H_ */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user