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

Commit bb03927e authored by Johannes Berg's avatar Johannes Berg Committed by Luca Coelho
Browse files

iwlwifi: pcie: tx: pull tracing out of iwl_fill_data_tbs()



This will allow us to reuse the function later for adding fraglist
SKBs to the TFD.

Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent 7d50d76e
Loading
Loading
Loading
Loading
+21 −20
Original line number Original line Diff line number Diff line
@@ -1977,26 +1977,24 @@ int iwl_trans_pcie_send_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)


static int iwl_fill_data_tbs(struct iwl_trans *trans, struct sk_buff *skb,
static int iwl_fill_data_tbs(struct iwl_trans *trans, struct sk_buff *skb,
			     struct iwl_txq *txq, u8 hdr_len,
			     struct iwl_txq *txq, u8 hdr_len,
			     struct iwl_cmd_meta *out_meta,
			     struct iwl_cmd_meta *out_meta)
			     struct iwl_device_cmd *dev_cmd, u16 tb1_len)
{
{
	struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
	u16 head_tb_len;
	u16 tb2_len;
	int i;
	int i;


	/*
	/*
	 * Set up TFD's third entry to point directly to remainder
	 * Set up TFD's third entry to point directly to remainder
	 * of skb's head, if any
	 * of skb's head, if any
	 */
	 */
	tb2_len = skb_headlen(skb) - hdr_len;
	head_tb_len = skb_headlen(skb) - hdr_len;


	if (tb2_len > 0) {
	if (head_tb_len > 0) {
		dma_addr_t tb2_phys = dma_map_single(trans->dev,
		dma_addr_t tb_phys = dma_map_single(trans->dev,
						    skb->data + hdr_len,
						    skb->data + hdr_len,
						     tb2_len, DMA_TO_DEVICE);
						    head_tb_len, DMA_TO_DEVICE);
		if (unlikely(dma_mapping_error(trans->dev, tb2_phys)))
		if (unlikely(dma_mapping_error(trans->dev, tb_phys)))
			return -EINVAL;
			return -EINVAL;
		iwl_pcie_txq_build_tfd(trans, txq, tb2_phys, tb2_len, false);
		iwl_pcie_txq_build_tfd(trans, txq, tb_phys, head_tb_len, false);
	}
	}


	/* set up the remaining entries to point to the data */
	/* set up the remaining entries to point to the data */
@@ -2019,12 +2017,6 @@ static int iwl_fill_data_tbs(struct iwl_trans *trans, struct sk_buff *skb,
		out_meta->tbs |= BIT(tb_idx);
		out_meta->tbs |= BIT(tb_idx);
	}
	}


	trace_iwlwifi_dev_tx(trans->dev, skb,
			     iwl_pcie_get_tfd(trans, txq, txq->write_ptr),
			     trans_pcie->tfd_size,
			     &dev_cmd->hdr, IWL_FIRST_TB_SIZE + tb1_len,
			     hdr_len);
	trace_iwlwifi_dev_tx_data(trans->dev, skb, hdr_len);
	return 0;
	return 0;
}
}


@@ -2415,9 +2407,18 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
						     out_meta, dev_cmd,
						     out_meta, dev_cmd,
						     tb1_len)))
						     tb1_len)))
			goto out_err;
			goto out_err;
	} else if (unlikely(iwl_fill_data_tbs(trans, skb, txq, hdr_len,
	} else {
				       out_meta, dev_cmd, tb1_len))) {
		if (unlikely(iwl_fill_data_tbs(trans, skb, txq, hdr_len,
					       out_meta)))
			goto out_err;
			goto out_err;

		trace_iwlwifi_dev_tx(trans->dev, skb,
				     iwl_pcie_get_tfd(trans, txq,
						      txq->write_ptr),
				     trans_pcie->tfd_size,
				     &dev_cmd->hdr, IWL_FIRST_TB_SIZE + tb1_len,
				     hdr_len);
		trace_iwlwifi_dev_tx_data(trans->dev, skb, hdr_len);
	}
	}


	/* building the A-MSDU might have changed this data, so memcpy it now */
	/* building the A-MSDU might have changed this data, so memcpy it now */