Commit 2f21be44 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'ionic-next'



Shannon Nelson says:

====================
ionic: driver updates 27-July-2021

This is a collection of small driver updates for adding a couple of
small features and for a bit of code cleaning.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 7c57706b 18d64264
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -165,10 +165,10 @@ static int ionic_vf_alloc(struct ionic *ionic, int num_vfs)
			goto out;
		}

		ionic->num_vfs++;
		/* ignore failures from older FW, we just won't get stats */
		(void)ionic_set_vf_config(ionic, i, IONIC_VF_ATTR_STATSADDR,
					  (u8 *)&v->stats_pa);
		ionic->num_vfs++;
	}

out:
+26 −2
Original line number Diff line number Diff line
@@ -106,6 +106,8 @@ int ionic_dev_setup(struct ionic *ionic)
	idev->last_fw_hb = 0;
	idev->fw_hb_ready = true;
	idev->fw_status_ready = true;
	idev->fw_generation = IONIC_FW_STS_F_GENERATION &
			      ioread8(&idev->dev_info_regs->fw_status);

	mod_timer(&ionic->watchdog_timer,
		  round_jiffies(jiffies + ionic->watchdog_period));
@@ -121,7 +123,9 @@ int ionic_heartbeat_check(struct ionic *ionic)
{
	struct ionic_dev *idev = &ionic->idev;
	unsigned long check_time, last_check_time;
	bool fw_status_ready, fw_hb_ready;
	bool fw_status_ready = true;
	bool fw_hb_ready;
	u8 fw_generation;
	u8 fw_status;
	u32 fw_hb;

@@ -140,9 +144,29 @@ int ionic_heartbeat_check(struct ionic *ionic)

	/* firmware is useful only if the running bit is set and
	 * fw_status != 0xff (bad PCI read)
	 * If fw_status is not ready don't bother with the generation.
	 */
	fw_status = ioread8(&idev->dev_info_regs->fw_status);
	fw_status_ready = (fw_status != 0xff) && (fw_status & IONIC_FW_STS_F_RUNNING);

	if (fw_status == 0xff || !(fw_status & IONIC_FW_STS_F_RUNNING)) {
		fw_status_ready = false;
	} else {
		fw_generation = fw_status & IONIC_FW_STS_F_GENERATION;
		if (idev->fw_generation != fw_generation) {
			dev_info(ionic->dev, "FW generation 0x%02x -> 0x%02x\n",
				 idev->fw_generation, fw_generation);

			idev->fw_generation = fw_generation;

			/* If the generation changed, the fw status is not
			 * ready so we need to trigger a fw-down cycle.  After
			 * the down, the next watchdog will see the fw is up
			 * and the generation value stable, so will trigger
			 * the fw-up activity.
			 */
			fw_status_ready = false;
		}
	}

	/* is this a transition? */
	if (fw_status_ready != idev->fw_status_ready) {
+1 −2
Original line number Diff line number Diff line
@@ -143,6 +143,7 @@ struct ionic_dev {
	u32 last_fw_hb;
	bool fw_hb_ready;
	bool fw_status_ready;
	u8 fw_generation;

	u64 __iomem *db_pages;
	dma_addr_t phy_db_pages;
@@ -160,8 +161,6 @@ struct ionic_dev {
struct ionic_cq_info {
	union {
		void *cq_desc;
		struct ionic_txq_comp *txcq;
		struct ionic_rxq_comp *rxcq;
		struct ionic_admin_comp *admincq;
		struct ionic_notifyq_event *notifyq;
	};
+21 −0
Original line number Diff line number Diff line
@@ -32,6 +32,9 @@ static void ionic_get_stats(struct net_device *netdev,
	struct ionic_lif *lif = netdev_priv(netdev);
	u32 i;

	if (test_bit(IONIC_LIF_F_FW_RESET, lif->state))
		return;

	memset(buf, 0, stats->n_stats * sizeof(*buf));
	for (i = 0; i < ionic_num_stats_grps; i++)
		ionic_stats_groups[i].get_values(lif, &buf);
@@ -274,6 +277,9 @@ static int ionic_set_link_ksettings(struct net_device *netdev,
	struct ionic *ionic = lif->ionic;
	int err = 0;

	if (test_bit(IONIC_LIF_F_FW_RESET, lif->state))
		return -EBUSY;

	/* set autoneg */
	if (ks->base.autoneg != idev->port_info->config.an_enable) {
		mutex_lock(&ionic->dev_cmd_lock);
@@ -320,6 +326,9 @@ static int ionic_set_pauseparam(struct net_device *netdev,
	u32 requested_pause;
	int err;

	if (test_bit(IONIC_LIF_F_FW_RESET, lif->state))
		return -EBUSY;

	if (pause->autoneg)
		return -EOPNOTSUPP;

@@ -372,6 +381,9 @@ static int ionic_set_fecparam(struct net_device *netdev,
	u8 fec_type;
	int ret = 0;

	if (test_bit(IONIC_LIF_F_FW_RESET, lif->state))
		return -EBUSY;

	if (lif->ionic->idev.port_info->config.an_enable) {
		netdev_err(netdev, "FEC request not allowed while autoneg is enabled\n");
		return -EINVAL;
@@ -528,6 +540,9 @@ static int ionic_set_ringparam(struct net_device *netdev,
	struct ionic_queue_params qparam;
	int err;

	if (test_bit(IONIC_LIF_F_FW_RESET, lif->state))
		return -EBUSY;

	ionic_init_queue_params(lif, &qparam);

	if (ring->rx_mini_pending || ring->rx_jumbo_pending) {
@@ -597,6 +612,9 @@ static int ionic_set_channels(struct net_device *netdev,
	int max_cnt;
	int err;

	if (test_bit(IONIC_LIF_F_FW_RESET, lif->state))
		return -EBUSY;

	ionic_init_queue_params(lif, &qparam);

	if (ch->rx_count != ch->tx_count) {
@@ -947,6 +965,9 @@ static int ionic_nway_reset(struct net_device *netdev)
	struct ionic *ionic = lif->ionic;
	int err = 0;

	if (test_bit(IONIC_LIF_F_FW_RESET, lif->state))
		return -EBUSY;

	/* flap the link to force auto-negotiation */

	mutex_lock(&ionic->dev_cmd_lock);
+4 −1
Original line number Diff line number Diff line
@@ -2936,6 +2936,8 @@ struct ionic_hwstamp_regs {
 * @asic_type:       Asic type
 * @asic_rev:        Asic revision
 * @fw_status:       Firmware status
 *			bit 0   - 1 = fw running
 *			bit 4-7 - 4 bit generation number, changes on fw restart
 * @fw_heartbeat:    Firmware heartbeat counter
 * @serial_num:      Serial number
 * @fw_version:      Firmware version
@@ -2949,7 +2951,8 @@ union ionic_dev_info_regs {
		u8     version;
		u8     asic_type;
		u8     asic_rev;
#define IONIC_FW_STS_F_RUNNING	0x1
#define IONIC_FW_STS_F_RUNNING		0x01
#define IONIC_FW_STS_F_GENERATION	0xF0
		u8     fw_status;
		u32    fw_heartbeat;
		char   fw_version[IONIC_DEVINFO_FWVERS_BUFLEN];
Loading