ath10k: htt tx cleanup
cover ath10k: htt tx cleanup
My plan is to remove htt_tx_info wrapper. Before the wrapper can be actually killed off htt tx code needs a cleanup.
The cleanup seems like a generally good idea as
it merges and simplifies tx completion code.
Michal Kazior (7):
ath10k: flatten htt_tx_info
ath10k: share htc tx completion for data/mgmt tx
ath10k: move htt completion handler up in the code
ath10k: share a single htc tx completion for htt data/mgmt/conf tx
ath10k: remove per-packet completion handling
ath10k: remove priv from ath10k_skb_cb
ath10k: share htt tx completion for data/mgmt tx
drivers/net/wireless/ath/ath10k/core.c | 1 + drivers/net/wireless/ath/ath10k/core.h | 6 +- drivers/net/wireless/ath/ath10k/htc.c | 18 +-- drivers/net/wireless/ath/ath10k/htc.h | 1 + drivers/net/wireless/ath/ath10k/htt.c | 1 + drivers/net/wireless/ath/ath10k/htt.h | 29 ++--- drivers/net/wireless/ath/ath10k/htt_rx.c | 49 ++++++-- drivers/net/wireless/ath/ath10k/htt_tx.c | 196 +++++++++++++----------------- drivers/net/wireless/ath/ath10k/txrx.c | 106 +++++----------- drivers/net/wireless/ath/ath10k/txrx.h | 5 +- drivers/net/wireless/ath/ath10k/wmi.c | 8 +- 11 files changed, 176 insertions(+), 244 deletions(-)
Signature · 1 line
1.7.9.5
PATCH 1/7 ath10k: flatten htt_tx_info
This prepares for unified tx completion handling. With this we will be able to treat mgmt tx and data tx almost the same with the exception of txfrag pointer which is only relevant/present during data tx.
The main idea is to kill of the htt_tx_info though it probably is a better idea to do it step-by-step.
--- drivers/net/wireless/ath/ath10k/htt.h | 14 ++---- drivers/net/wireless/ath/ath10k/htt_tx.c | 80 +++++++++++++++--------------- drivers/net/wireless/ath/ath10k/txrx.c | 20 ++++---- 3 files changed, 53 insertions(+), 61 deletions(-)
drivers/net/wireless/ath/ath10k/htt.h +3 -11
@@ -1124,17 +1124,9 @@ struct htt_tx_info {bool htc_tx_completed;bool htt_tx_completed; -union { -struct { -struct sk_buff *txdesc; -struct sk_buff *txfrag; -struct sk_buff *msdu; - } data; -struct { -struct sk_buff *txdesc; -struct sk_buff *msdu; - } mgmt; - } u; +struct sk_buff *txdesc; +struct sk_buff *txfrag;/* not used for mgmt tx */ +struct sk_buff *msdu; };struct htt_struct {
drivers/net/wireless/ath/ath10k/htt_tx.c +40 -40
183 lines not on this page · raw message
drivers/net/wireless/ath/ath10k/txrx.c +10 -10
@@ -62,19 +62,19 @@ void ath10k_data_tx_completed(struct htt_struct *htt,return ; } - ret =ath10k_skb_unmap (dev, txi->u.data.txfrag); + ret =ath10k_skb_unmap (dev, txi->txfrag);if (ret)ath10k_warn ("txfrag unmap failed (%d)\n" , ret); - ret =ath10k_skb_unmap (dev, txi->u.data.msdu); + ret =ath10k_skb_unmap (dev, txi->msdu);if (ret)ath10k_warn ("data skb unmap failed (%d)\n" , ret); -dev_kfree_skb_any (txi->u.data.txfrag); +dev_kfree_skb_any (txi->txfrag); -ath10k_report_offchan_tx (htt->ar, txi->u.data.msdu); +ath10k_report_offchan_tx (htt->ar, txi->msdu); - info =IEEE80211_SKB_CB (txi->u.data.msdu); + info =IEEE80211_SKB_CB (txi->msdu);memset (&info->status,0 ,sizeof (info->status));switch (ev->status) {
@@ -83,19 +83,19 @@ void ath10k_data_tx_completed(struct htt_struct *htt, info->flags |=IEEE80211_TX_STAT_ACK ;/* fall through */ case HTT_DATA_TX_STATUS_NO_ACK : -ieee80211_tx_status_irqsafe (htt->ar->hw, txi->u.data.msdu); +ieee80211_tx_status_irqsafe (htt->ar->hw, txi->msdu);break ;case HTT_DATA_TX_STATUS_DISCARD :/* fall through */ case HTT_DATA_TX_STATUS_POSTPONE :/* fall through */ case HTT_DATA_TX_STATUS_DOWNLOAD_FAIL : -ieee80211_free_txskb (htt->ar->hw, txi->u.data.msdu); +ieee80211_free_txskb (htt->ar->hw, txi->msdu);break ; } txi->htt_tx_completed = true; -ath10k_htt_tx_info_unref (htt, txi, txi->u.data.txdesc); +ath10k_htt_tx_info_unref (htt, txi, txi->txdesc); }static u8 rx_legacy_rate_idx[] = {
@@ -281,7 +281,7 @@ void ath10k_mgmt_tx_completed(struct htt_struct *htt,if (WARN_ON (!txi))return ; - msdu = txi->u.mgmt.msdu; + msdu = txi->msdu; ret =ath10k_skb_unmap (dev, msdu);if (ret)
@@ -307,7 +307,7 @@ void ath10k_mgmt_tx_completed(struct htt_struct *htt, } txi->htt_tx_completed = true; -ath10k_htt_tx_info_unref (htt, txi, txi->u.mgmt.txdesc); +ath10k_htt_tx_info_unref (htt, txi, txi->txdesc); } struct ath10k_peer *ath10k_peer_find(struct ath10k *ar, int vdev_id,
Signature · 1 line
1.7.9.5
PATCH 2/7 ath10k: share htc tx completion for data/mgmt tx
In reply to Michal KaziorThis reduces code reduncancy and should make
further refactoring easier and less error-prone.
--- drivers/net/wireless/ath/ath10k/htt_tx.c | 49 +++++++----------------------- 1 file changed, 11 insertions(+), 38 deletions(-)
drivers/net/wireless/ath/ath10k/htt_tx.c +11 -38
@@ -233,7 +233,7 @@ int ath10k_htt_send_rx_ring_cfg_ll(struct htt_struct *htt)return 0 ; } -static void ath10k_htt_mgmt_tx_htc_complete (struct sk_buff *skb) +static void ath10k_htt_tx_htc_complete (struct sk_buff *skb) {struct ath10k_skb_cb *skb_cb =ATH10K_SKB_CB (skb);struct htt_tx_info *txi = skb_cb->htc.priv;
@@ -252,9 +252,17 @@ static void ath10k_htt_mgmt_tx_htc_complete(struct sk_buff *skb)if (!txi->htt_tx_completed) { txi->htt_tx_completed = true; +if (txi->txfrag) { + ret =ath10k_skb_unmap (dev, txi->txfrag); +if (ret) +ath10k_warn ("txfrag unmap failed (%d)\n" , ret); + +dev_kfree_skb_any (txi->txfrag); + } + ret =ath10k_skb_unmap (dev, txi->msdu);if (ret) -ath10k_warn ("mgmt skb unmap failed (%d)\n" , ret); +ath10k_warn ("data skb unmap failed (%d)\n" , ret);ieee80211_free_txskb (htt->ar->hw, txi->msdu); }
@@ -303,7 +311,7 @@ int ath10k_htt_mgmt_tx(struct htt_struct *htt, struct sk_buff *msdu) min((int)msdu->len, HTT_MGMT_FRM_HDR_DOWNLOAD_LEN)); skb_cb =ATH10K_SKB_CB (txi->txdesc); - skb_cb->htc.complete = ath10k_htt_mgmt_tx_htc_complete; + skb_cb->htc.complete = ath10k_htt_tx_htc_complete; skb_cb->htc.priv = txi; res =ath10k_htc_send (htt->htc_target, htt->ep_id, txi->txdesc);
@@ -322,41 +330,6 @@ err:return res; } -static void ath10k_htt_tx_htc_complete (struct sk_buff *skb) -{ -struct ath10k_skb_cb *skb_cb =ATH10K_SKB_CB (skb); -struct htt_tx_info *txi = skb_cb->htc.priv; -struct htt_struct *htt = txi->htt; -struct device *dev = htt->ar->dev; -int ret; - - txi->htc_tx_completed = true; - -if (skb_cb->is_aborted) { -/* -* if a packet gets cancelled we need to make sure -* to free skbs since htt mgmt tx completion indication -* may have not came in yet -*/ -if (!txi->htt_tx_completed) { - txi->htt_tx_completed = true; - - ret =ath10k_skb_unmap (dev, txi->txfrag); -if (ret) -ath10k_warn ("txfrag unmap failed (%d)\n" , ret); - - ret =ath10k_skb_unmap (dev, txi->msdu); -if (ret) -ath10k_warn ("data skb unmap failed (%d)\n" , ret); - -dev_kfree_skb_any (txi->txfrag); -ieee80211_free_txskb (htt->ar->hw, txi->msdu); - } - } - -ath10k_htt_tx_info_unref (htt, txi, skb); -} -int ath10k_htt_tx (struct htt_struct *htt,struct sk_buff *msdu) {struct device *dev = htt->ar->dev;
Signature · 1 line
1.7.9.5
PATCH 3/7 ath10k: move htt completion handler up in the code
In reply to Michal KaziorThe function will soon be reused by a function
that is located above.
--- drivers/net/wireless/ath/ath10k/htt_tx.c | 76 +++++++++++++++--------------- 1 file changed, 38 insertions(+), 38 deletions(-)
drivers/net/wireless/ath/ath10k/htt_tx.c +38 -38
@@ -117,6 +117,44 @@ static void ath10k_htt_conf_complete(struct sk_buff *skb)dev_kfree_skb_any (skb); } +static void ath10k_htt_tx_htc_complete (struct sk_buff *skb) +{ +struct ath10k_skb_cb *skb_cb =ATH10K_SKB_CB (skb); +struct htt_tx_info *txi = skb_cb->htc.priv; +struct htt_struct *htt = txi->htt; +struct device *dev = htt->ar->dev; +int ret; + + txi->htc_tx_completed = true; + +if (skb_cb->is_aborted) { +/* +* if a packet gets cancelled we need to make sure +* to free skbs since htt mgmt tx completion indication +* may have not came in yet +*/ +if (!txi->htt_tx_completed) { + txi->htt_tx_completed = true; + +if (txi->txfrag) { + ret =ath10k_skb_unmap (dev, txi->txfrag); +if (ret) +ath10k_warn ("txfrag unmap failed (%d)\n" , ret); + +dev_kfree_skb_any (txi->txfrag); + } + + ret =ath10k_skb_unmap (dev, txi->msdu); +if (ret) +ath10k_warn ("data skb unmap failed (%d)\n" , ret); + +ieee80211_free_txskb (htt->ar->hw, txi->msdu); + } + } + +ath10k_htt_tx_info_unref (htt, txi, skb); +} +int ath10k_htt_h2t_ver_req_msg (struct htt_struct *htt) {struct ath10k_skb_cb *skb_cb;
@@ -233,44 +271,6 @@ int ath10k_htt_send_rx_ring_cfg_ll(struct htt_struct *htt)return 0 ; } -static void ath10k_htt_tx_htc_complete (struct sk_buff *skb) -{ -struct ath10k_skb_cb *skb_cb =ATH10K_SKB_CB (skb); -struct htt_tx_info *txi = skb_cb->htc.priv; -struct htt_struct *htt = txi->htt; -struct device *dev = htt->ar->dev; -int ret; - - txi->htc_tx_completed = true; - -if (skb_cb->is_aborted) { -/* -* if a packet gets cancelled we need to make sure -* to free skbs since htt mgmt tx completion indication -* may have not came in yet -*/ -if (!txi->htt_tx_completed) { - txi->htt_tx_completed = true; - -if (txi->txfrag) { - ret =ath10k_skb_unmap (dev, txi->txfrag); -if (ret) -ath10k_warn ("txfrag unmap failed (%d)\n" , ret); - -dev_kfree_skb_any (txi->txfrag); - } - - ret =ath10k_skb_unmap (dev, txi->msdu); -if (ret) -ath10k_warn ("data skb unmap failed (%d)\n" , ret); - -ieee80211_free_txskb (htt->ar->hw, txi->msdu); - } - } - -ath10k_htt_tx_info_unref (htt, txi, skb); -} -int ath10k_htt_mgmt_tx (struct htt_struct *htt,struct sk_buff *msdu) {struct device *dev = htt->ar->dev;
Signature · 1 line
1.7.9.5
PATCH 4/7 ath10k: share a single htc tx completion for htt data/mgmt/conf tx
In reply to Michal KaziorThis patch virtually eliminates the need to have per-packet completions. Having per-packet completion is very costly (a pointer on 64bit arch takes up 8 bytes of ath10k_skb_cb's precious space).
--- drivers/net/wireless/ath/ath10k/core.h | 3 ++- drivers/net/wireless/ath/ath10k/htt_tx.c | 31 +++++++++++++++++------------- 2 files changed, 20 insertions(+), 14 deletions(-)
drivers/net/wireless/ath/ath10k/core.h +2 -1
@@ -57,6 +57,7 @@ struct ath10k_skb_cb {struct {u8 vdev_id;bool is_offchan; +bool is_conf; } __packed htt;struct {
@@ -65,7 +66,7 @@ struct ath10k_skb_cb {void *priv; }__packed htc; -/* 11 bytes left on 64bit arch */ +/* 10 bytes left on 64bit arch */ } __packed;static inline struct ath10k_skb_cb *ATH10K_SKB_CB (struct sk_buff *skb)
drivers/net/wireless/ath/ath10k/htt_tx.c +18 -13
@@ -112,19 +112,22 @@ struct htt_tx_info *ath10k_htt_tx_info_lookup(struct htt_struct *htt,return &htt->txi_pool[msdu_id]; } -static void ath10k_htt_conf_complete (struct sk_buff *skb) -{ -dev_kfree_skb_any (skb); -} - -static void ath10k_htt_tx_htc_complete (struct sk_buff *skb) +static void ath10k_htt_htc_tx_complete (struct sk_buff *skb) {struct ath10k_skb_cb *skb_cb =ATH10K_SKB_CB (skb); -struct htt_tx_info *txi = skb_cb->htc.priv; -struct htt_struct *htt = txi->htt; -struct device *dev = htt->ar->dev; +struct htt_tx_info *txi; +struct htt_struct *htt; +struct device *dev;int ret; +if (skb_cb->htt.is_conf) { +dev_kfree_skb_any (skb); +return ; + } + + txi = skb_cb->htc.priv; + htt = txi->htt; + dev = htt->ar->dev; txi->htc_tx_completed = true;if (skb_cb->is_aborted) {
@@ -175,7 +178,8 @@ int ath10k_htt_h2t_ver_req_msg(struct htt_struct *htt) cmd->hdr.msg_type =HTT_H2T_MSG_TYPE_VERSION_REQ ; skb_cb =ATH10K_SKB_CB (skb); - skb_cb->htc.complete = ath10k_htt_conf_complete; + skb_cb->htc.complete = ath10k_htt_htc_tx_complete; + skb_cb->htt.is_conf = true; ret =ath10k_htc_send (htt->htc_target, htt->ep_id, skb);if (ret) {
@@ -260,7 +264,8 @@ int ath10k_htt_send_rx_ring_cfg_ll(struct htt_struct *htt)#undef rx_desc_offset skb_cb =ATH10K_SKB_CB (skb); - skb_cb->htc.complete = ath10k_htt_conf_complete; + skb_cb->htc.complete = ath10k_htt_htc_tx_complete; + skb_cb->htt.is_conf = true; ret =ath10k_htc_send (htt->htc_target, htt->ep_id, skb);if (ret) {
@@ -311,7 +316,7 @@ int ath10k_htt_mgmt_tx(struct htt_struct *htt, struct sk_buff *msdu) min((int)msdu->len, HTT_MGMT_FRM_HDR_DOWNLOAD_LEN)); skb_cb =ATH10K_SKB_CB (txi->txdesc); - skb_cb->htc.complete = ath10k_htt_tx_htc_complete; + skb_cb->htc.complete = ath10k_htt_htc_tx_complete; skb_cb->htc.priv = txi; res =ath10k_htc_send (htt->htc_target, htt->ep_id, txi->txdesc);
@@ -439,7 +444,7 @@ int ath10k_htt_tx(struct htt_struct *htt, struct sk_buff *msdu)memcpy (cmd->data_tx.prefetch, msdu->data, prefetch_len); skb_cb =ATH10K_SKB_CB (txi->txdesc); - skb_cb->htc.complete = ath10k_htt_tx_htc_complete; + skb_cb->htc.complete = ath10k_htt_htc_tx_complete; skb_cb->htc.priv = txi; res =ath10k_htc_send (htt->htc_target, htt->ep_id, txi->txdesc);
Signature · 1 line
1.7.9.5
PATCH 5/7 ath10k: remove per-packet completion handling
In reply to Michal KaziorHaving a tx completion handler in theath10k_skb_cb is very costly (memory wise). The
saved space will be used to merge htt_tx_info.
--- drivers/net/wireless/ath/ath10k/core.c | 1 + drivers/net/wireless/ath/ath10k/core.h | 3 +-- drivers/net/wireless/ath/ath10k/htc.c | 11 ++++------- drivers/net/wireless/ath/ath10k/htc.h | 1 + drivers/net/wireless/ath/ath10k/htt.c | 1 + drivers/net/wireless/ath/ath10k/htt.h | 1 + drivers/net/wireless/ath/ath10k/htt_tx.c | 14 +++----------- drivers/net/wireless/ath/ath10k/wmi.c | 6 +++--- 8 files changed, 15 insertions(+), 23 deletions(-)
drivers/net/wireless/ath/ath10k/core.c +1 -0
@@ -111,6 +111,7 @@ static int ath10k_init_connect_htc(struct ath10k *ar)memset (&connect,0 ,sizeof (connect)); connect.ep_callbacks.context = ar; + connect.ep_callbacks.ep_tx_complete =NULL ; connect.ep_callbacks.ep_rx_complete =NULL ; status =ath10k_wmi_connect_htc_service (ar);
drivers/net/wireless/ath/ath10k/core.h +1 -2
@@ -62,11 +62,10 @@ struct ath10k_skb_cb {struct {u8 credits_used; -void (*complete)(struct sk_buff *);void *priv; } __packed htc; -/* 10 bytes left on 64bit arch */ +/* 18 bytes left on 64bit arch */ } __packed;static inline struct ath10k_skb_cb *ATH10K_SKB_CB (struct sk_buff *skb)
drivers/net/wireless/ath/ath10k/htc.c +4 -7
@@ -74,7 +74,7 @@ static inline void ath10k_htc_send_complete_check(struct htc_endpoint *ep,ath10k_hif_send_complete_check (ep->target->ar, ep->ul_pipe_id, force); } -static void ath10k_htc_control_tx_complete (struct sk_buff *skb) +static void ath10k_htc_control_tx_complete (void *context,struct sk_buff *skb) {kfree_skb (skb); }
@@ -110,20 +110,18 @@ static inline void ath10k_htc_restore_tx_skb(struct htc_target *target,static void ath10k_htc_notify_tx_completion (struct htc_endpoint *ep,struct sk_buff *skb) { -struct ath10k_skb_cb *skb_cb =ATH10K_SKB_CB (skb); -ath10k_dbg (ATH10K_DBG_HTC ,"%s: ep %d skb %p\n" , __func__, ep->ep_id, skb);ath10k_htc_restore_tx_skb (ep->target, skb); -if (!skb_cb->htc.complete) { +if (!ep->ep_callbacks.ep_tx_complete) {ath10k_warn ("no tx handler for eid %d\n" , ep->ep_id);dev_kfree_skb_any (skb);return ; } - skb_cb->htc.complete (skb); + ep->ep_callbacks.ep_tx_complete (ep->ep_callbacks.context, skb); }/* assumes htc_tx_lock is held */
@@ -741,6 +739,7 @@ int ath10k_htc_wait_target(struct htc_target *target)memset (&connect,0 ,sizeof (connect));memset (&resp,0 ,sizeof (resp)); connect.ep_callbacks.context = target; + connect.ep_callbacks.ep_tx_complete = ath10k_htc_control_tx_complete; connect.ep_callbacks.ep_rx_complete = ath10k_htc_control_rx_complete; connect.max_send_queue_depth =NUM_CONTROL_TX_BUFFERS ; connect.service_id =HTC_SVC_RSVD_CTRL ;
@@ -809,7 +808,6 @@ int ath10k_htc_connect_service(struct htc_target *target, } skb_cb =ATH10K_SKB_CB (skb); - skb_cb->htc.complete = ath10k_htc_control_tx_complete; skb_cb->htc.priv = target;INIT_COMPLETION (target->ctl_resp);
@@ -953,7 +951,6 @@ int ath10k_htc_start(struct htc_target *target)ath10k_dbg (ATH10K_DBG_HTC ,"HTC is using TX credit flow control\n" ); skb_cb =ATH10K_SKB_CB (skb); - skb_cb->htc.complete = ath10k_htc_control_tx_complete; skb_cb->htc.priv = target; status =ath10k_htc_send (target,HTC_EP_0 , skb);
drivers/net/wireless/ath/ath10k/htc.h +1 -0
@@ -80,6 +80,7 @@ struct htc_target_cb {struct htc_ep_callbacks {void *context; +void (*ep_tx_complete)(void *context,struct sk_buff *);void (*ep_rx_complete)(void *context,struct sk_buff *);void (*stop_queue)(void *context);void (*wake_queue)(void *context);
drivers/net/wireless/ath/ath10k/htt.c +1 -0
@@ -43,6 +43,7 @@ static int ath10k_htt_htc_attach(struct htt_struct *htt)memset (&response,0 ,sizeof (response)); connect.ep_callbacks.context = htt; + connect.ep_callbacks.ep_tx_complete = ath10k_htt_htc_tx_complete; connect.ep_callbacks.ep_rx_complete = ath10k_htt_t2h_msg_handler; connect.ep_callbacks.stop_queue = ath10k_htt_stop_queue; connect.ep_callbacks.wake_queue = ath10k_htt_wake_queue;
drivers/net/wireless/ath/ath10k/htt.h +1 -0
@@ -1295,6 +1295,7 @@ void ath10k_htt_tx_attach(struct htt_struct *htt);void ath10k_htt_tx_detach (struct htt_struct *htt);int ath10k_htt_rx_attach (struct htt_struct *htt);void ath10k_htt_rx_detach (struct htt_struct *htt); +void ath10k_htt_htc_tx_complete (void *context,struct sk_buff *skb);void ath10k_htt_t2h_msg_handler (void *context,struct sk_buff *skb);int ath10k_htt_h2t_ver_req_msg (struct htt_struct *htt);int ath10k_htt_send_rx_ring_cfg_ll (struct htt_struct *htt);
drivers/net/wireless/ath/ath10k/htt_tx.c +3 -11
@@ -112,7 +112,7 @@ struct htt_tx_info *ath10k_htt_tx_info_lookup(struct htt_struct *htt,return &htt->txi_pool[msdu_id]; } -static void ath10k_htt_htc_tx_complete (struct sk_buff *skb) +void ath10k_htt_htc_tx_complete (void *context,struct sk_buff *skb) {struct ath10k_skb_cb *skb_cb =ATH10K_SKB_CB (skb);struct htt_tx_info *txi;
@@ -160,7 +160,6 @@ static void ath10k_htt_htc_tx_complete(struct sk_buff *skb)int ath10k_htt_h2t_ver_req_msg (struct htt_struct *htt) { -struct ath10k_skb_cb *skb_cb;struct sk_buff *skb;struct htt_cmd *cmd;int len =0 ;
@@ -177,9 +176,7 @@ int ath10k_htt_h2t_ver_req_msg(struct htt_struct *htt) cmd = (struct htt_cmd *)skb->data; cmd->hdr.msg_type =HTT_H2T_MSG_TYPE_VERSION_REQ ; - skb_cb =ATH10K_SKB_CB (skb); - skb_cb->htc.complete = ath10k_htt_htc_tx_complete; - skb_cb->htt.is_conf = true; +ATH10K_SKB_CB (skb)->htt.is_conf = true; ret =ath10k_htc_send (htt->htc_target, htt->ep_id, skb);if (ret) {
@@ -192,7 +189,6 @@ int ath10k_htt_h2t_ver_req_msg(struct htt_struct *htt)int ath10k_htt_send_rx_ring_cfg_ll (struct htt_struct *htt) { -struct ath10k_skb_cb *skb_cb;struct sk_buff *skb;struct htt_cmd *cmd;struct htt_rx_ring_setup_ring *ring;
@@ -263,9 +259,7 @@ int ath10k_htt_send_rx_ring_cfg_ll(struct htt_struct *htt) ring->frag_info_offset =__cpu_to_le16 (rx_desc_offset (frag_info));#undef rx_desc_offset - skb_cb =ATH10K_SKB_CB (skb); - skb_cb->htc.complete = ath10k_htt_htc_tx_complete; - skb_cb->htt.is_conf = true; +ATH10K_SKB_CB (skb)->htt.is_conf = true; ret =ath10k_htc_send (htt->htc_target, htt->ep_id, skb);if (ret) {
@@ -316,7 +310,6 @@ int ath10k_htt_mgmt_tx(struct htt_struct *htt, struct sk_buff *msdu) min((int)msdu->len, HTT_MGMT_FRM_HDR_DOWNLOAD_LEN)); skb_cb =ATH10K_SKB_CB (txi->txdesc); - skb_cb->htc.complete = ath10k_htt_htc_tx_complete; skb_cb->htc.priv = txi; res =ath10k_htc_send (htt->htc_target, htt->ep_id, txi->txdesc);
@@ -444,7 +437,6 @@ int ath10k_htt_tx(struct htt_struct *htt, struct sk_buff *msdu)memcpy (cmd->data_tx.prefetch, msdu->data, prefetch_len); skb_cb =ATH10K_SKB_CB (txi->txdesc); - skb_cb->htc.complete = ath10k_htt_htc_tx_complete; skb_cb->htc.priv = txi; res =ath10k_htc_send (htt->htc_target, htt->ep_id, txi->txdesc);
drivers/net/wireless/ath/ath10k/wmi.c +3 -3
@@ -73,10 +73,10 @@ static struct sk_buff *ath10k_wmi_alloc_skb(u32 len)return skb; } -static void ath10k_wmi_htc_tx_complete (struct sk_buff *skb) +static void ath10k_wmi_htc_tx_complete (void *context,struct sk_buff *skb) {struct ath10k_skb_cb *skb_cb =ATH10K_SKB_CB (skb); -struct ath10k *ar = skb_cb->htc.priv; +struct ath10k *ar = context;dev_kfree_skb (skb);
@@ -109,7 +109,6 @@ static int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, }memset (skb_cb,0 ,sizeof (*skb_cb)); - skb_cb->htc.complete = ath10k_wmi_htc_tx_complete; skb_cb->htc.priv = ar;trace_ath10k_wmi_cmd (cmd_id, skb->data, skb->len);
@@ -1117,6 +1116,7 @@ int ath10k_wmi_connect_htc_service(struct ath10k *ar)/* these fields are the same for all service endpoints */ connect.ep_callbacks.context = ar; + connect.ep_callbacks.ep_tx_complete = ath10k_wmi_htc_tx_complete; connect.ep_callbacks.ep_rx_complete = ath10k_wmi_process_rx;/* connect to control service */
Signature · 1 line
1.7.9.5
PATCH 6/7 ath10k: remove `priv` from ath10k_skb_cb
In reply to Michal KaziorIntroduce msdu_id into ath10k_skb_cb to keep track of htt-related metadata.
This frees up 8 bytes of space in ath10k_skb_cb
making it easier to merge htt_tx_info.
--- drivers/net/wireless/ath/ath10k/core.h | 4 ++-- drivers/net/wireless/ath/ath10k/htc.c | 7 ------- drivers/net/wireless/ath/ath10k/htt_tx.c | 18 +++++++++++------- drivers/net/wireless/ath/ath10k/wmi.c | 2 -- 4 files changed, 13 insertions(+), 18 deletions(-)
drivers/net/wireless/ath/ath10k/core.h +2 -2
@@ -56,16 +56,16 @@ struct ath10k_skb_cb {struct {u8 vdev_id; +u16 msdu_id;bool is_offchan;bool is_conf; } __packed htt;struct {u8 credits_used; -void *priv; } __packed htc; -/* 18 bytes left on 64bit arch */ +/* 24 bytes left on 64bit arch */ } __packed;static inline struct ath10k_skb_cb *ATH10K_SKB_CB (struct sk_buff *skb)
drivers/net/wireless/ath/ath10k/htc.c +0 -7
@@ -762,7 +762,6 @@ int ath10k_htc_connect_service(struct htc_target *target,enum htc_endpoint_id assigned_ep =HTC_EP_COUNT ;struct htc_endpoint *ep;struct sk_buff *skb; -struct ath10k_skb_cb *skb_cb;unsigned int max_msg_size =0 ;int length, status;bool disable_credit_flow_ctrl = false;
@@ -807,9 +806,6 @@ int ath10k_htc_connect_service(struct htc_target *target, disable_credit_flow_ctrl = true; } - skb_cb =ATH10K_SKB_CB (skb); - skb_cb->htc.priv = target; -INIT_COMPLETION (target->ctl_resp); status =ath10k_htc_send (target,HTC_EP_0 , skb);
@@ -933,7 +929,6 @@ struct sk_buff *ath10k_htc_alloc_skb(int size)int ath10k_htc_start (struct htc_target *target) { -struct ath10k_skb_cb *skb_cb;struct sk_buff *skb;int status =0 ;struct htc_msg *msg;
@@ -950,8 +945,6 @@ int ath10k_htc_start(struct htc_target *target)ath10k_dbg (ATH10K_DBG_HTC ,"HTC is using TX credit flow control\n" ); - skb_cb =ATH10K_SKB_CB (skb); - skb_cb->htc.priv = target; status =ath10k_htc_send (target,HTC_EP_0 , skb);return status;
drivers/net/wireless/ath/ath10k/htt_tx.c +11 -7
@@ -115,9 +115,9 @@ struct htt_tx_info *ath10k_htt_tx_info_lookup(struct htt_struct *htt,void ath10k_htt_htc_tx_complete (void *context,struct sk_buff *skb) {struct ath10k_skb_cb *skb_cb =ATH10K_SKB_CB (skb); +struct htt_struct *htt = (struct htt_struct *)context; +struct device *dev = htt->ar->dev;struct htt_tx_info *txi; -struct htt_struct *htt; -struct device *dev;int ret;if (skb_cb->htt.is_conf) {
@@ -125,9 +125,13 @@ void ath10k_htt_htc_tx_complete(void *context, struct sk_buff *skb)return ; } - txi = skb_cb->htc.priv; - htt = txi->htt; - dev = htt->ar->dev; + txi =ath10k_htt_tx_info_lookup (htt, skb_cb->htt.msdu_id); +if (!txi) { +ath10k_warn ("tx completion failure, wrong htt msdu_id %d\n" , + skb_cb->htt.msdu_id); +return ; + } + txi->htc_tx_completed = true;if (skb_cb->is_aborted) {
@@ -310,7 +314,7 @@ int ath10k_htt_mgmt_tx(struct htt_struct *htt, struct sk_buff *msdu) min((int)msdu->len, HTT_MGMT_FRM_HDR_DOWNLOAD_LEN)); skb_cb =ATH10K_SKB_CB (txi->txdesc); - skb_cb->htc.priv = txi; + skb_cb->htt.msdu_id = txi->msdu_id; res =ath10k_htc_send (htt->htc_target, htt->ep_id, txi->txdesc);if (res)
@@ -437,7 +441,7 @@ int ath10k_htt_tx(struct htt_struct *htt, struct sk_buff *msdu)memcpy (cmd->data_tx.prefetch, msdu->data, prefetch_len); skb_cb =ATH10K_SKB_CB (txi->txdesc); - skb_cb->htc.priv = txi; + skb_cb->htt.msdu_id = txi->msdu_id; res =ath10k_htc_send (htt->htc_target, htt->ep_id, txi->txdesc);if (res)
drivers/net/wireless/ath/ath10k/wmi.c +0 -2
@@ -75,7 +75,6 @@ static struct sk_buff *ath10k_wmi_alloc_skb(u32 len)static void ath10k_wmi_htc_tx_complete (void *context,struct sk_buff *skb) { -struct ath10k_skb_cb *skb_cb =ATH10K_SKB_CB (skb);struct ath10k *ar = context;dev_kfree_skb (skb);
@@ -109,7 +108,6 @@ static int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, }memset (skb_cb,0 ,sizeof (*skb_cb)); - skb_cb->htc.priv = ar;trace_ath10k_wmi_cmd (cmd_id, skb->data, skb->len);
Signature · 1 line
1.7.9.5
PATCH 7/7 ath10k: share htt tx completion for data/mgmt tx
In reply to Michal KaziorRemoves code redundancy and eases future
refactoring up.
--- drivers/net/wireless/ath/ath10k/htt.h | 14 ++--- drivers/net/wireless/ath/ath10k/htt_rx.c | 49 +++++++++++---- drivers/net/wireless/ath/ath10k/txrx.c | 96 ++++++++---------------------- drivers/net/wireless/ath/ath10k/txrx.h | 5 +- 4 files changed, 69 insertions(+), 95 deletions(-)
drivers/net/wireless/ath/ath10k/htt.h +4 -10
@@ -1080,16 +1080,10 @@ struct htt_resp {/*** host side structures follow ***/ -struct htt_mgmt_tx_done { -u32 desc_id; -u32 status; -}; - -struct htt_data_tx_done { -enum htt_data_tx_status status; -u8 tid; -bool tid_invalid; -u16 msdu_id; +struct htt_tx_done { +u32 msdu_id; +bool discard; +bool no_ack; };struct htt_peer_map_event {
drivers/net/wireless/ath/ath10k/htt_rx.c +38 -11
65 lines not on this page · raw message
drivers/net/wireless/ath/ath10k/txrx.c +25 -71
132 lines not on this page · raw message
drivers/net/wireless/ath/ath10k/txrx.h +2 -3
@@ -19,9 +19,8 @@#include "htt.h" -void ath10k_data_tx_completed (struct htt_struct *htt, -struct htt_data_tx_done *ev); -void ath10k_mgmt_tx_completed (struct htt_struct *,struct htt_mgmt_tx_done *); +void ath10k_txrx_tx_completed (struct htt_struct *htt, +const struct htt_tx_done *tx_done);void ath10k_process_rx (struct ath10k *ar,struct htt_rx_info *info); struct ath10k_peer *ath10k_peer_find(struct ath10k *ar, int vdev_id,
Signature · 1 line
1.7.9.5
cover ath10k: htt tx cleanup
In reply to Michal KaziorQuoted 6 lines · Michal Kazior
My plan is to remove
htt_tx_infowrapper. Before the wrapper can be actually killed off htt tx code needs a cleanup.The cleanup seems like a generally good idea as
it merges and simplifies tx completion code.
Awesome! This makes it so much easier to handle packets inside ath10k.
Do we have any other per packet structs left in ath10k after your patches?
Quoted 5 lines
Michal Kazior (7):
ath10k: flattenhtt_tx_info
ath10k: share htc tx completion for data/mgmt tx
ath10k: move htt completion handler up in the code
ath10k: share a single htc tx completion for htt data/mgmt/conf tx
I applied these four.
Quoted 3 lines
ath10k: remove per-packet completion handling
ath10k: removeprivfromath10k_skb_cb
ath10k: share htt tx completion for data/mgmt tx
These three I wasn't able to apply as there were conflicts which were not that simple to fix. Can you rebase there three and resend, please?
Signature · 1 line
Kalle Valo
cover ath10k: htt tx cleanup
Quoted 6 lines · Kalle Valo
Quoted 4 lines · Michal Kazior
My plan is to remove
htt_tx_infowrapper. Before the wrapper can be actually killed off htt tx code needs a cleanup.
Quoted 6 lines
Quoted 2 lines
The cleanup seems like a generally good idea as
it merges and simplifies tx completion code.Awesome! This makes it so much easier to handle packets inside ath10k.
Do we have any other per packet structs left in ath10k after your patches?
I don't think so.
Quoted 6 lines
Quoted 3 lines
ath10k: remove per-packet completion handling
ath10k: removeprivfromath10k_skb_cb
ath10k: share htt tx completion for data/mgmt txThese three I wasn't able to apply as there were conflicts which were not that simple to fix. Can you rebase there three and resend, please?
Sure thing.
-- Pozdrawiam / Best regards, Michal Kazior.
PATCH 1/3 ath10k: remove per-packet completion handling
In reply to Kalle ValoHaving a tx completion handler in theath10k_skb_cb is very costly (memory wise). The
saved space will be used to merge htt_tx_info.
---
rebased on top of latest master
drivers/net/wireless/ath/ath10k/core.c | 1 + drivers/net/wireless/ath/ath10k/core.h | 3 +-- drivers/net/wireless/ath/ath10k/htc.c | 11 ++++------- drivers/net/wireless/ath/ath10k/htc.h | 1 + drivers/net/wireless/ath/ath10k/htt.c | 1 + drivers/net/wireless/ath/ath10k/htt.h | 1 + drivers/net/wireless/ath/ath10k/htt_tx.c | 14 +++----------- drivers/net/wireless/ath/ath10k/wmi.c | 6 +++--- 8 files changed, 15 insertions(+), 23 deletions(-)
drivers/net/wireless/ath/ath10k/core.c +1 -0
@@ -106,6 +106,7 @@ static int ath10k_init_connect_htc(struct ath10k *ar)memset (&connect,0 ,sizeof (connect)); connect.ep_callbacks.context = ar; + connect.ep_callbacks.ep_tx_complete =NULL ; connect.ep_callbacks.ep_rx_complete =NULL ; status =ath10k_wmi_connect_htc_service (ar);
drivers/net/wireless/ath/ath10k/core.h +1 -2
@@ -61,11 +61,10 @@ struct ath10k_skb_cb {struct {u8 credits_used; -void (*complete)(struct sk_buff *);void *priv; } __packed htc; -/* 10 bytes left on 64bit arch */ +/* 18 bytes left on 64bit arch */ } __packed;static inline struct ath10k_skb_cb *ATH10K_SKB_CB (struct sk_buff *skb)
drivers/net/wireless/ath/ath10k/htc.c +4 -7
@@ -74,7 +74,7 @@ static inline void ath10k_htc_send_complete_check(struct htc_endpoint *ep,ath10k_hif_send_complete_check (ep->target->ar, ep->ul_pipe_id, force); } -static void ath10k_htc_control_tx_complete (struct sk_buff *skb) +static void ath10k_htc_control_tx_complete (void *context,struct sk_buff *skb) {kfree_skb (skb); }
@@ -110,20 +110,18 @@ static inline void ath10k_htc_restore_tx_skb(struct htc_target *target,static void ath10k_htc_notify_tx_completion (struct htc_endpoint *ep,struct sk_buff *skb) { -struct ath10k_skb_cb *skb_cb =ATH10K_SKB_CB (skb); -ath10k_dbg (ATH10K_DBG_HTC ,"%s: ep %d skb %p\n" , __func__, ep->ep_id, skb);ath10k_htc_restore_tx_skb (ep->target, skb); -if (!skb_cb->htc.complete) { +if (!ep->ep_callbacks.ep_tx_complete) {ath10k_warn ("no tx handler for eid %d\n" , ep->ep_id);dev_kfree_skb_any (skb);return ; } - skb_cb->htc.complete (skb); + ep->ep_callbacks.ep_tx_complete (ep->ep_callbacks.context, skb); }/* assumes htc_tx_lock is held */
@@ -742,6 +740,7 @@ int ath10k_htc_wait_target(struct htc_target *target)memset (&connect,0 ,sizeof (connect));memset (&resp,0 ,sizeof (resp)); connect.ep_callbacks.context = target; + connect.ep_callbacks.ep_tx_complete = ath10k_htc_control_tx_complete; connect.ep_callbacks.ep_rx_complete = ath10k_htc_control_rx_complete; connect.max_send_queue_depth =NUM_CONTROL_TX_BUFFERS ; connect.service_id =HTC_SVC_RSVD_CTRL ;
@@ -810,7 +809,6 @@ int ath10k_htc_connect_service(struct htc_target *target, } skb_cb =ATH10K_SKB_CB (skb); - skb_cb->htc.complete = ath10k_htc_control_tx_complete; skb_cb->htc.priv = target;INIT_COMPLETION (target->ctl_resp);
@@ -952,7 +950,6 @@ int ath10k_htc_start(struct htc_target *target)ath10k_dbg (ATH10K_DBG_HTC ,"HTC is using TX credit flow control\n" ); skb_cb =ATH10K_SKB_CB (skb); - skb_cb->htc.complete = ath10k_htc_control_tx_complete; skb_cb->htc.priv = target; status =ath10k_htc_send (target,HTC_EP_0 , skb);
drivers/net/wireless/ath/ath10k/htc.h +1 -0
@@ -79,6 +79,7 @@ struct htc_target_cb {struct htc_ep_callbacks {void *context; +void (*ep_tx_complete)(void *context,struct sk_buff *);void (*ep_rx_complete)(void *context,struct sk_buff *);void (*stop_queue)(void *context);void (*wake_queue)(void *context);
drivers/net/wireless/ath/ath10k/htt.c +1 -0
@@ -43,6 +43,7 @@ static int ath10k_htt_htc_attach(struct htt_struct *htt)memset (&response,0 ,sizeof (response)); connect.ep_callbacks.context = htt; + connect.ep_callbacks.ep_tx_complete = ath10k_htt_htc_tx_complete; connect.ep_callbacks.ep_rx_complete = ath10k_htt_t2h_msg_handler; connect.ep_callbacks.stop_queue = ath10k_htt_stop_queue; connect.ep_callbacks.wake_queue = ath10k_htt_wake_queue;
drivers/net/wireless/ath/ath10k/htt.h +1 -0
@@ -1295,6 +1295,7 @@ void ath10k_htt_tx_attach(struct htt_struct *htt);void ath10k_htt_tx_detach (struct htt_struct *htt);int ath10k_htt_rx_attach (struct htt_struct *htt);void ath10k_htt_rx_detach (struct htt_struct *htt); +void ath10k_htt_htc_tx_complete (void *context,struct sk_buff *skb);void ath10k_htt_t2h_msg_handler (void *context,struct sk_buff *skb);int ath10k_htt_h2t_ver_req_msg (struct htt_struct *htt);int ath10k_htt_send_rx_ring_cfg_ll (struct htt_struct *htt);
drivers/net/wireless/ath/ath10k/htt_tx.c +3 -11
@@ -112,7 +112,7 @@ struct htt_tx_info *ath10k_htt_tx_info_lookup(struct htt_struct *htt,return &htt->txi_pool[msdu_id]; } -static void ath10k_htt_htc_tx_complete (struct sk_buff *skb) +void ath10k_htt_htc_tx_complete (void *context,struct sk_buff *skb) {struct ath10k_skb_cb *skb_cb =ATH10K_SKB_CB (skb);struct htt_tx_info *txi;
@@ -160,7 +160,6 @@ static void ath10k_htt_htc_tx_complete(struct sk_buff *skb)int ath10k_htt_h2t_ver_req_msg (struct htt_struct *htt) { -struct ath10k_skb_cb *skb_cb;struct sk_buff *skb;struct htt_cmd *cmd;int len =0 ;
@@ -177,9 +176,7 @@ int ath10k_htt_h2t_ver_req_msg(struct htt_struct *htt) cmd = (struct htt_cmd *)skb->data; cmd->hdr.msg_type =HTT_H2T_MSG_TYPE_VERSION_REQ ; - skb_cb =ATH10K_SKB_CB (skb); - skb_cb->htc.complete = ath10k_htt_htc_tx_complete; - skb_cb->htt.is_conf = true; +ATH10K_SKB_CB (skb)->htt.is_conf = true; ret =ath10k_htc_send (htt->htc_target, htt->ep_id, skb);if (ret) {
@@ -192,7 +189,6 @@ int ath10k_htt_h2t_ver_req_msg(struct htt_struct *htt)int ath10k_htt_send_rx_ring_cfg_ll (struct htt_struct *htt) { -struct ath10k_skb_cb *skb_cb;struct sk_buff *skb;struct htt_cmd *cmd;struct htt_rx_ring_setup_ring *ring;
@@ -263,9 +259,7 @@ int ath10k_htt_send_rx_ring_cfg_ll(struct htt_struct *htt) ring->frag_info_offset =__cpu_to_le16 (rx_desc_offset (frag_info));#undef rx_desc_offset - skb_cb =ATH10K_SKB_CB (skb); - skb_cb->htc.complete = ath10k_htt_htc_tx_complete; - skb_cb->htt.is_conf = true; +ATH10K_SKB_CB (skb)->htt.is_conf = true; ret =ath10k_htc_send (htt->htc_target, htt->ep_id, skb);if (ret) {
@@ -316,7 +310,6 @@ int ath10k_htt_mgmt_tx(struct htt_struct *htt, struct sk_buff *msdu) min((int)msdu->len, HTT_MGMT_FRM_HDR_DOWNLOAD_LEN)); skb_cb =ATH10K_SKB_CB (txi->txdesc); - skb_cb->htc.complete = ath10k_htt_htc_tx_complete; skb_cb->htc.priv = txi; res =ath10k_htc_send (htt->htc_target, htt->ep_id, txi->txdesc);
@@ -444,7 +437,6 @@ int ath10k_htt_tx(struct htt_struct *htt, struct sk_buff *msdu)memcpy (cmd->data_tx.prefetch, msdu->data, prefetch_len); skb_cb =ATH10K_SKB_CB (txi->txdesc); - skb_cb->htc.complete = ath10k_htt_htc_tx_complete; skb_cb->htc.priv = txi; res =ath10k_htc_send (htt->htc_target, htt->ep_id, txi->txdesc);
drivers/net/wireless/ath/ath10k/wmi.c +3 -3
@@ -74,10 +74,10 @@ static struct sk_buff *ath10k_wmi_alloc_skb(u32 len)return skb; } -static void ath10k_wmi_htc_tx_complete (struct sk_buff *skb) +static void ath10k_wmi_htc_tx_complete (void *context,struct sk_buff *skb) {struct ath10k_skb_cb *skb_cb =ATH10K_SKB_CB (skb); -struct ath10k *ar = skb_cb->htc.priv; +struct ath10k *ar = context;dev_kfree_skb (skb);
@@ -110,7 +110,6 @@ static int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, }memset (skb_cb,0 ,sizeof (*skb_cb)); - skb_cb->htc.complete = ath10k_wmi_htc_tx_complete; skb_cb->htc.priv = ar;trace_ath10k_wmi_cmd (cmd_id, skb->data, skb->len);
@@ -1119,6 +1118,7 @@ int ath10k_wmi_connect_htc_service(struct ath10k *ar)/* these fields are the same for all service endpoints */ connect.ep_callbacks.context = ar; + connect.ep_callbacks.ep_tx_complete = ath10k_wmi_htc_tx_complete; connect.ep_callbacks.ep_rx_complete = ath10k_wmi_process_rx;/* connect to control service */
Signature · 1 line
1.7.9.5
PATCH 2/3 ath10k: remove `priv` from ath10k_skb_cb
Introduce msdu_id into ath10k_skb_cb to keep track of htt-related metadata.
This frees up 8 bytes of space in ath10k_skb_cb
making it easier to merge htt_tx_info.
---
rebased on top of latest master
drivers/net/wireless/ath/ath10k/core.h | 4 ++-- drivers/net/wireless/ath/ath10k/htc.c | 7 ------- drivers/net/wireless/ath/ath10k/htt_tx.c | 18 +++++++++++------- drivers/net/wireless/ath/ath10k/wmi.c | 2 -- 4 files changed, 13 insertions(+), 18 deletions(-)
drivers/net/wireless/ath/ath10k/core.h +2 -2
@@ -55,16 +55,16 @@ struct ath10k_skb_cb {struct {u8 vdev_id; +u16 msdu_id;bool is_offchan;bool is_conf; } __packed htt;struct {u8 credits_used; -void *priv; } __packed htc; -/* 18 bytes left on 64bit arch */ +/* 24 bytes left on 64bit arch */ } __packed;static inline struct ath10k_skb_cb *ATH10K_SKB_CB (struct sk_buff *skb)
drivers/net/wireless/ath/ath10k/htc.c +0 -7
@@ -763,7 +763,6 @@ int ath10k_htc_connect_service(struct htc_target *target,enum htc_endpoint_id assigned_ep =HTC_EP_COUNT ;struct htc_endpoint *ep;struct sk_buff *skb; -struct ath10k_skb_cb *skb_cb;unsigned int max_msg_size =0 ;int length, status;bool disable_credit_flow_ctrl = false;
@@ -808,9 +807,6 @@ int ath10k_htc_connect_service(struct htc_target *target, disable_credit_flow_ctrl = true; } - skb_cb =ATH10K_SKB_CB (skb); - skb_cb->htc.priv = target; -INIT_COMPLETION (target->ctl_resp); status =ath10k_htc_send (target,HTC_EP_0 , skb);
@@ -932,7 +928,6 @@ struct sk_buff *ath10k_htc_alloc_skb(int size)int ath10k_htc_start (struct htc_target *target) { -struct ath10k_skb_cb *skb_cb;struct sk_buff *skb;int status =0 ;struct htc_msg *msg;
@@ -949,8 +944,6 @@ int ath10k_htc_start(struct htc_target *target)ath10k_dbg (ATH10K_DBG_HTC ,"HTC is using TX credit flow control\n" ); - skb_cb =ATH10K_SKB_CB (skb); - skb_cb->htc.priv = target; status =ath10k_htc_send (target,HTC_EP_0 , skb);return status;
drivers/net/wireless/ath/ath10k/htt_tx.c +11 -7
@@ -115,9 +115,9 @@ struct htt_tx_info *ath10k_htt_tx_info_lookup(struct htt_struct *htt,void ath10k_htt_htc_tx_complete (void *context,struct sk_buff *skb) {struct ath10k_skb_cb *skb_cb =ATH10K_SKB_CB (skb); +struct htt_struct *htt = (struct htt_struct *)context; +struct device *dev = htt->ar->dev;struct htt_tx_info *txi; -struct htt_struct *htt; -struct device *dev;int ret;if (skb_cb->htt.is_conf) {
@@ -125,9 +125,13 @@ void ath10k_htt_htc_tx_complete(void *context, struct sk_buff *skb)return ; } - txi = skb_cb->htc.priv; - htt = txi->htt; - dev = htt->ar->dev; + txi =ath10k_htt_tx_info_lookup (htt, skb_cb->htt.msdu_id); +if (!txi) { +ath10k_warn ("tx completion failure, wrong htt msdu_id %d\n" , + skb_cb->htt.msdu_id); +return ; + } + txi->htc_tx_completed = true;if (skb_cb->is_aborted) {
@@ -310,7 +314,7 @@ int ath10k_htt_mgmt_tx(struct htt_struct *htt, struct sk_buff *msdu) min((int)msdu->len, HTT_MGMT_FRM_HDR_DOWNLOAD_LEN)); skb_cb =ATH10K_SKB_CB (txi->txdesc); - skb_cb->htc.priv = txi; + skb_cb->htt.msdu_id = txi->msdu_id; res =ath10k_htc_send (htt->htc_target, htt->ep_id, txi->txdesc);if (res)
@@ -437,7 +441,7 @@ int ath10k_htt_tx(struct htt_struct *htt, struct sk_buff *msdu)memcpy (cmd->data_tx.prefetch, msdu->data, prefetch_len); skb_cb =ATH10K_SKB_CB (txi->txdesc); - skb_cb->htc.priv = txi; + skb_cb->htt.msdu_id = txi->msdu_id; res =ath10k_htc_send (htt->htc_target, htt->ep_id, txi->txdesc);if (res)
drivers/net/wireless/ath/ath10k/wmi.c +0 -2
@@ -76,7 +76,6 @@ static struct sk_buff *ath10k_wmi_alloc_skb(u32 len)static void ath10k_wmi_htc_tx_complete (void *context,struct sk_buff *skb) { -struct ath10k_skb_cb *skb_cb =ATH10K_SKB_CB (skb);struct ath10k *ar = context;dev_kfree_skb (skb);
@@ -110,7 +109,6 @@ static int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, }memset (skb_cb,0 ,sizeof (*skb_cb)); - skb_cb->htc.priv = ar;trace_ath10k_wmi_cmd (cmd_id, skb->data, skb->len);
Signature · 1 line
1.7.9.5
PATCH 3/3 ath10k: share htt tx completion for data/mgmt tx
In reply to Michal KaziorRemoves code redundancy and eases future
refactoring up.
---
rebased on top of latest master
drivers/net/wireless/ath/ath10k/htt.h | 14 ++--- drivers/net/wireless/ath/ath10k/htt_rx.c | 49 +++++++++++---- drivers/net/wireless/ath/ath10k/txrx.c | 96 ++++++++---------------------- drivers/net/wireless/ath/ath10k/txrx.h | 5 +- 4 files changed, 69 insertions(+), 95 deletions(-)
drivers/net/wireless/ath/ath10k/htt.h +4 -10
@@ -1080,16 +1080,10 @@ struct htt_resp {/*** host side structures follow ***/ -struct htt_mgmt_tx_done { -u32 desc_id; -u32 status; -}; - -struct htt_data_tx_done { -enum htt_data_tx_status status; -u8 tid; -bool tid_invalid; -u16 msdu_id; +struct htt_tx_done { +u32 msdu_id; +bool discard; +bool no_ack; };struct htt_peer_map_event {
drivers/net/wireless/ath/ath10k/htt_rx.c +38 -11
65 lines not on this page · raw message
drivers/net/wireless/ath/ath10k/txrx.c +25 -71
132 lines not on this page · raw message
drivers/net/wireless/ath/ath10k/txrx.h +2 -3
@@ -19,9 +19,8 @@#include "htt.h" -void ath10k_data_tx_completed (struct htt_struct *htt, -struct htt_data_tx_done *ev); -void ath10k_mgmt_tx_completed (struct htt_struct *,struct htt_mgmt_tx_done *); +void ath10k_txrx_tx_completed (struct htt_struct *htt, +const struct htt_tx_done *tx_done);void ath10k_process_rx (struct ath10k *ar,struct htt_rx_info *info); struct ath10k_peer *ath10k_peer_find(struct ath10k *ar, int vdev_id,
Signature · 1 line
1.7.9.5
PATCH 1/3 ath10k: remove per-packet completion handling
In reply to Michal KaziorQuoted 7 lines · Michal Kazior
Having a tx completion handler in the
ath10k_skb_cbis very costly (memory wise). The
saved space will be used to mergehtt_tx_info.Signed-off-by Michal Kazior <[email protected]>---
rebased on top of latest master
Thanks, all three applied.
Signature · 1 line
Kalle Valo
PATCH 1/3 ath10k: remove per-packet completion handling
Quoted 11 lines · Kalle Valo
Quoted 7 lines · Michal Kazior
Having a tx completion handler in the
ath10k_skb_cbis very costly (memory wise). The
saved space will be used to mergehtt_tx_info.Signed-off-by Michal Kazior <[email protected]>---
rebased on top of latest masterThanks, all three applied.
Oh, but there were conflicts. Please check extra carefully that I didn't break anything.
Also the "xx bytes left" in ath10k_skb_cb is most likely wrong. BTW, I think we have to remove that comment in the future. It causes conflicts very easily.
Signature · 1 line
Kalle Valo