iwlwifi: pcie: trace IOVA for iwlwifi_dev_tx_tb
authorJohannes Berg <johannes.berg@intel.com>
Mon, 30 Sep 2019 09:49:49 +0000 (11:49 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Wed, 20 Nov 2019 10:28:55 +0000 (12:28 +0200)
We trace the whole TFD with all TBs when in iwlwifi_dev_tx,
but sometimes we add TBs to it later and then we don't have
any of this data. Trace the I/O virtual address (IOVA) (it
can be the physical address, or as returned by the IOMMU)
here to aid debugging the DMA flows.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/iwl-devtrace-data.h
drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
drivers/net/wireless/intel/iwlwifi/pcie/tx.c

index 9e86436..1bc6ecc 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2015        Intel Deutschland GmbH
- * Copyright(c) 2018        Intel Corporation
+ * Copyright(c) 2018 - 2019 Intel Corporation
  *
  * Contact Information:
  *  Intel Linux Wireless <linuxwifi@intel.com>
 
 TRACE_EVENT(iwlwifi_dev_tx_tb,
        TP_PROTO(const struct device *dev, struct sk_buff *skb,
-                u8 *data_src, size_t data_len),
-       TP_ARGS(dev, skb, data_src, data_len),
+                u8 *data_src, dma_addr_t phys, size_t data_len),
+       TP_ARGS(dev, skb, data_src, phys, data_len),
        TP_STRUCT__entry(
                DEV_ENTRY
+               __field(u64, phys)
 
                __dynamic_array(u8, data,
                                iwl_trace_data(skb) ? data_len : 0)
        ),
        TP_fast_assign(
                DEV_ASSIGN;
+               __entry->phys = phys;
                if (iwl_trace_data(skb))
                        memcpy(__get_dynamic_array(data), data_src, data_len);
        ),
index 1ca9a7e..8ca0250 100644 (file)
@@ -333,7 +333,8 @@ static int iwl_pcie_gen2_build_amsdu(struct iwl_trans *trans,
                        goto out_err;
                }
                iwl_pcie_gen2_set_tb(trans, tfd, tb_phys, tb_len);
-               trace_iwlwifi_dev_tx_tb(trans->dev, skb, start_hdr, tb_len);
+               trace_iwlwifi_dev_tx_tb(trans->dev, skb, start_hdr,
+                                       tb_phys, tb_len);
                /* add this subframe's headers' length to the tx_cmd */
                le16_add_cpu(&tx_cmd->len, hdr_page->pos - subf_hdrs_start);
 
@@ -351,7 +352,7 @@ static int iwl_pcie_gen2_build_amsdu(struct iwl_trans *trans,
                        }
                        iwl_pcie_gen2_set_tb(trans, tfd, tb_phys, tb_len);
                        trace_iwlwifi_dev_tx_tb(trans->dev, skb, tso.data,
-                                               tb_len);
+                                               tb_phys, tb_len);
 
                        data_left -= tb_len;
                        tso_build_data(skb, &tso, tb_len);
@@ -441,9 +442,8 @@ static int iwl_pcie_gen2_tx_add_frags(struct iwl_trans *trans,
                        return -ENOMEM;
                tb_idx = iwl_pcie_gen2_set_tb(trans, tfd, tb_phys,
                                              skb_frag_size(frag));
-               trace_iwlwifi_dev_tx_tb(trans->dev, skb,
-                                       skb_frag_address(frag),
-                                       skb_frag_size(frag));
+               trace_iwlwifi_dev_tx_tb(trans->dev, skb, skb_frag_address(frag),
+                                       tb_phys, skb_frag_size(frag));
                if (tb_idx < 0)
                        return tb_idx;
 
@@ -509,9 +509,8 @@ iwl_tfh_tfd *iwl_pcie_gen2_build_tx(struct iwl_trans *trans,
                if (unlikely(dma_mapping_error(trans->dev, tb_phys)))
                        goto out_err;
                iwl_pcie_gen2_set_tb(trans, tfd, tb_phys, tb2_len);
-               trace_iwlwifi_dev_tx_tb(trans->dev, skb,
-                                       skb->data + hdr_len,
-                                       tb2_len);
+               trace_iwlwifi_dev_tx_tb(trans->dev, skb, skb->data + hdr_len,
+                                       tb_phys, tb2_len);
        }
 
        if (iwl_pcie_gen2_tx_add_frags(trans, skb, tfd, out_meta))
@@ -523,9 +522,8 @@ iwl_tfh_tfd *iwl_pcie_gen2_build_tx(struct iwl_trans *trans,
                if (unlikely(dma_mapping_error(trans->dev, tb_phys)))
                        goto out_err;
                iwl_pcie_gen2_set_tb(trans, tfd, tb_phys, skb_headlen(frag));
-               trace_iwlwifi_dev_tx_tb(trans->dev, skb,
-                                       frag->data,
-                                       skb_headlen(frag));
+               trace_iwlwifi_dev_tx_tb(trans->dev, skb, frag->data,
+                                       tb_phys, skb_headlen(frag));
                if (iwl_pcie_gen2_tx_add_frags(trans, frag, tfd, out_meta))
                        goto out_err;
        }
index b710b8a..f21f16a 100644 (file)
@@ -2019,9 +2019,8 @@ static int iwl_fill_data_tbs(struct iwl_trans *trans, struct sk_buff *skb,
                                                    head_tb_len, DMA_TO_DEVICE);
                if (unlikely(dma_mapping_error(trans->dev, tb_phys)))
                        return -EINVAL;
-               trace_iwlwifi_dev_tx_tb(trans->dev, skb,
-                                       skb->data + hdr_len,
-                                       head_tb_len);
+               trace_iwlwifi_dev_tx_tb(trans->dev, skb, skb->data + hdr_len,
+                                       tb_phys, head_tb_len);
                iwl_pcie_txq_build_tfd(trans, txq, tb_phys, head_tb_len, false);
        }
 
@@ -2039,9 +2038,8 @@ static int iwl_fill_data_tbs(struct iwl_trans *trans, struct sk_buff *skb,
 
                if (unlikely(dma_mapping_error(trans->dev, tb_phys)))
                        return -EINVAL;
-               trace_iwlwifi_dev_tx_tb(trans->dev, skb,
-                                       skb_frag_address(frag),
-                                       skb_frag_size(frag));
+               trace_iwlwifi_dev_tx_tb(trans->dev, skb, skb_frag_address(frag),
+                                       tb_phys, skb_frag_size(frag));
                tb_idx = iwl_pcie_txq_build_tfd(trans, txq, tb_phys,
                                                skb_frag_size(frag), false);
                if (tb_idx < 0)
@@ -2222,7 +2220,7 @@ static int iwl_fill_data_tbs_amsdu(struct iwl_trans *trans, struct sk_buff *skb,
                iwl_pcie_txq_build_tfd(trans, txq, hdr_tb_phys,
                                       hdr_tb_len, false);
                trace_iwlwifi_dev_tx_tb(trans->dev, skb, start_hdr,
-                                       hdr_tb_len);
+                                       hdr_tb_phys, hdr_tb_len);
                /* add this subframe's headers' length to the tx_cmd */
                le16_add_cpu(&tx_cmd->len, hdr_page->pos - subf_hdrs_start);
 
@@ -2248,7 +2246,7 @@ static int iwl_fill_data_tbs_amsdu(struct iwl_trans *trans, struct sk_buff *skb,
                        iwl_pcie_txq_build_tfd(trans, txq, tb_phys,
                                               size, false);
                        trace_iwlwifi_dev_tx_tb(trans->dev, skb, tso.data,
-                                               size);
+                                               tb_phys, size);
 
                        data_left -= size;
                        tso_build_data(skb, &tso, size);