svn commit: r193658 - head/sys/net80211

Sam Leffler sam at FreeBSD.org
Sun Jun 7 22:06:16 UTC 2009


Author: sam
Date: Sun Jun  7 22:06:15 2009
New Revision: 193658
URL: http://svn.freebsd.org/changeset/base/193658

Log:
  teach ieee80211_classify about ipv6 packets
  
  Reviewed by:	bz, rrs

Modified:
  head/sys/net80211/ieee80211_output.c

Modified: head/sys/net80211/ieee80211_output.c
==============================================================================
--- head/sys/net80211/ieee80211_output.c	Sun Jun  7 22:03:25 2009	(r193657)
+++ head/sys/net80211/ieee80211_output.c	Sun Jun  7 22:06:15 2009	(r193658)
@@ -28,6 +28,7 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_inet.h"
+#include "opt_inet6.h"
 #include "opt_wlan.h"
 
 #include <sys/param.h>
@@ -61,6 +62,9 @@ __FBSDID("$FreeBSD$");
 #include <netinet/in_systm.h>
 #include <netinet/ip.h>
 #endif
+#ifdef INET6
+#include <netinet/ip6.h>
+#endif
 
 #include <security/mac/mac_framework.h>
 
@@ -730,13 +734,13 @@ ieee80211_classify(struct ieee80211_node
 		v_wme_ac = TID_TO_WME_AC(EVL_PRIOFTAG(ni->ni_vlan));
 	}
 
+	/* XXX m_copydata may be too slow for fast path */
 #ifdef INET
 	if (eh->ether_type == htons(ETHERTYPE_IP)) {
 		uint8_t tos;
 		/*
 		 * IP frame, map the DSCP bits from the TOS field.
 		 */
-		/* XXX m_copydata may be too slow for fast path */
 		/* NB: ip header may not be in first mbuf */
 		m_copydata(m, sizeof(struct ether_header) +
 		    offsetof(struct ip, ip_tos), sizeof(tos), &tos);
@@ -744,7 +748,25 @@ ieee80211_classify(struct ieee80211_node
 		d_wme_ac = TID_TO_WME_AC(tos);
 	} else {
 #endif /* INET */
+#ifdef INET6
+	if (eh->ether_type == htons(ETHERTYPE_IPV6)) {
+		uint32_t flow;
+		uint8_t tos;
+		/*
+		 * IPv6 frame, map the DSCP bits from the TOS field.
+		 */
+		m_copydata(m, sizeof(struct ether_header) +
+		    offsetof(struct ip6_hdr, ip6_flow), sizeof(flow),
+		    (caddr_t) &flow);
+		tos = (uint8_t)(ntohl(flow) >> 20);
+		tos >>= 5;		/* NB: ECN + low 3 bits of DSCP */
+		d_wme_ac = TID_TO_WME_AC(tos);
+	} else {
+#endif /* INET6 */
 		d_wme_ac = WME_AC_BE;
+#ifdef INET6
+	}
+#endif
 #ifdef INET
 	}
 #endif


More information about the svn-src-head mailing list