Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed636960 authored by Mitch Williams's avatar Mitch Williams Committed by Jeff Kirsher
Browse files

i40evf: remove aq_pending



The aq_pending field in the adapter structure is actually redundant with
the current_op field. Remove the aq_pending field and expunge all traces
of it from the official record. This simplifies the code significantly,
especially in the virtual channel completion routine.

Change-ID: Ib2957c8c19882bd0cecc6fcd133912c24b46a1ff
Signed-off-by: default avatarMitch Williams <mitch.a.williams@intel.com>
Tested-by: default avatarJim Young <james.m.young@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent e7c8c60b
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -225,7 +225,6 @@ struct i40evf_adapter {
#define I40E_FLAG_RX_CSUM_ENABLED                I40EVF_FLAG_RX_CSUM_ENABLED
#define I40E_FLAG_RX_CSUM_ENABLED                I40EVF_FLAG_RX_CSUM_ENABLED
	/* flags for admin queue service task */
	/* flags for admin queue service task */
	u32 aq_required;
	u32 aq_required;
	u32 aq_pending;
#define I40EVF_FLAG_AQ_ENABLE_QUEUES		(u32)(1)
#define I40EVF_FLAG_AQ_ENABLE_QUEUES		(u32)(1)
#define I40EVF_FLAG_AQ_DISABLE_QUEUES		(u32)(1 << 1)
#define I40EVF_FLAG_AQ_DISABLE_QUEUES		(u32)(1 << 1)
#define I40EVF_FLAG_AQ_ADD_MAC_FILTER		(u32)(1 << 2)
#define I40EVF_FLAG_AQ_ADD_MAC_FILTER		(u32)(1 << 2)
+1 −6
Original line number Original line Diff line number Diff line
@@ -1008,7 +1008,6 @@ void i40evf_down(struct i40evf_adapter *adapter)
	    adapter->state != __I40EVF_RESETTING) {
	    adapter->state != __I40EVF_RESETTING) {
		/* cancel any current operation */
		/* cancel any current operation */
		adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN;
		adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN;
		adapter->aq_pending = 0;
		/* Schedule operations to close down the HW. Don't wait
		/* Schedule operations to close down the HW. Don't wait
		 * here for this to complete. The watchdog is still running
		 * here for this to complete. The watchdog is still running
		 * and it will take care of this.
		 * and it will take care of this.
@@ -1335,7 +1334,6 @@ static void i40evf_watchdog_task(struct work_struct *work)
			 */
			 */
			return;
			return;
		}
		}
		adapter->aq_pending = 0;
		adapter->aq_required = 0;
		adapter->aq_required = 0;
		adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN;
		adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN;
		goto watchdog_done;
		goto watchdog_done;
@@ -1355,7 +1353,6 @@ static void i40evf_watchdog_task(struct work_struct *work)
		adapter->flags |= I40EVF_FLAG_RESET_PENDING;
		adapter->flags |= I40EVF_FLAG_RESET_PENDING;
		dev_err(&adapter->pdev->dev, "Hardware reset detected\n");
		dev_err(&adapter->pdev->dev, "Hardware reset detected\n");
		schedule_work(&adapter->reset_task);
		schedule_work(&adapter->reset_task);
		adapter->aq_pending = 0;
		adapter->aq_required = 0;
		adapter->aq_required = 0;
		adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN;
		adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN;
		goto watchdog_done;
		goto watchdog_done;
@@ -1364,7 +1361,7 @@ static void i40evf_watchdog_task(struct work_struct *work)
	/* Process admin queue tasks. After init, everything gets done
	/* Process admin queue tasks. After init, everything gets done
	 * here so we don't race on the admin queue.
	 * here so we don't race on the admin queue.
	 */
	 */
	if (adapter->aq_pending) {
	if (adapter->current_op) {
		if (!i40evf_asq_done(hw)) {
		if (!i40evf_asq_done(hw)) {
			dev_dbg(&adapter->pdev->dev, "Admin queue timeout\n");
			dev_dbg(&adapter->pdev->dev, "Admin queue timeout\n");
			i40evf_send_api_ver(adapter);
			i40evf_send_api_ver(adapter);
@@ -2249,7 +2246,6 @@ static void i40evf_shutdown(struct pci_dev *pdev)
	/* Prevent the watchdog from running. */
	/* Prevent the watchdog from running. */
	adapter->state = __I40EVF_REMOVE;
	adapter->state = __I40EVF_REMOVE;
	adapter->aq_required = 0;
	adapter->aq_required = 0;
	adapter->aq_pending = 0;


#ifdef CONFIG_PM
#ifdef CONFIG_PM
	pci_save_state(pdev);
	pci_save_state(pdev);
@@ -2467,7 +2463,6 @@ static void i40evf_remove(struct pci_dev *pdev)
	/* Shut down all the garbage mashers on the detention level */
	/* Shut down all the garbage mashers on the detention level */
	adapter->state = __I40EVF_REMOVE;
	adapter->state = __I40EVF_REMOVE;
	adapter->aq_required = 0;
	adapter->aq_required = 0;
	adapter->aq_pending = 0;
	i40evf_request_reset(adapter);
	i40evf_request_reset(adapter);
	msleep(20);
	msleep(20);
	/* If the FW isn't responding, kick it once, but only once. */
	/* If the FW isn't responding, kick it once, but only once. */
+11 −31
Original line number Original line Diff line number Diff line
@@ -250,7 +250,6 @@ void i40evf_configure_queues(struct i40evf_adapter *adapter)
		vqpi++;
		vqpi++;
	}
	}


	adapter->aq_pending |= I40EVF_FLAG_AQ_CONFIGURE_QUEUES;
	adapter->aq_required &= ~I40EVF_FLAG_AQ_CONFIGURE_QUEUES;
	adapter->aq_required &= ~I40EVF_FLAG_AQ_CONFIGURE_QUEUES;
	i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES,
	i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES,
			   (u8 *)vqci, len);
			   (u8 *)vqci, len);
@@ -277,7 +276,6 @@ void i40evf_enable_queues(struct i40evf_adapter *adapter)
	vqs.vsi_id = adapter->vsi_res->vsi_id;
	vqs.vsi_id = adapter->vsi_res->vsi_id;
	vqs.tx_queues = (1 << adapter->num_active_queues) - 1;
	vqs.tx_queues = (1 << adapter->num_active_queues) - 1;
	vqs.rx_queues = vqs.tx_queues;
	vqs.rx_queues = vqs.tx_queues;
	adapter->aq_pending |= I40EVF_FLAG_AQ_ENABLE_QUEUES;
	adapter->aq_required &= ~I40EVF_FLAG_AQ_ENABLE_QUEUES;
	adapter->aq_required &= ~I40EVF_FLAG_AQ_ENABLE_QUEUES;
	i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ENABLE_QUEUES,
	i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ENABLE_QUEUES,
			   (u8 *)&vqs, sizeof(vqs));
			   (u8 *)&vqs, sizeof(vqs));
@@ -303,7 +301,6 @@ void i40evf_disable_queues(struct i40evf_adapter *adapter)
	vqs.vsi_id = adapter->vsi_res->vsi_id;
	vqs.vsi_id = adapter->vsi_res->vsi_id;
	vqs.tx_queues = (1 << adapter->num_active_queues) - 1;
	vqs.tx_queues = (1 << adapter->num_active_queues) - 1;
	vqs.rx_queues = vqs.tx_queues;
	vqs.rx_queues = vqs.tx_queues;
	adapter->aq_pending |= I40EVF_FLAG_AQ_DISABLE_QUEUES;
	adapter->aq_required &= ~I40EVF_FLAG_AQ_DISABLE_QUEUES;
	adapter->aq_required &= ~I40EVF_FLAG_AQ_DISABLE_QUEUES;
	i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DISABLE_QUEUES,
	i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DISABLE_QUEUES,
			   (u8 *)&vqs, sizeof(vqs));
			   (u8 *)&vqs, sizeof(vqs));
@@ -354,7 +351,6 @@ void i40evf_map_queues(struct i40evf_adapter *adapter)
	vimi->vecmap[v_idx].txq_map = 0;
	vimi->vecmap[v_idx].txq_map = 0;
	vimi->vecmap[v_idx].rxq_map = 0;
	vimi->vecmap[v_idx].rxq_map = 0;


	adapter->aq_pending |= I40EVF_FLAG_AQ_MAP_VECTORS;
	adapter->aq_required &= ~I40EVF_FLAG_AQ_MAP_VECTORS;
	adapter->aq_required &= ~I40EVF_FLAG_AQ_MAP_VECTORS;
	i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP,
	i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP,
			   (u8 *)vimi, len);
			   (u8 *)vimi, len);
@@ -415,7 +411,6 @@ void i40evf_add_ether_addrs(struct i40evf_adapter *adapter)
			f->add = false;
			f->add = false;
		}
		}
	}
	}
	adapter->aq_pending |= I40EVF_FLAG_AQ_ADD_MAC_FILTER;
	adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_MAC_FILTER;
	adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_MAC_FILTER;
	i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS,
	i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS,
			   (u8 *)veal, len);
			   (u8 *)veal, len);
@@ -476,7 +471,6 @@ void i40evf_del_ether_addrs(struct i40evf_adapter *adapter)
			kfree(f);
			kfree(f);
		}
		}
	}
	}
	adapter->aq_pending |= I40EVF_FLAG_AQ_DEL_MAC_FILTER;
	adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_MAC_FILTER;
	adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_MAC_FILTER;
	i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS,
	i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS,
			   (u8 *)veal, len);
			   (u8 *)veal, len);
@@ -537,7 +531,6 @@ void i40evf_add_vlans(struct i40evf_adapter *adapter)
			f->add = false;
			f->add = false;
		}
		}
	}
	}
	adapter->aq_pending |= I40EVF_FLAG_AQ_ADD_VLAN_FILTER;
	adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_VLAN_FILTER;
	adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_VLAN_FILTER;
	i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ADD_VLAN, (u8 *)vvfl, len);
	i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ADD_VLAN, (u8 *)vvfl, len);
	kfree(vvfl);
	kfree(vvfl);
@@ -598,7 +591,6 @@ void i40evf_del_vlans(struct i40evf_adapter *adapter)
			kfree(f);
			kfree(f);
		}
		}
	}
	}
	adapter->aq_pending |= I40EVF_FLAG_AQ_DEL_VLAN_FILTER;
	adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_VLAN_FILTER;
	adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_VLAN_FILTER;
	i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DEL_VLAN, (u8 *)vvfl, len);
	i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DEL_VLAN, (u8 *)vvfl, len);
	kfree(vvfl);
	kfree(vvfl);
@@ -720,9 +712,6 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
			__func__, v_retval, v_opcode);
			__func__, v_retval, v_opcode);
	}
	}
	switch (v_opcode) {
	switch (v_opcode) {
	case I40E_VIRTCHNL_OP_VERSION:
		/* no action, but also not an error */
		break;
	case I40E_VIRTCHNL_OP_GET_STATS: {
	case I40E_VIRTCHNL_OP_GET_STATS: {
		struct i40e_eth_stats *stats =
		struct i40e_eth_stats *stats =
			(struct i40e_eth_stats *)msg;
			(struct i40e_eth_stats *)msg;
@@ -740,39 +729,30 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
		adapter->current_stats = *stats;
		adapter->current_stats = *stats;
		}
		}
		break;
		break;
	case I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS:
		adapter->aq_pending &= ~(I40EVF_FLAG_AQ_ADD_MAC_FILTER);
		break;
	case I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS:
		adapter->aq_pending &= ~(I40EVF_FLAG_AQ_DEL_MAC_FILTER);
		break;
	case I40E_VIRTCHNL_OP_ADD_VLAN:
		adapter->aq_pending &= ~(I40EVF_FLAG_AQ_ADD_VLAN_FILTER);
		break;
	case I40E_VIRTCHNL_OP_DEL_VLAN:
		adapter->aq_pending &= ~(I40EVF_FLAG_AQ_DEL_VLAN_FILTER);
		break;
	case I40E_VIRTCHNL_OP_ENABLE_QUEUES:
	case I40E_VIRTCHNL_OP_ENABLE_QUEUES:
		adapter->aq_pending &= ~(I40EVF_FLAG_AQ_ENABLE_QUEUES);
		/* enable transmits */
		/* enable transmits */
		i40evf_irq_enable(adapter, true);
		i40evf_irq_enable(adapter, true);
		netif_tx_start_all_queues(adapter->netdev);
		netif_tx_start_all_queues(adapter->netdev);
		netif_carrier_on(adapter->netdev);
		netif_carrier_on(adapter->netdev);
		break;
		break;
	case I40E_VIRTCHNL_OP_DISABLE_QUEUES:
	case I40E_VIRTCHNL_OP_DISABLE_QUEUES:
		adapter->aq_pending &= ~(I40EVF_FLAG_AQ_DISABLE_QUEUES);
		i40evf_free_all_tx_resources(adapter);
		i40evf_free_all_tx_resources(adapter);
		i40evf_free_all_rx_resources(adapter);
		i40evf_free_all_rx_resources(adapter);
		break;
		break;
	case I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES:
	case I40E_VIRTCHNL_OP_VERSION:
		adapter->aq_pending &= ~(I40EVF_FLAG_AQ_CONFIGURE_QUEUES);
	case I40E_VIRTCHNL_OP_GET_VF_RESOURCES:
		break;
	case I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP:
	case I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP:
		adapter->aq_pending &= ~(I40EVF_FLAG_AQ_MAP_VECTORS);
		/* Don't display an error if we get these out of sequence.
		 * If the firmware needed to get kicked, we'll get these and
		 * it's no problem.
		 */
		if (v_opcode != adapter->current_op)
			return;
		break;
		break;
	default:
	default:
		dev_info(&adapter->pdev->dev, "Received unexpected message %d from PF\n",
		if (v_opcode != adapter->current_op)
			 v_opcode);
			dev_warn(&adapter->pdev->dev, "Expected response %d from PF, received %d\n",
				 adapter->current_op, v_opcode);
		break;
		break;
	} /* switch v_opcode */
	} /* switch v_opcode */
	adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN;
	adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN;