提交 cee42951 编写于 作者: J Jakub Kicinski 提交者: David S. Miller

nfp: track link state changes

For caching link settings - remember if we have seen link events
since the last time the eth_port information was refreshed.
Signed-off-by: NJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: NSimon Horman <simon.horman@netronome.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 d12537df
...@@ -523,7 +523,8 @@ struct nfp_net_dp { ...@@ -523,7 +523,8 @@ struct nfp_net_dp {
* @reconfig_sync_present: Some thread is performing synchronous reconfig * @reconfig_sync_present: Some thread is performing synchronous reconfig
* @reconfig_timer: Timer for async reading of reconfig results * @reconfig_timer: Timer for async reading of reconfig results
* @link_up: Is the link up? * @link_up: Is the link up?
* @link_status_lock: Protects @link_up and ensures atomicity with BAR reading * @link_changed: Has link state changes since last port refresh?
* @link_status_lock: Protects @link_* and ensures atomicity with BAR reading
* @rx_coalesce_usecs: RX interrupt moderation usecs delay parameter * @rx_coalesce_usecs: RX interrupt moderation usecs delay parameter
* @rx_coalesce_max_frames: RX interrupt moderation frame count parameter * @rx_coalesce_max_frames: RX interrupt moderation frame count parameter
* @tx_coalesce_usecs: TX interrupt moderation usecs delay parameter * @tx_coalesce_usecs: TX interrupt moderation usecs delay parameter
...@@ -580,6 +581,7 @@ struct nfp_net { ...@@ -580,6 +581,7 @@ struct nfp_net {
u32 me_freq_mhz; u32 me_freq_mhz;
bool link_up; bool link_up;
bool link_changed;
spinlock_t link_status_lock; spinlock_t link_status_lock;
spinlock_t reconfig_lock; spinlock_t reconfig_lock;
...@@ -810,6 +812,8 @@ nfp_net_irqs_assign(struct nfp_net *nn, struct msix_entry *irq_entries, ...@@ -810,6 +812,8 @@ nfp_net_irqs_assign(struct nfp_net *nn, struct msix_entry *irq_entries,
struct nfp_net_dp *nfp_net_clone_dp(struct nfp_net *nn); struct nfp_net_dp *nfp_net_clone_dp(struct nfp_net *nn);
int nfp_net_ring_reconfig(struct nfp_net *nn, struct nfp_net_dp *new); int nfp_net_ring_reconfig(struct nfp_net *nn, struct nfp_net_dp *new);
bool nfp_net_link_changed_read_clear(struct nfp_net *nn);
#ifdef CONFIG_NFP_DEBUG #ifdef CONFIG_NFP_DEBUG
void nfp_net_debugfs_create(void); void nfp_net_debugfs_create(void);
void nfp_net_debugfs_destroy(void); void nfp_net_debugfs_destroy(void);
......
...@@ -376,6 +376,19 @@ static irqreturn_t nfp_net_irq_rxtx(int irq, void *data) ...@@ -376,6 +376,19 @@ static irqreturn_t nfp_net_irq_rxtx(int irq, void *data)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
bool nfp_net_link_changed_read_clear(struct nfp_net *nn)
{
unsigned long flags;
bool ret;
spin_lock_irqsave(&nn->link_status_lock, flags);
ret = nn->link_changed;
nn->link_changed = false;
spin_unlock_irqrestore(&nn->link_status_lock, flags);
return ret;
}
/** /**
* nfp_net_read_link_status() - Reread link status from control BAR * nfp_net_read_link_status() - Reread link status from control BAR
* @nn: NFP Network structure * @nn: NFP Network structure
...@@ -395,6 +408,7 @@ static void nfp_net_read_link_status(struct nfp_net *nn) ...@@ -395,6 +408,7 @@ static void nfp_net_read_link_status(struct nfp_net *nn)
goto out; goto out;
nn->link_up = link_up; nn->link_up = link_up;
nn->link_changed = true;
if (nn->link_up) { if (nn->link_up) {
netif_carrier_on(nn->dp.netdev); netif_carrier_on(nn->dp.netdev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册