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

Commit 1be5d8cc authored by Johannes Berg's avatar Johannes Berg Committed by Emmanuel Grumbach
Browse files

iwlwifi: pass NAPI struct from transport layer



The mac80211 patch to pass the NAPI struct only changed iwlwifi to
store the NAPI struct, but we can do better: pass it directly from
the lower transport layer to the opmode during RX, and then on to
mac80211 from there.

When we add multiple RX queues, we can then pass the appropriate
NAPI struct properly.

Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
parent 473e0bc3
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -122,7 +122,7 @@ static inline void iwl_set_calib_hdr(struct iwl_calib_hdr *hdr, u8 cmd)
void iwl_down(struct iwl_priv *priv);
void iwl_down(struct iwl_priv *priv);
void iwl_cancel_deferred_work(struct iwl_priv *priv);
void iwl_cancel_deferred_work(struct iwl_priv *priv);
void iwlagn_prepare_restart(struct iwl_priv *priv);
void iwlagn_prepare_restart(struct iwl_priv *priv);
void iwl_rx_dispatch(struct iwl_op_mode *op_mode,
void iwl_rx_dispatch(struct iwl_op_mode *op_mode, struct napi_struct *napi,
		     struct iwl_rx_cmd_buffer *rxb);
		     struct iwl_rx_cmd_buffer *rxb);


bool iwl_check_for_ct_kill(struct iwl_priv *priv);
bool iwl_check_for_ct_kill(struct iwl_priv *priv);
+0 −13
Original line number Original line Diff line number Diff line
@@ -2029,18 +2029,6 @@ static bool iwl_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state)
	return false;
	return false;
}
}


static void iwl_napi_add(struct iwl_op_mode *op_mode,
			 struct napi_struct *napi,
			 struct net_device *napi_dev,
			 int (*poll)(struct napi_struct *, int),
			 int weight)
{
	struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);

	netif_napi_add(napi_dev, napi, poll, weight);
	priv->napi = napi;
}

static const struct iwl_op_mode_ops iwl_dvm_ops = {
static const struct iwl_op_mode_ops iwl_dvm_ops = {
	.start = iwl_op_mode_dvm_start,
	.start = iwl_op_mode_dvm_start,
	.stop = iwl_op_mode_dvm_stop,
	.stop = iwl_op_mode_dvm_stop,
@@ -2053,7 +2041,6 @@ static const struct iwl_op_mode_ops iwl_dvm_ops = {
	.cmd_queue_full = iwl_cmd_queue_full,
	.cmd_queue_full = iwl_cmd_queue_full,
	.nic_config = iwl_nic_config,
	.nic_config = iwl_nic_config,
	.wimax_active = iwl_wimax_active,
	.wimax_active = iwl_wimax_active,
	.napi_add = iwl_napi_add,
};
};


/*****************************************************************************
/*****************************************************************************
+2 −1
Original line number Original line Diff line number Diff line
@@ -1073,7 +1073,8 @@ void iwl_setup_rx_handlers(struct iwl_priv *priv)
		iwlagn_bt_rx_handler_setup(priv);
		iwlagn_bt_rx_handler_setup(priv);
}
}


void iwl_rx_dispatch(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb)
void iwl_rx_dispatch(struct iwl_op_mode *op_mode, struct napi_struct *napi,
		     struct iwl_rx_cmd_buffer *rxb)
{
{
	struct iwl_rx_packet *pkt = rxb_addr(rxb);
	struct iwl_rx_packet *pkt = rxb_addr(rxb);
	struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
	struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
+4 −22
Original line number Original line Diff line number Diff line
@@ -116,10 +116,6 @@ struct iwl_cfg;
 *	May sleep
 *	May sleep
 * @rx: Rx notification to the op_mode. rxb is the Rx buffer itself. Cmd is the
 * @rx: Rx notification to the op_mode. rxb is the Rx buffer itself. Cmd is the
 *	HCMD this Rx responds to. Can't sleep.
 *	HCMD this Rx responds to. Can't sleep.
 * @napi_add: NAPI initialization. The transport is fully responsible for NAPI,
 *	but the higher layers need to know about it (in particular mac80211 to
 *	to able to call the right NAPI RX functions); this function is needed
 *	to eventually call netif_napi_add() with higher layer involvement.
 * @queue_full: notifies that a HW queue is full.
 * @queue_full: notifies that a HW queue is full.
 *	Must be atomic and called with BH disabled.
 *	Must be atomic and called with BH disabled.
 * @queue_not_full: notifies that a HW queue is not full any more.
 * @queue_not_full: notifies that a HW queue is not full any more.
@@ -148,12 +144,8 @@ struct iwl_op_mode_ops {
				     const struct iwl_fw *fw,
				     const struct iwl_fw *fw,
				     struct dentry *dbgfs_dir);
				     struct dentry *dbgfs_dir);
	void (*stop)(struct iwl_op_mode *op_mode);
	void (*stop)(struct iwl_op_mode *op_mode);
	void (*rx)(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb);
	void (*rx)(struct iwl_op_mode *op_mode, struct napi_struct *napi,
	void (*napi_add)(struct iwl_op_mode *op_mode,
		   struct iwl_rx_cmd_buffer *rxb);
			 struct napi_struct *napi,
			 struct net_device *napi_dev,
			 int (*poll)(struct napi_struct *, int),
			 int weight);
	void (*queue_full)(struct iwl_op_mode *op_mode, int queue);
	void (*queue_full)(struct iwl_op_mode *op_mode, int queue);
	void (*queue_not_full)(struct iwl_op_mode *op_mode, int queue);
	void (*queue_not_full)(struct iwl_op_mode *op_mode, int queue);
	bool (*hw_rf_kill)(struct iwl_op_mode *op_mode, bool state);
	bool (*hw_rf_kill)(struct iwl_op_mode *op_mode, bool state);
@@ -188,9 +180,10 @@ static inline void iwl_op_mode_stop(struct iwl_op_mode *op_mode)
}
}


static inline void iwl_op_mode_rx(struct iwl_op_mode *op_mode,
static inline void iwl_op_mode_rx(struct iwl_op_mode *op_mode,
				  struct napi_struct *napi,
				  struct iwl_rx_cmd_buffer *rxb)
				  struct iwl_rx_cmd_buffer *rxb)
{
{
	return op_mode->ops->rx(op_mode, rxb);
	return op_mode->ops->rx(op_mode, napi, rxb);
}
}


static inline void iwl_op_mode_queue_full(struct iwl_op_mode *op_mode,
static inline void iwl_op_mode_queue_full(struct iwl_op_mode *op_mode,
@@ -258,15 +251,4 @@ static inline int iwl_op_mode_exit_d0i3(struct iwl_op_mode *op_mode)
	return op_mode->ops->exit_d0i3(op_mode);
	return op_mode->ops->exit_d0i3(op_mode);
}
}


static inline void iwl_op_mode_napi_add(struct iwl_op_mode *op_mode,
					struct napi_struct *napi,
					struct net_device *napi_dev,
					int (*poll)(struct napi_struct *, int),
					int weight)
{
	if (!op_mode->ops->napi_add)
		return;
	op_mode->ops->napi_add(op_mode, napi, napi_dev, poll, weight);
}

#endif /* __iwl_op_mode_h__ */
#endif /* __iwl_op_mode_h__ */
+2 −2
Original line number Original line Diff line number Diff line
@@ -563,7 +563,6 @@ struct iwl_mvm {
	const struct iwl_cfg *cfg;
	const struct iwl_cfg *cfg;
	struct iwl_phy_db *phy_db;
	struct iwl_phy_db *phy_db;
	struct ieee80211_hw *hw;
	struct ieee80211_hw *hw;
	struct napi_struct *napi;


	/* for protecting access to iwl_mvm */
	/* for protecting access to iwl_mvm */
	struct mutex mutex;
	struct mutex mutex;
@@ -1085,7 +1084,8 @@ bool iwl_mvm_bcast_filter_build_cmd(struct iwl_mvm *mvm,
 * Convention: iwl_mvm_rx_<NAME OF THE CMD>
 * Convention: iwl_mvm_rx_<NAME OF THE CMD>
 */
 */
void iwl_mvm_rx_rx_phy_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
void iwl_mvm_rx_rx_phy_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi,
			struct iwl_rx_cmd_buffer *rxb);
void iwl_mvm_rx_tx_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
void iwl_mvm_rx_tx_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
void iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
void iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
void iwl_mvm_rx_ant_coupling_notif(struct iwl_mvm *mvm,
void iwl_mvm_rx_ant_coupling_notif(struct iwl_mvm *mvm,
Loading