Commit edcda51d authored by Johannes Berg's avatar Johannes Berg
Browse files

wifi: iwlwifi: mvm: remove new checksum code



The hardware isn't going to get fixed, so this mode cannot work
in the foreseeable future. Remove it.

Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614145722.ddbc16c4affe.Ia6921e4b8a9624d4f57489ac775105ed0e400313@changeid


[restore original subject]
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent a8df1f58
Loading
Loading
Loading
Loading
+1 −12
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
/*
 * Copyright (C) 2012-2014, 2018-2022 Intel Corporation
 * Copyright (C) 2012-2014, 2018-2023 Intel Corporation
 * Copyright (C) 2016-2017 Intel Deutschland GmbH
 */
#ifndef __iwl_fw_api_tx_h__
@@ -177,17 +177,6 @@ enum iwl_tx_offload_assist_flags_pos {
#define IWL_TX_CMD_OFFLD_MH_MASK	0x1f
#define IWL_TX_CMD_OFFLD_IP_HDR_MASK	0x3f

enum iwl_tx_offload_assist_bz {
	IWL_TX_CMD_OFFLD_BZ_RESULT_OFFS		= 0x000003ff,
	IWL_TX_CMD_OFFLD_BZ_START_OFFS		= 0x001ff800,
	IWL_TX_CMD_OFFLD_BZ_MH_LEN		= 0x07c00000,
	IWL_TX_CMD_OFFLD_BZ_MH_PAD		= 0x08000000,
	IWL_TX_CMD_OFFLD_BZ_AMSDU		= 0x10000000,
	IWL_TX_CMD_OFFLD_BZ_ZERO2ONES		= 0x20000000,
	IWL_TX_CMD_OFFLD_BZ_ENABLE_CSUM		= 0x40000000,
	IWL_TX_CMD_OFFLD_BZ_PARTIAL_CSUM	= 0x80000000,
};

/* TODO: complete documentation for try_cnt and btkill_cnt */
/**
 * struct iwl_tx_cmd - TX command struct to FW
+0 −4
Original line number Diff line number Diff line
@@ -6142,10 +6142,6 @@ static bool iwl_mvm_mac_can_aggregate(struct ieee80211_hw *hw,
{
	struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);

	if (iwl_mvm_has_new_tx_csum(mvm))
		return iwl_mvm_tx_csum_bz(mvm, head, true) ==
		       iwl_mvm_tx_csum_bz(mvm, skb, true);

	/* For now don't aggregate IPv6 in AMSDU */
	if (skb->protocol != htons(ETH_P_IP))
		return false;
+0 −14
Original line number Diff line number Diff line
@@ -1540,19 +1540,6 @@ static inline bool iwl_mvm_is_ctdp_supported(struct iwl_mvm *mvm)
			   IWL_UCODE_TLV_CAPA_CTDP_SUPPORT);
}

static inline bool iwl_mvm_has_new_tx_csum(struct iwl_mvm *mvm)
{
	if (mvm->trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_BZ)
		return false;

	if (mvm->trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_BZ &&
	    CSR_HW_REV_TYPE(mvm->trans->hw_rev) == IWL_CFG_MAC_TYPE_GL &&
	    mvm->trans->hw_rev_step <= SILICON_B_STEP)
		return false;

	return true;
}

extern const u8 iwl_mvm_ac_to_tx_fifo[];
extern const u8 iwl_mvm_ac_to_gen2_tx_fifo[];

@@ -1630,7 +1617,6 @@ void iwl_mvm_mac_itxq_xmit(struct ieee80211_hw *hw, struct ieee80211_txq *txq);
unsigned int iwl_mvm_max_amsdu_size(struct iwl_mvm *mvm,
				    struct ieee80211_sta *sta,
				    unsigned int tid);
u32 iwl_mvm_tx_csum_bz(struct iwl_mvm *mvm, struct sk_buff *skb, bool amsdu);

#ifdef CONFIG_IWLWIFI_DEBUG
const char *iwl_mvm_get_tx_fail_reason(u32 status);
+6 −54
Original line number Diff line number Diff line
@@ -40,8 +40,9 @@ iwl_mvm_bar_check_trigger(struct iwl_mvm *mvm, const u8 *addr,
#define OPT_HDR(type, skb, off) \
	(type *)(skb_network_header(skb) + (off))

static u16 iwl_mvm_tx_csum_pre_bz(struct iwl_mvm *mvm, struct sk_buff *skb,
				  struct ieee80211_tx_info *info, bool amsdu)
static u32 iwl_mvm_tx_csum(struct iwl_mvm *mvm, struct sk_buff *skb,
			   struct ieee80211_tx_info *info,
			   bool amsdu)
{
	struct ieee80211_hdr *hdr = (void *)skb->data;
	u16 mh_len = ieee80211_hdrlen(hdr->frame_control);
@@ -141,54 +142,6 @@ static u16 iwl_mvm_tx_csum_pre_bz(struct iwl_mvm *mvm, struct sk_buff *skb,
	return offload_assist;
}

u32 iwl_mvm_tx_csum_bz(struct iwl_mvm *mvm, struct sk_buff *skb, bool amsdu)
{
	struct ieee80211_hdr *hdr = (void *)skb->data;
	u32 offload_assist = IWL_TX_CMD_OFFLD_BZ_PARTIAL_CSUM;
	unsigned int hdrlen = ieee80211_hdrlen(hdr->frame_control);
	unsigned int csum_start = skb_checksum_start_offset(skb);

	offload_assist |= u32_encode_bits(hdrlen / 2,
					  IWL_TX_CMD_OFFLD_BZ_MH_LEN);
	if (amsdu)
		offload_assist |= IWL_TX_CMD_OFFLD_BZ_AMSDU;
	else if (hdrlen % 4)
		/* padding is inserted later in transport */
		offload_assist |= IWL_TX_CMD_OFFLD_BZ_MH_PAD;

	if (skb->ip_summed != CHECKSUM_PARTIAL)
		return offload_assist;

	offload_assist |= IWL_TX_CMD_OFFLD_BZ_ENABLE_CSUM |
			  IWL_TX_CMD_OFFLD_BZ_ZERO2ONES;

	/*
	 * mac80211 will always calculate checksum in software for
	 * non-fast-xmit, and so we can only do offloaded checksum
	 * for fast-xmit frames. In this case, we always have the
	 * RFC 1042 header present. skb_checksum_start_offset()
	 * returns the offset from the beginning, but the hardware
	 * needs it from after the header & SNAP header.
	 */
	csum_start -= hdrlen + 8;

	offload_assist |= u32_encode_bits(csum_start,
					  IWL_TX_CMD_OFFLD_BZ_START_OFFS);
	offload_assist |= u32_encode_bits(csum_start + skb->csum_offset,
					  IWL_TX_CMD_OFFLD_BZ_RESULT_OFFS);

	return offload_assist;
}

static u32 iwl_mvm_tx_csum(struct iwl_mvm *mvm, struct sk_buff *skb,
			   struct ieee80211_tx_info *info,
			   bool amsdu)
{
	if (!iwl_mvm_has_new_tx_csum(mvm))
		return iwl_mvm_tx_csum_pre_bz(mvm, skb, info, amsdu);
	return iwl_mvm_tx_csum_bz(mvm, skb, amsdu);
}

/*
 * Sets most of the Tx cmd's fields
 */
@@ -288,7 +241,7 @@ void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb,
	tx_cmd->sta_id = sta_id;

	tx_cmd->offload_assist =
		cpu_to_le16(iwl_mvm_tx_csum_pre_bz(mvm, skb, info, amsdu));
		cpu_to_le16(iwl_mvm_tx_csum(mvm, skb, info, amsdu));
}

static u32 iwl_mvm_get_tx_ant(struct iwl_mvm *mvm,
@@ -612,9 +565,8 @@ iwl_mvm_set_tx_params(struct iwl_mvm *mvm, struct sk_buff *skb,
			cmd->rate_n_flags = cpu_to_le32(rate_n_flags);
		} else {
			struct iwl_tx_cmd_gen2 *cmd = (void *)dev_cmd->payload;
			u16 offload_assist = iwl_mvm_tx_csum_pre_bz(mvm, skb,
								    info,
								    amsdu);
			u16 offload_assist = iwl_mvm_tx_csum(mvm, skb,
							     info, amsdu);

			cmd->offload_assist = cpu_to_le16(offload_assist);