Date: Sun, 15 Sep 2013 03:47:07 GMT From: ccqin@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r257356 - in soc2013/ccqin/head/sys: dev/ath net80211 Message-ID: <201309150347.r8F3l7Wa059492@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ccqin Date: Sun Sep 15 03:47:06 2013 New Revision: 257356 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=257356 Log: Add ieee80211_ratectl_rc_info_get() to get the ieee80211_rc_info. If can be located in an mbuf, then use it; otherwise alloc a new one, zero it and attach it. * modify ath to use it. Modified: soc2013/ccqin/head/sys/dev/ath/if_ath.c soc2013/ccqin/head/sys/dev/ath/if_ath_tx.c soc2013/ccqin/head/sys/net80211/ieee80211_node.c soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.h Modified: soc2013/ccqin/head/sys/dev/ath/if_ath.c ============================================================================== --- soc2013/ccqin/head/sys/dev/ath/if_ath.c Sun Sep 15 01:44:07 2013 (r257355) +++ soc2013/ccqin/head/sys/dev/ath/if_ath.c Sun Sep 15 03:47:06 2013 (r257356) @@ -4057,7 +4057,6 @@ struct ieee80211_node *ni = bf->bf_node; struct ath_node *an = NULL; struct ieee80211_rc_info *rc_info = NULL; - struct m_tag *mtag; ATH_TX_UNLOCK_ASSERT(sc); ATH_TXQ_UNLOCK_ASSERT(txq); @@ -4091,20 +4090,7 @@ (ts->ts_status == 0 ? 0 : 1)); #endif /* net80211 ratectl */ - mtag = m_tag_locate(bf->bf_m, MTAG_ABI_NET80211, - NET80211_TAG_RATECTL, NULL); - if (NULL == mtag) { - IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, - "%s: no ratectl mbuf tag found.\n", __func__); - struct ieee80211_rc_info tmp_rc_info; - rc_info = &tmp_rc_info; - bzero(rc_info, sizeof(rc_info)); - } else { - IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, - "%s: found ratectl mbuf tag.\n", __func__); - rc_info = (struct ieee80211_rc_info*)(mtag + 1); - } - + rc_info = ieee80211_ratectl_rc_info_get(ni, bf->bf_m); ieee80211_ratectl_rc_info_set(rc_info, 1, (ts->ts_status == 0 ? 0 : 1), bf->bf_state.bfs_pktlen, Modified: soc2013/ccqin/head/sys/dev/ath/if_ath_tx.c ============================================================================== --- soc2013/ccqin/head/sys/dev/ath/if_ath_tx.c Sun Sep 15 01:44:07 2013 (r257355) +++ soc2013/ccqin/head/sys/dev/ath/if_ath_tx.c Sun Sep 15 03:47:06 2013 (r257356) @@ -1392,7 +1392,6 @@ struct ieee80211_node *ni = bf->bf_node; struct ieee80211_rc_info *rc_info = NULL; struct ieee80211_rc_series *rc = NULL; - struct m_tag *mtag; uint8_t rate, rix; int try0; @@ -1418,37 +1417,18 @@ #endif /* net80211 ratectl */ - mtag = m_tag_locate(bf->bf_m, MTAG_ABI_NET80211, - NET80211_TAG_RATECTL, NULL); -again: - if (NULL == mtag) { - mtag = m_tag_alloc(MTAG_ABI_NET80211, NET80211_TAG_RATECTL, - sizeof(struct ieee80211_rc_info), M_NOWAIT); - if (NULL == mtag) { - IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, - "%s: can't alloc mbuf tag for ratectl.\n", __func__); - goto again; - } - } else - IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, - "%s: nani? find mbuf tag for ratectl directly.\n", __func__); - - rc_info = (struct ieee80211_rc_info*)(mtag + 1); + rc_info = ieee80211_ratectl_rc_info_get(ni, bf->bf_m); rc = rc_info->iri_rc; - bzero(rc_info, sizeof(rc_info)); - + rc_info->iri_flags = 0; if (bf->bf_state.bfs_shpream) rc_info->iri_flags |= IEEE80211_RATECTL_INFO_SP; if (bf->bf_state.bfs_aggr) rc_info->iri_flags |= IEEE80211_RATECTL_INFO_AGGR; - rc_info->iri_framelen = bf->bf_state.bfs_pktlen; ieee80211_ratectl_rates(ni, rc_info); - m_tag_prepend(bf->bf_m, mtag); - rix = rc[0].rix; try0 = rc[0].tries; rate = ni->ni_txrate; @@ -4103,7 +4083,6 @@ struct ath_tid *atid = &an->an_tid[tid]; struct ath_tx_status *ts = &bf->bf_status.ds_txstat; struct ieee80211_rc_info *rc_info = NULL; - struct m_tag *mtag; /* The TID state is protected behind the TXQ lock */ ATH_TX_LOCK(sc); @@ -4162,25 +4141,13 @@ #endif /* net80211 ratectl */ - mtag = m_tag_locate(bf->bf_m, MTAG_ABI_NET80211, - NET80211_TAG_RATECTL, NULL); - if (NULL == mtag) { - IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, - "%s: no ratectl mbuf tag found.\n", __func__); - struct ieee80211_rc_info tmp_rc_info; - rc_info = &tmp_rc_info; - bzero(rc_info, sizeof(rc_info)); - } else { - IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, - "%s: found ratectl mbuf tag.\n", __func__); - rc_info = (struct ieee80211_rc_info*)(mtag + 1); - } - rc_info->iri_flags &= ~IEEE80211_RATECTL_INFO_AGGR; + rc_info = ieee80211_ratectl_rc_info_get(ni, bf->bf_m); ieee80211_ratectl_rc_info_set(rc_info, 1, (ts->ts_status == 0 ? 0 : 1), bf->bf_state.bfs_pktlen, ts->ts_shortretry, ts->ts_longretry, ts->ts_finaltsi, ts->ts_rate); + rc_info->iri_flags &= ~IEEE80211_RATECTL_INFO_AGGR; ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info); } @@ -4549,7 +4516,6 @@ ath_bufhead bf_cq; struct ath_tx_status ts = bf_first->bf_status.ds_txstat; struct ieee80211_rc_info *rc_info = NULL; - struct m_tag *mtag; TAILQ_INIT(&bf_q); TAILQ_INIT(&bf_cq); @@ -4566,21 +4532,9 @@ bf_first->bf_state.bfs_pktlen, bf_first->bf_state.bfs_nframes, bf_first->bf_state.bfs_nframes); #endif + /* net80211 ratectl */ - mtag = m_tag_locate(bf_first->bf_m, MTAG_ABI_NET80211, - NET80211_TAG_RATECTL, NULL); - if (NULL == mtag) { - IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, - "%s: no ratectl mbuf tag found.\n", __func__); - struct ieee80211_rc_info tmp_rc_info; - rc_info = &tmp_rc_info; - bzero(rc_info, sizeof(rc_info)); - } else { - IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, - "%s: found ratectl mbuf tag.\n", __func__); - rc_info = (struct ieee80211_rc_info*)(mtag + 1); - } - + rc_info = ieee80211_ratectl_rc_info_get(ni, bf_first->bf_m); ieee80211_ratectl_rc_info_set(rc_info, bf_first->bf_state.bfs_nframes, bf_first->bf_state.bfs_nframes, @@ -4731,8 +4685,7 @@ #endif int txseq; struct ieee80211_rc_info *rc_info = NULL; - struct m_tag *mtag; - + struct mbuf *m; DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: called; hwq_depth=%d\n", __func__, atid->hwq_depth); @@ -4862,11 +4815,9 @@ memcpy(rc, bf_first->bf_state.bfs_rc, sizeof(rc)); #endif /* - * Get the net80211 ratectl mtag here, as bf_first will - * be set to NULL later. + * Get the mbuf here, as bf_first will be set to NULL later. */ - mtag = m_tag_locate(bf_first->bf_m, MTAG_ABI_NET80211, - NET80211_TAG_RATECTL, NULL); + m = bf_first->bf_m; DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: txa_start=%d, tx_ok=%d, status=%.8x, flags=%.8x, " @@ -4990,23 +4941,12 @@ nbad); #endif /* net80211 ratectl */ - if (NULL == mtag) { - IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, - "%s: no ratectl mbuf tag found.\n", __func__); - struct ieee80211_rc_info tmp_rc_info; - rc_info = &tmp_rc_info; - bzero(rc_info, sizeof(rc_info)); - } else { - IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, - "%s: found ratectl mbuf tag.\n", __func__); - rc_info = (struct ieee80211_rc_info*)(mtag + 1); - } - - rc_info->iri_flags |= IEEE80211_RATECTL_INFO_AGGR; + rc_info = ieee80211_ratectl_rc_info_get(ni, m); ieee80211_ratectl_rc_info_set(rc_info, nframes, nbad, pktlen, ts.ts_shortretry, ts.ts_longretry, ts.ts_finaltsi, ts.ts_rate); + rc_info->iri_flags |= IEEE80211_RATECTL_INFO_AGGR; ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info); } @@ -5083,7 +5023,6 @@ struct ath_tx_status ts; int drops = 0; struct ieee80211_rc_info *rc_info = NULL; - struct m_tag *mtag; /* * Take a copy of this; filtering/cloning the frame may free the @@ -5105,27 +5044,13 @@ bf->bf_state.bfs_pktlen, 1, (ts.ts_status == 0) ? 0 : 1); #endif - mtag = m_tag_locate(bf->bf_m, MTAG_ABI_NET80211, - NET80211_TAG_RATECTL, NULL); - - if (NULL == mtag) { - IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, - "%s: no ratectl mbuf tag found.\n", __func__); - struct ieee80211_rc_info tmp_rc_info; - rc_info = &tmp_rc_info; - bzero(rc_info, sizeof(rc_info)); - } else { - IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, - "%s: found ratectl mbuf tag.\n", __func__); - rc_info = (struct ieee80211_rc_info*)(mtag + 1); - } - - rc_info->iri_flags &= ~IEEE80211_RATECTL_INFO_AGGR; + rc_info = ieee80211_ratectl_rc_info_get(ni, bf->bf_m); ieee80211_ratectl_rc_info_set(rc_info, 1, (ts.ts_status == 0 ? 0 : 1), bf->bf_state.bfs_pktlen, ts.ts_shortretry, ts.ts_longretry, ts.ts_finaltsi, ts.ts_rate); + rc_info->iri_flags &= ~IEEE80211_RATECTL_INFO_AGGR; ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info); } /* Modified: soc2013/ccqin/head/sys/net80211/ieee80211_node.c ============================================================================== --- soc2013/ccqin/head/sys/net80211/ieee80211_node.c Sun Sep 15 01:44:07 2013 (r257355) +++ soc2013/ccqin/head/sys/net80211/ieee80211_node.c Sun Sep 15 03:47:06 2013 (r257356) @@ -1074,8 +1074,6 @@ ieee80211_ies_cleanup(&ni->ni_ies); ieee80211_psq_cleanup(&ni->ni_psq); free(ni, M_80211_NODE); - IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_RATECTL, - "%s: after free(ni, M_80211_NODE).\n", __func__); } static void @@ -1735,7 +1733,7 @@ * to use ni_ic below to reclaim resources. */ #if 0 - IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_NODE, + IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, "%s %p<%s> in %s table\n", __func__, ni, ether_sprintf(ni->ni_macaddr), nt != NULL ? nt->nt_name : "<gone>"); Modified: soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.h ============================================================================== --- soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.h Sun Sep 15 01:44:07 2013 (r257355) +++ soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.h Sun Sep 15 03:47:06 2013 (r257356) @@ -329,4 +329,31 @@ rc_info->iri_txrate = txrate; } +__inline static struct ieee80211_rc_info * +ieee80211_ratectl_rc_info_get(struct ieee80211_node *ni, + struct mbuf *m) +{ + struct m_tag *mtag; + + mtag = m_tag_locate(m, MTAG_ABI_NET80211, + NET80211_TAG_RATECTL, NULL); + + IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, + "%s: %sratectl mbuf tag found.\n", __func__, + (NULL == mtag? "no ":"")); +again: + if (NULL == mtag) { + mtag = m_tag_alloc(MTAG_ABI_NET80211, NET80211_TAG_RATECTL, + sizeof(struct ieee80211_rc_info), M_NOWAIT); + if (NULL == mtag) { + IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, + "%s: can't alloc mbuf tag for ratectl.\n", __func__); + goto again; + } + bzero(mtag + 1, mtag->m_tag_len); + m_tag_prepend(m, mtag); + } + return (struct ieee80211_rc_info*)(mtag + 1); +} + #endif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201309150347.r8F3l7Wa059492>