Author: adrian
Date: Mon Mar 11 06:54:58 2013
New Revision: 248146
URL: http://svnweb.freebsd.org/changeset/base/248146

Log:
  Add a few new fields to the RX vendor radiotap header:
  
  * a flags field that lets me know what's going on;
  * the hardware ratecode, unmolested by conversion to a bitrate;
  * the HAL rs_flags field, useful for debugging;
  * specifically mark aggregate sub-frames.
  
  This stuff sorely needs tidying up - it's missing some important
  stuff (eg numdelims) and it would be nice to put the flags at the
  beginning rather than at the end.
  
  Tested:
  
  * AR9380, STA mode, 2x2 HT40, monitoring RSSI and EVM values

Modified:
  head/sys/dev/ath/if_ath_rx.c
  head/sys/dev/ath/if_athioctl.h

Modified: head/sys/dev/ath/if_ath_rx.c
==============================================================================
--- head/sys/dev/ath/if_ath_rx.c        Mon Mar 11 06:17:46 2013        
(r248145)
+++ head/sys/dev/ath/if_ath_rx.c        Mon Mar 11 06:54:58 2013        
(r248146)
@@ -403,11 +403,27 @@ ath_rx_tap_vendor(struct ifnet *ifp, str
        sc->sc_rx_th.wr_v.evm[3] = rs->rs_evm3;
        sc->sc_rx_th.wr_v.evm[4] = rs->rs_evm4;
 
+       /* direction */
+       sc->sc_rx_th.wr_v.vh_flags = ATH_VENDOR_PKT_RX;
+
+       /* RX rate */
+       sc->sc_rx_th.wr_v.vh_rx_hwrate = rs->rs_rate;
+
+       /* RX flags */
+       sc->sc_rx_th.wr_v.vh_rs_flags = rs->rs_flags;
+
+       if (rs->rs_isaggr)
+               sc->sc_rx_th.wr_v.vh_flags |= ATH_VENDOR_PKT_ISAGGR;
+       if (rs->rs_moreaggr)
+               sc->sc_rx_th.wr_v.vh_flags |= ATH_VENDOR_PKT_MOREAGGR;
+
        /* phyerr info */
-       if (rs->rs_status & HAL_RXERR_PHY)
+       if (rs->rs_status & HAL_RXERR_PHY) {
                sc->sc_rx_th.wr_v.vh_phyerr_code = rs->rs_phyerr;
-       else
+               sc->sc_rx_th.wr_v.vh_flags |= ATH_VENDOR_PKT_RXPHYERR;
+       } else {
                sc->sc_rx_th.wr_v.vh_phyerr_code = 0xff;
+       }
        sc->sc_rx_th.wr_v.vh_rs_status = rs->rs_status;
        sc->sc_rx_th.wr_v.vh_rssi = rs->rs_rssi;
 }

Modified: head/sys/dev/ath/if_athioctl.h
==============================================================================
--- head/sys/dev/ath/if_athioctl.h      Mon Mar 11 06:17:46 2013        
(r248145)
+++ head/sys/dev/ath/if_athioctl.h      Mon Mar 11 06:54:58 2013        
(r248146)
@@ -305,7 +305,16 @@ struct ath_radiotap_vendor_hdr {           /* 30 
        uint8_t         vh_phyerr_code; /* Phy error code, or 0xff */
        uint8_t         vh_rs_status;   /* RX status */
        uint8_t         vh_rssi;        /* Raw RSSI */
-       uint8_t         vh_pad1[1];     /* Pad to 4 byte boundary */
+       uint8_t         vh_flags;       /* General flags */
+#define        ATH_VENDOR_PKT_RX       0x01
+#define        ATH_VENDOR_PKT_TX       0x02
+#define        ATH_VENDOR_PKT_RXPHYERR 0x04
+#define        ATH_VENDOR_PKT_ISAGGR   0x08
+#define        ATH_VENDOR_PKT_MOREAGGR 0x10
+
+       uint8_t         vh_rx_hwrate;   /* hardware RX ratecode */
+       uint8_t         vh_rs_flags;    /* RX HAL flags */
+       uint8_t         vh_pad[2];      /* pad to DWORD boundary */
 } __packed;
 #endif /* ATH_ENABLE_RADIOTAP_VENDOR_EXT */
 
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to