mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-25 13:43:55 +08:00
Merge branch 'ionic-queue-mgmt'
Shannon Nelson says: ==================== ionic: queue mgmt updates The first pair of patches help smooth the driver's response when the firmware has gone through a recovery/reboot cycle. The next four patches take care of a couple things seen when changing the interface status. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
c77225119d
@ -93,10 +93,17 @@ static void ionic_lif_deferred_work(struct work_struct *work)
|
|||||||
ionic_link_status_check(lif);
|
ionic_link_status_check(lif);
|
||||||
break;
|
break;
|
||||||
case IONIC_DW_TYPE_LIF_RESET:
|
case IONIC_DW_TYPE_LIF_RESET:
|
||||||
if (w->fw_status)
|
if (w->fw_status) {
|
||||||
ionic_lif_handle_fw_up(lif);
|
ionic_lif_handle_fw_up(lif);
|
||||||
else
|
} else {
|
||||||
ionic_lif_handle_fw_down(lif);
|
ionic_lif_handle_fw_down(lif);
|
||||||
|
|
||||||
|
/* Fire off another watchdog to see
|
||||||
|
* if the FW is already back rather than
|
||||||
|
* waiting another whole cycle
|
||||||
|
*/
|
||||||
|
mod_timer(&lif->ionic->watchdog_timer, jiffies + 1);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -842,10 +849,8 @@ int ionic_lif_create_hwstamp_txq(struct ionic_lif *lif)
|
|||||||
u64 features;
|
u64 features;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
mutex_lock(&lif->queue_lock);
|
|
||||||
|
|
||||||
if (lif->hwstamp_txq)
|
if (lif->hwstamp_txq)
|
||||||
goto out;
|
return 0;
|
||||||
|
|
||||||
features = IONIC_Q_F_2X_CQ_DESC | IONIC_TXQ_F_HWSTAMP;
|
features = IONIC_Q_F_2X_CQ_DESC | IONIC_TXQ_F_HWSTAMP;
|
||||||
|
|
||||||
@ -887,9 +892,6 @@ int ionic_lif_create_hwstamp_txq(struct ionic_lif *lif)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
|
||||||
mutex_unlock(&lif->queue_lock);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_qcq_enable:
|
err_qcq_enable:
|
||||||
@ -900,7 +902,6 @@ err_qcq_init:
|
|||||||
ionic_qcq_free(lif, txq);
|
ionic_qcq_free(lif, txq);
|
||||||
devm_kfree(lif->ionic->dev, txq);
|
devm_kfree(lif->ionic->dev, txq);
|
||||||
err_qcq_alloc:
|
err_qcq_alloc:
|
||||||
mutex_unlock(&lif->queue_lock);
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -912,10 +913,8 @@ int ionic_lif_create_hwstamp_rxq(struct ionic_lif *lif)
|
|||||||
u64 features;
|
u64 features;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
mutex_lock(&lif->queue_lock);
|
|
||||||
|
|
||||||
if (lif->hwstamp_rxq)
|
if (lif->hwstamp_rxq)
|
||||||
goto out;
|
return 0;
|
||||||
|
|
||||||
features = IONIC_Q_F_2X_CQ_DESC | IONIC_RXQ_F_HWSTAMP;
|
features = IONIC_Q_F_2X_CQ_DESC | IONIC_RXQ_F_HWSTAMP;
|
||||||
|
|
||||||
@ -953,9 +952,6 @@ int ionic_lif_create_hwstamp_rxq(struct ionic_lif *lif)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
|
||||||
mutex_unlock(&lif->queue_lock);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_qcq_enable:
|
err_qcq_enable:
|
||||||
@ -966,7 +962,6 @@ err_qcq_init:
|
|||||||
ionic_qcq_free(lif, rxq);
|
ionic_qcq_free(lif, rxq);
|
||||||
devm_kfree(lif->ionic->dev, rxq);
|
devm_kfree(lif->ionic->dev, rxq);
|
||||||
err_qcq_alloc:
|
err_qcq_alloc:
|
||||||
mutex_unlock(&lif->queue_lock);
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1261,6 +1256,8 @@ int ionic_lif_addr_add(struct ionic_lif *lif, const u8 *addr)
|
|||||||
struct ionic_rx_filter *f;
|
struct ionic_rx_filter *f;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
|
memcpy(ctx.cmd.rx_filter_add.mac.addr, addr, ETH_ALEN);
|
||||||
|
|
||||||
spin_lock_bh(&lif->rx_filters.lock);
|
spin_lock_bh(&lif->rx_filters.lock);
|
||||||
f = ionic_rx_filter_by_addr(lif, addr);
|
f = ionic_rx_filter_by_addr(lif, addr);
|
||||||
if (f) {
|
if (f) {
|
||||||
@ -1274,7 +1271,6 @@ int ionic_lif_addr_add(struct ionic_lif *lif, const u8 *addr)
|
|||||||
f->state = IONIC_FILTER_STATE_SYNCED;
|
f->state = IONIC_FILTER_STATE_SYNCED;
|
||||||
} else {
|
} else {
|
||||||
/* save as SYNCED to catch any DEL requests while processing */
|
/* save as SYNCED to catch any DEL requests while processing */
|
||||||
memcpy(ctx.cmd.rx_filter_add.mac.addr, addr, ETH_ALEN);
|
|
||||||
err = ionic_rx_filter_save(lif, 0, IONIC_RXQ_INDEX_ANY, 0, &ctx,
|
err = ionic_rx_filter_save(lif, 0, IONIC_RXQ_INDEX_ANY, 0, &ctx,
|
||||||
IONIC_FILTER_STATE_SYNCED);
|
IONIC_FILTER_STATE_SYNCED);
|
||||||
}
|
}
|
||||||
@ -2225,9 +2221,11 @@ static int ionic_open(struct net_device *netdev)
|
|||||||
if (test_and_clear_bit(IONIC_LIF_F_BROKEN, lif->state))
|
if (test_and_clear_bit(IONIC_LIF_F_BROKEN, lif->state))
|
||||||
netdev_info(netdev, "clearing broken state\n");
|
netdev_info(netdev, "clearing broken state\n");
|
||||||
|
|
||||||
|
mutex_lock(&lif->queue_lock);
|
||||||
|
|
||||||
err = ionic_txrx_alloc(lif);
|
err = ionic_txrx_alloc(lif);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
goto err_unlock;
|
||||||
|
|
||||||
err = ionic_txrx_init(lif);
|
err = ionic_txrx_init(lif);
|
||||||
if (err)
|
if (err)
|
||||||
@ -2248,12 +2246,21 @@ static int ionic_open(struct net_device *netdev)
|
|||||||
goto err_txrx_deinit;
|
goto err_txrx_deinit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If hardware timestamping is enabled, but the queues were freed by
|
||||||
|
* ionic_stop, those need to be reallocated and initialized, too.
|
||||||
|
*/
|
||||||
|
ionic_lif_hwstamp_recreate_queues(lif);
|
||||||
|
|
||||||
|
mutex_unlock(&lif->queue_lock);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_txrx_deinit:
|
err_txrx_deinit:
|
||||||
ionic_txrx_deinit(lif);
|
ionic_txrx_deinit(lif);
|
||||||
err_txrx_free:
|
err_txrx_free:
|
||||||
ionic_txrx_free(lif);
|
ionic_txrx_free(lif);
|
||||||
|
err_unlock:
|
||||||
|
mutex_unlock(&lif->queue_lock);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2273,9 +2280,11 @@ static int ionic_stop(struct net_device *netdev)
|
|||||||
if (test_bit(IONIC_LIF_F_FW_RESET, lif->state))
|
if (test_bit(IONIC_LIF_F_FW_RESET, lif->state))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
mutex_lock(&lif->queue_lock);
|
||||||
ionic_stop_queues(lif);
|
ionic_stop_queues(lif);
|
||||||
ionic_txrx_deinit(lif);
|
ionic_txrx_deinit(lif);
|
||||||
ionic_txrx_free(lif);
|
ionic_txrx_free(lif);
|
||||||
|
mutex_unlock(&lif->queue_lock);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -306,6 +306,7 @@ int ionic_lif_size(struct ionic *ionic);
|
|||||||
|
|
||||||
#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
|
#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
|
||||||
void ionic_lif_hwstamp_replay(struct ionic_lif *lif);
|
void ionic_lif_hwstamp_replay(struct ionic_lif *lif);
|
||||||
|
void ionic_lif_hwstamp_recreate_queues(struct ionic_lif *lif);
|
||||||
int ionic_lif_hwstamp_set(struct ionic_lif *lif, struct ifreq *ifr);
|
int ionic_lif_hwstamp_set(struct ionic_lif *lif, struct ifreq *ifr);
|
||||||
int ionic_lif_hwstamp_get(struct ionic_lif *lif, struct ifreq *ifr);
|
int ionic_lif_hwstamp_get(struct ionic_lif *lif, struct ifreq *ifr);
|
||||||
ktime_t ionic_lif_phc_ktime(struct ionic_lif *lif, u64 counter);
|
ktime_t ionic_lif_phc_ktime(struct ionic_lif *lif, u64 counter);
|
||||||
@ -315,6 +316,7 @@ void ionic_lif_alloc_phc(struct ionic_lif *lif);
|
|||||||
void ionic_lif_free_phc(struct ionic_lif *lif);
|
void ionic_lif_free_phc(struct ionic_lif *lif);
|
||||||
#else
|
#else
|
||||||
static inline void ionic_lif_hwstamp_replay(struct ionic_lif *lif) {}
|
static inline void ionic_lif_hwstamp_replay(struct ionic_lif *lif) {}
|
||||||
|
static inline void ionic_lif_hwstamp_recreate_queues(struct ionic_lif *lif) {}
|
||||||
|
|
||||||
static inline int ionic_lif_hwstamp_set(struct ionic_lif *lif, struct ifreq *ifr)
|
static inline int ionic_lif_hwstamp_set(struct ionic_lif *lif, struct ifreq *ifr)
|
||||||
{
|
{
|
||||||
|
@ -375,8 +375,8 @@ try_again:
|
|||||||
* heartbeat check but is still alive and will process this
|
* heartbeat check but is still alive and will process this
|
||||||
* request, so don't clean the dev_cmd in this case.
|
* request, so don't clean the dev_cmd in this case.
|
||||||
*/
|
*/
|
||||||
dev_warn(ionic->dev, "DEVCMD %s (%d) failed - FW halted\n",
|
dev_dbg(ionic->dev, "DEVCMD %s (%d) failed - FW halted\n",
|
||||||
ionic_opcode_to_str(opcode), opcode);
|
ionic_opcode_to_str(opcode), opcode);
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,9 @@ int ionic_lif_hwstamp_set(struct ionic_lif *lif, struct ifreq *ifr)
|
|||||||
if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
|
if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
|
mutex_lock(&lif->queue_lock);
|
||||||
err = ionic_lif_hwstamp_set_ts_config(lif, &config);
|
err = ionic_lif_hwstamp_set_ts_config(lif, &config);
|
||||||
|
mutex_unlock(&lif->queue_lock);
|
||||||
if (err) {
|
if (err) {
|
||||||
netdev_info(lif->netdev, "hwstamp set failed: %d\n", err);
|
netdev_info(lif->netdev, "hwstamp set failed: %d\n", err);
|
||||||
return err;
|
return err;
|
||||||
@ -213,11 +215,37 @@ void ionic_lif_hwstamp_replay(struct ionic_lif *lif)
|
|||||||
if (!lif->phc || !lif->phc->ptp)
|
if (!lif->phc || !lif->phc->ptp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
mutex_lock(&lif->queue_lock);
|
||||||
err = ionic_lif_hwstamp_set_ts_config(lif, NULL);
|
err = ionic_lif_hwstamp_set_ts_config(lif, NULL);
|
||||||
|
mutex_unlock(&lif->queue_lock);
|
||||||
if (err)
|
if (err)
|
||||||
netdev_info(lif->netdev, "hwstamp replay failed: %d\n", err);
|
netdev_info(lif->netdev, "hwstamp replay failed: %d\n", err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ionic_lif_hwstamp_recreate_queues(struct ionic_lif *lif)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
if (!lif->phc || !lif->phc->ptp)
|
||||||
|
return;
|
||||||
|
|
||||||
|
mutex_lock(&lif->phc->config_lock);
|
||||||
|
|
||||||
|
if (lif->phc->ts_config_tx_mode) {
|
||||||
|
err = ionic_lif_create_hwstamp_txq(lif);
|
||||||
|
if (err)
|
||||||
|
netdev_info(lif->netdev, "hwstamp recreate txq failed: %d\n", err);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lif->phc->ts_config_rx_filt) {
|
||||||
|
err = ionic_lif_create_hwstamp_rxq(lif);
|
||||||
|
if (err)
|
||||||
|
netdev_info(lif->netdev, "hwstamp recreate rxq failed: %d\n", err);
|
||||||
|
}
|
||||||
|
|
||||||
|
mutex_unlock(&lif->phc->config_lock);
|
||||||
|
}
|
||||||
|
|
||||||
int ionic_lif_hwstamp_get(struct ionic_lif *lif, struct ifreq *ifr)
|
int ionic_lif_hwstamp_get(struct ionic_lif *lif, struct ifreq *ifr)
|
||||||
{
|
{
|
||||||
struct hwtstamp_config config;
|
struct hwtstamp_config config;
|
||||||
|
Loading…
Reference in New Issue
Block a user