linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
To: linux-wireless@vger.kernel.org
Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>,
	Johannes Berg <johannes.berg@intel.com>
Subject: [PATCH 24/45] iwlwifi: pcie: allow to pretend to have Tx CSUM for debug
Date: Mon, 21 Dec 2015 22:50:25 +0200	[thread overview]
Message-ID: <1450731046-2796-24-git-send-email-emmanuel.grumbach@intel.com> (raw)
In-Reply-To: <0BA3FCBA62E2DC44AF3030971E174FB32E949792@hasmsx107.ger.corp.intel.com>

Allow to configure the driver to pretend to have TX CSUM
offload support. This will be useful to test the TSO flows
that will come in further patches.
This configuration is disabled by default.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/iwl-trans.h     |  2 ++
 drivers/net/wireless/intel/iwlwifi/mvm/constants.h |  1 +
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c  |  3 +++
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c       |  1 +
 drivers/net/wireless/intel/iwlwifi/pcie/internal.h |  3 +++
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c    |  1 +
 drivers/net/wireless/intel/iwlwifi/pcie/tx.c       | 13 +++++++++++++
 7 files changed, 24 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
index 777fd6c..6534537 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
@@ -478,6 +478,7 @@ struct iwl_hcmd_arr {
  *	in DWORD (as opposed to bytes)
  * @scd_set_active: should the transport configure the SCD for HCMD queue
  * @wide_cmd_header: firmware supports wide host command header
+ * @sw_csum_tx: transport should compute the TCP checksum
  * @command_groups: array of command groups, each member is an array of the
  *	commands in the group; for debugging only
  * @command_groups_size: number of command groups, to avoid illegal access
@@ -497,6 +498,7 @@ struct iwl_trans_config {
 	bool bc_table_dword;
 	bool scd_set_active;
 	bool wide_cmd_header;
+	bool sw_csum_tx;
 	const struct iwl_hcmd_arr *command_groups;
 	int command_groups_size;
  
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/constants.h b/drivers/net/wireless/intel/iwlwifi/mvm/constants.h
index 1f8f616..b00c03f 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/constants.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/constants.h
@@ -106,6 +106,7 @@
 #define IWL_MVM_RS_RSSI_BASED_INIT_RATE         0
 #define IWL_MVM_RS_80_20_FAR_RANGE_TWEAK	1
 #define IWL_MVM_TOF_IS_RESPONDER		0
+#define IWL_MVM_SW_TX_CSUM_OFFLOAD		0
 #define IWL_MVM_RS_NUM_TRY_BEFORE_ANT_TOGGLE    1
 #define IWL_MVM_RS_HT_VHT_RETRIES_PER_RATE      2
 #define IWL_MVM_RS_HT_VHT_RETRIES_PER_RATE_TW   1
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 0fb10fd..0227b29 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -667,6 +667,9 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
 	if (!iwl_mvm_is_csum_supported(mvm))
 		hw->netdev_features &= ~NETIF_F_RXCSUM;
 
+	if (IWL_MVM_SW_TX_CSUM_OFFLOAD)
+		hw->netdev_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
+
 	ret = ieee80211_register_hw(mvm->hw);
 	if (ret)
 		iwl_mvm_leds_exit(mvm);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
index ffcebea..50b8c01 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
@@ -541,6 +541,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
 	trans_cfg.scd_set_active = true;
 
 	trans_cfg.sdio_adma_addr = fw->sdio_adma_addr;
+	trans_cfg.sw_csum_tx = IWL_MVM_SW_TX_CSUM_OFFLOAD;
 
 	/* Set a short watchdog for the command queue */
 	trans_cfg.cmd_q_wdg_timeout =
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
index 92a35d9..3d47dd7 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
@@ -307,6 +307,8 @@ iwl_pcie_get_scratchbuf_dma(struct iwl_txq *txq, int idx)
  * @bc_table_dword: true if the BC table expects DWORD (as opposed to bytes)
  * @scd_set_active: should the transport configure the SCD for HCMD queue
  * @wide_cmd_header: true when ucode supports wide command header format
+ * @sw_csum_tx: if true, then the transport will compute the csum of the TXed
+ *	frame.
  * @rx_page_order: page order for receive buffer size
  * @reg_lock: protect hw register access
  * @mutex: to protect stop_device / start_fw / start_hw
@@ -361,6 +363,7 @@ struct iwl_trans_pcie {
 	bool bc_table_dword;
 	bool scd_set_active;
 	bool wide_cmd_header;
+	bool sw_csum_tx;
 	u32 rx_page_order;
 
 	/*protect hw register */
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index a5bf24e..97e22fb 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -1442,6 +1442,7 @@ static void iwl_trans_pcie_configure(struct iwl_trans *trans,
 	trans_pcie->wide_cmd_header = trans_cfg->wide_cmd_header;
 	trans_pcie->bc_table_dword = trans_cfg->bc_table_dword;
 	trans_pcie->scd_set_active = trans_cfg->scd_set_active;
+	trans_pcie->sw_csum_tx = trans_cfg->sw_csum_tx;
 
 	trans->command_groups = trans_cfg->command_groups;
 	trans->command_groups_size = trans_cfg->command_groups_size;
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
index 2952915..6c460a5 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
@@ -1823,6 +1823,19 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
 		      "TX on unused queue %d\n", txq_id))
 		return -EINVAL;
 
+	if (unlikely(trans_pcie->sw_csum_tx &&
+		     skb->ip_summed == CHECKSUM_PARTIAL)) {
+		int offs = skb_checksum_start_offset(skb);
+		int csum_offs = offs + skb->csum_offset;
+		__wsum csum;
+
+		if (skb_ensure_writable(skb, csum_offs + sizeof(__sum16)))
+			return -1;
+
+		csum = skb_checksum(skb, offs, skb->len - offs, 0);
+		*(__sum16 *)(skb->data + csum_offs) = csum_fold(csum);
+	}
+
 	if (skb_is_nonlinear(skb) &&
 	    skb_shinfo(skb)->nr_frags > IWL_PCIE_MAX_FRAGS &&
 	    __skb_linearize(skb))
-- 
2.5.0


  parent reply	other threads:[~2015-12-21 20:52 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-21 20:48 pull request: iwlwifi-next-2015-12-21 Grumbach, Emmanuel
2015-12-21 20:50 ` [PATCH 01/45] iwlwifi: mvm: don't keep an mvm ref when the interface is down Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 02/45] iwlwifi: mvm: add an option to start rs from HT/VHT rates Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 03/45] iwlwifi: mvm: set default new STA as non-aggregated Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 04/45] iwlwifi: mvm: configure scheduled scan according to traffic conditions Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 05/45] iwlwifi: mvm: rs: fix a potential out of bounds access Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 06/45] iwlwifi: mvm: advertise NETIF_F_SG Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 07/45] iwlwifi: dvm: " Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 08/45] iwlwifi: mvm: remove an extra tab Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 09/45] iwlwifi: mvm: cleanup roc te on restart cleanup Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 10/45] iwlwifi: mvm: check iwl_mvm_wowlan_config_key_params() return value Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 11/45] iwlwifi: pcie: allow the op_mode to block the tx queues Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 12/45] iwlwifi: trans: support a callback for ASYNC commands Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 13/45] iwlwifi: block the queues when we send ADD_STA for uAPSD Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 14/45] iwlwifi: uninline iwl_trans_send_cmd Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 15/45] iwlwifi: update host command messages to new format Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 16/45] iwlwifi: mvm: close the SP if we send fewer frames than expected in SP Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 17/45] iwlwifi: avoid d0i3 commands when no/init ucode is loaded Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 18/45] iwlwifi: mvm: remove the vif parameter of iwl_mvm_configure_bcast_filter() Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 19/45] iwlwifi: replace d0i3_mode and wowlan_d0i3 with more generic variables Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 20/45] iwlwifi: expose fw usniffer mode to more utilities Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 21/45] iwlwifi: mvm: change protocol offload flows Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 22/45] iwlwifi: dvm: fix compare_const_fl.cocci warnings Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 23/45] iwlwifi: change the Intel Wireless email address Emmanuel Grumbach
2015-12-21 20:50 ` Emmanuel Grumbach [this message]
2015-12-21 20:50 ` [PATCH 25/45] iwlwifi: mvm: prepare the code towards TSO implementation Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 26/45] iwlwifi: pcie: re-organize code towards TSO Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 27/45] iwlwifi: clear ieee80211_tx_info->driver_data in the op_mode Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 28/45] iwlwifi: pcie: build an A-MSDU using TSO core Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 29/45] iwlwifi: 9000: increase the number of queues Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 30/45] iwlwifi: mvm: refactor the way fw_key_table is handled Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 31/45] iwlwifi: mvm: enable L3 filtering Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 32/45] iwlwifi: mvm: support description for user triggered fw dbg collection Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 33/45] iwlwifi: mvm: small update in the firmware API Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 34/45] iwlwifi: mvm: add extended dwell time Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 35/45] iwlwifi: mvm: Add a station in monitor mode Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 36/45] iwlwifi: mvm: change iwl_mvm_get_key_sta_id() to return the station Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 37/45] iwlwifi: mvm: add 9000 series RX processing Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 38/45] iwlwifi: mvm: infrastructure for frame-release message Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 39/45] iwlwifi: mvm: dump more registers upon error Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 40/45] iwlwifi: Update PCI IDs for 8000 and 9000 series Emmanuel Grumbach
2015-12-29 16:06   ` Kalle Valo
2015-12-21 20:50 ` [PATCH 41/45] iwlwifi: mvm: Change number of associated stations when station becomes associated Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 42/45] iwlwifi: update key params on d0i3 entrance/exit Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 43/45] iwlwifi: remove unused parameter from grab_nic_access Emmanuel Grumbach
2015-12-21 20:50 ` [PATCH 44/45] iwlwifi: fix printf specifier Emmanuel Grumbach
2015-12-23  4:08   ` Joe Perches
2015-12-23  6:28     ` Grumbach, Emmanuel
2015-12-21 20:50 ` [PATCH 45/45] iwlwifi: bail out in case of bad trans state Emmanuel Grumbach
2015-12-21 20:54 ` pull request: iwlwifi-next-2015-12-21 Grumbach, Emmanuel
2015-12-29 16:47 ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1450731046-2796-24-git-send-email-emmanuel.grumbach@intel.com \
    --to=emmanuel.grumbach@intel.com \
    --cc=johannes.berg@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).