Commit c7722511 authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents 4af874f4 ccbbd002
......@@ -93,10 +93,17 @@ static void ionic_lif_deferred_work(struct work_struct *work)
ionic_link_status_check(lif);
break;
case IONIC_DW_TYPE_LIF_RESET:
if (w->fw_status)
if (w->fw_status) {
ionic_lif_handle_fw_up(lif);
else
} else {
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;
default:
break;
......@@ -842,10 +849,8 @@ int ionic_lif_create_hwstamp_txq(struct ionic_lif *lif)
u64 features;
int err;
mutex_lock(&lif->queue_lock);
if (lif->hwstamp_txq)
goto out;
return 0;
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;
err_qcq_enable:
......@@ -900,7 +902,6 @@ int ionic_lif_create_hwstamp_txq(struct ionic_lif *lif)
ionic_qcq_free(lif, txq);
devm_kfree(lif->ionic->dev, txq);
err_qcq_alloc:
mutex_unlock(&lif->queue_lock);
return err;
}
......@@ -912,10 +913,8 @@ int ionic_lif_create_hwstamp_rxq(struct ionic_lif *lif)
u64 features;
int err;
mutex_lock(&lif->queue_lock);
if (lif->hwstamp_rxq)
goto out;
return 0;
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;
err_qcq_enable:
......@@ -966,7 +962,6 @@ int ionic_lif_create_hwstamp_rxq(struct ionic_lif *lif)
ionic_qcq_free(lif, rxq);
devm_kfree(lif->ionic->dev, rxq);
err_qcq_alloc:
mutex_unlock(&lif->queue_lock);
return err;
}
......@@ -1261,6 +1256,8 @@ int ionic_lif_addr_add(struct ionic_lif *lif, const u8 *addr)
struct ionic_rx_filter *f;
int err = 0;
memcpy(ctx.cmd.rx_filter_add.mac.addr, addr, ETH_ALEN);
spin_lock_bh(&lif->rx_filters.lock);
f = ionic_rx_filter_by_addr(lif, addr);
if (f) {
......@@ -1274,7 +1271,6 @@ int ionic_lif_addr_add(struct ionic_lif *lif, const u8 *addr)
f->state = IONIC_FILTER_STATE_SYNCED;
} else {
/* 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,
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))
netdev_info(netdev, "clearing broken state\n");
mutex_lock(&lif->queue_lock);
err = ionic_txrx_alloc(lif);
if (err)
return err;
goto err_unlock;
err = ionic_txrx_init(lif);
if (err)
......@@ -2248,12 +2246,21 @@ static int ionic_open(struct net_device *netdev)
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;
err_txrx_deinit:
ionic_txrx_deinit(lif);
err_txrx_free:
ionic_txrx_free(lif);
err_unlock:
mutex_unlock(&lif->queue_lock);
return err;
}
......@@ -2273,9 +2280,11 @@ static int ionic_stop(struct net_device *netdev)
if (test_bit(IONIC_LIF_F_FW_RESET, lif->state))
return 0;
mutex_lock(&lif->queue_lock);
ionic_stop_queues(lif);
ionic_txrx_deinit(lif);
ionic_txrx_free(lif);
mutex_unlock(&lif->queue_lock);
return 0;
}
......
......@@ -306,6 +306,7 @@ int ionic_lif_size(struct ionic *ionic);
#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
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_get(struct ionic_lif *lif, struct ifreq *ifr);
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);
#else
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)
{
......
......@@ -375,8 +375,8 @@ int ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_seconds)
* heartbeat check but is still alive and will process this
* request, so don't clean the dev_cmd in this case.
*/
dev_warn(ionic->dev, "DEVCMD %s (%d) failed - FW halted\n",
ionic_opcode_to_str(opcode), opcode);
dev_dbg(ionic->dev, "DEVCMD %s (%d) failed - FW halted\n",
ionic_opcode_to_str(opcode), opcode);
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)))
return -EFAULT;
mutex_lock(&lif->queue_lock);
err = ionic_lif_hwstamp_set_ts_config(lif, &config);
mutex_unlock(&lif->queue_lock);
if (err) {
netdev_info(lif->netdev, "hwstamp set failed: %d\n", err);
return err;
......@@ -213,11 +215,37 @@ void ionic_lif_hwstamp_replay(struct ionic_lif *lif)
if (!lif->phc || !lif->phc->ptp)
return;
mutex_lock(&lif->queue_lock);
err = ionic_lif_hwstamp_set_ts_config(lif, NULL);
mutex_unlock(&lif->queue_lock);
if (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)
{
struct hwtstamp_config config;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment