Date: Tue, 27 Aug 2013 14:37:13 +0000 (UTC) From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254956 - head/sys/net80211 Message-ID: <201308271437.r7REbDrI023930@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: adrian Date: Tue Aug 27 14:37:13 2013 New Revision: 254956 URL: http://svnweb.freebsd.org/changeset/base/254956 Log: Create a new function to complete 802.11 mbuf transmission. The aim of this function is to eventually be the completion entry point for all 802.11 encapsulated mbufs. All the wifi drivers end up doing what is in this function so it's an easy win to turn it into a net80211 method and abstract out this code. Ideally the drivers will all eventually be modified to queue up completed mbufs and call this function with all the driver locks not held. This will allow for some much more interesting software queue handling in the future (like net80211 based A-MSDU, fast-frames, A-MPDU aggregation and retransmission.) Tested: * ath(4), iwn(4) Modified: head/sys/net80211/ieee80211_output.c head/sys/net80211/ieee80211_proto.h Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Tue Aug 27 11:50:33 2013 (r254955) +++ head/sys/net80211/ieee80211_output.c Tue Aug 27 14:37:13 2013 (r254956) @@ -3353,3 +3353,34 @@ ieee80211_ff_encap1(struct ieee80211vap mtod(m, struct ether_header *)->ether_type = htons(payload); return m; } + +/* + * Complete an mbuf transmission. + * + * For now, this simply processes a completed frame after the + * driver has completed it's transmission and/or retransmission. + * It assumes the frame is an 802.11 encapsulated frame. + * + * Later on it will grow to become the exit path for a given frame + * from the driver and, depending upon how it's been encapsulated + * and already transmitted, it may end up doing A-MPDU retransmission, + * power save requeuing, etc. + * + * In order for the above to work, the driver entry point to this + * must not hold any driver locks. Thus, the driver needs to delay + * any actual mbuf completion until it can release said locks. + * + * This frees the mbuf and if the mbuf has a node reference, + * the node reference will be freed. + */ +void +ieee80211_tx_complete(struct ieee80211_node *ni, struct mbuf *m, int status) +{ + + if (ni != NULL) { + if (m->m_flags & M_TXCB) + ieee80211_process_callback(ni, m, status); + ieee80211_free_node(ni); + } + m_freem(m); +} Modified: head/sys/net80211/ieee80211_proto.h ============================================================================== --- head/sys/net80211/ieee80211_proto.h Tue Aug 27 11:50:33 2013 (r254955) +++ head/sys/net80211/ieee80211_proto.h Tue Aug 27 14:37:13 2013 (r254956) @@ -127,6 +127,8 @@ int ieee80211_send_probereq(struct ieee8 const uint8_t *ssid, size_t ssidlen); struct mbuf * ieee80211_ff_encap1(struct ieee80211vap *, struct mbuf *, const struct ether_header *); +void ieee80211_tx_complete(struct ieee80211_node *, + struct mbuf *, int); /* * The formation of ProbeResponse frames requires guidance to
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308271437.r7REbDrI023930>