- ath10驱动
检索关键字:retry
1.core.h
u32 tx_frame_count; /* Cycles spent transmitting frames */(line227)
u32 num_tx_frames_retries(line 203)
struct ath10k_fw_stats_vdev {
struct list_head list;
fw:firmware
struct ath10k_fw_stats_vdev {
struct list_head list;
u32 vdev_id;
u32 beacon_snr;
u32 data_snr;
u32 num_tx_frames[4];
u32 num_rx_frames;
u32 num_tx_frames_retries[4];
u32 num_tx_frames_failures[4];
u32 num_rts_fail;
u32 num_rts_success;
u32 num_rx_err;
u32 num_rx_discard;
u32 num_tx_not_acked;
u32 tx_rate_history[10];
u32 beacon_rssi_history[10];
};
2.wmi.h(wmi指的是Windows Management Instrumentation)
line4348-line4351
struct wlan_inst_rssi_args {
__le16 cfg_retry_count;
__le16 retry_count;
};
3.rx_desc.h
line31:ctrl_type
注释line103:
ctrl_type
- Set if packet is a control packet. Only set when first_msdu
- is set.
enum rx_attention_flags {
RX_ATTENTION_FLAGS_FIRST_MPDU = 1 << 0,
RX_ATTENTION_FLAGS_LAST_MPDU = 1 << 1,
RX_ATTENTION_FLAGS_MCAST_BCAST = 1 << 2,
RX_ATTENTION_FLAGS_PEER_IDX_INVALID = 1 << 3,
RX_ATTENTION_FLAGS_PEER_IDX_TIMEOUT = 1 << 4,
RX_ATTENTION_FLAGS_POWER_MGMT = 1 << 5,
RX_ATTENTION_FLAGS_NON_QOS = 1 << 6,
RX_ATTENTION_FLAGS_NULL_DATA = 1 << 7,
RX_ATTENTION_FLAGS_MGMT_TYPE = 1 << 8,
RX_ATTENTION_FLAGS_CTRL_TYPE = 1 << 9,
RX_ATTENTION_FLAGS_MORE_DATA = 1 << 10,
RX_ATTENTION_FLAGS_EOSP = 1 << 11,
RX_ATTENTION_FLAGS_U_APSD_TRIGGER = 1 << 12,
RX_ATTENTION_FLAGS_FRAGMENT = 1 << 13,
RX_ATTENTION_FLAGS_ORDER = 1 << 14,
RX_ATTENTION_FLAGS_CLASSIFICATION = 1 << 15,
RX_ATTENTION_FLAGS_OVERFLOW_ERR = 1 << 16,
RX_ATTENTION_FLAGS_MSDU_LENGTH_ERR = 1 << 17,
RX_ATTENTION_FLAGS_TCP_UDP_CHKSUM_FAIL = 1 << 18,
RX_ATTENTION_FLAGS_IP_CHKSUM_FAIL = 1 << 19,
RX_ATTENTION_FLAGS_SA_IDX_INVALID = 1 << 20,
RX_ATTENTION_FLAGS_DA_IDX_INVALID = 1 << 21,
RX_ATTENTION_FLAGS_SA_IDX_TIMEOUT = 1 << 22,
RX_ATTENTION_FLAGS_DA_IDX_TIMEOUT = 1 << 23,
RX_ATTENTION_FLAGS_ENCRYPT_REQUIRED = 1 << 24,
RX_ATTENTION_FLAGS_DIRECTED = 1 << 25,
RX_ATTENTION_FLAGS_BUFFER_FRAGMENT = 1 << 26,
RX_ATTENTION_FLAGS_MPDU_LENGTH_ERR = 1 << 27,
RX_ATTENTION_FLAGS_TKIP_MIC_ERR = 1 << 28,
RX_ATTENTION_FLAGS_DECRYPT_ERR = 1 << 29,
RX_ATTENTION_FLAGS_FCS_ERR = 1 << 30,
RX_ATTENTION_FLAGS_MSDU_DONE = 1 << 31,
};
line256:
#define RX_MPDU_START_INFO0_RETRY (1 << 14)
注释(line294):
* Retry bit from the frame control. Only valid when
* first_msdu is set.
控制字段的重传字段。1代表这个帧是重传的
seq_number
定义line249-250
#define RX_MPDU_START_INFO0_SEQ_NUM_MASK 0x0fff0000
#define RX_MPDU_START_INFO0_SEQ_NUM_LSB 16
注释line302:
seq_num
- The sequence number from the 802.11 header. Only valid when
- first_msdu is set.
灵感来源:
https://blog.csdn.net/weixin_42353331/article/details/86527421
这里面提及seq_number
sequence number(顺序编号)位的作用,相当于已传帧的计数器取4096 的模(modulo)。此计数器由0 起算,MAC 每处理一个上层封包就会累加1。
如果发生重传,则顺序编号不变,便于进行帧处理,丢弃重复帧
用这个信息可以判断帧被传了几次(不过这里应该是收)
检索信息:short
在htt.h文件找到
line 1034 excessive retries
/* excessive retries */
__le32 tx_ko;
line1043
/* frames dropped due to excessive sw retries */
__le32 sw_retry_failure;
line997
struct htt_dbg_stats_wal_tx_stats {
line1103
struct htt_dbg_stats_wal_pdev_txrx {
struct htt_dbg_stats_wal_tx_stats tx_stats;
struct htt_dbg_stats_wal_rx_stats rx_stats;
struct htt_dbg_stats_wal_peer_stats peer_stats;
} __packed;
mac.h文件
最后一个结构体
line83
static inline void ath10k_tx_h_seq_no(struct ieee80211_vif *vif, struct sk_buff *skb){ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; struct ath10k_vif *arvif = (void *)vif->drv_priv; if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { if (arvif->tx_seq_no == 0) arvif->tx_seq_no = 0x1000; if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) arvif->tx_seq_no += 0x10; hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); hdr->seq_ctrl |= cpu_to_le16(arvif->tx_seq_no); }}
解释在mac80211.h
- line596
- @IEEE80211_TX_CTL_ASSIGN_SEQ: The driver has to assign a sequence
- number to this frame, taking care of not overwriting the fragment
- number and increasing the sequence number only when the
- IEEE80211_TX_CTL_FIRST_FRAGMENT flag is set. mac80211 will properly
- assign sequence numbers to QoS-data frames but cannot do so correctly
- for non-QoS-data and management frames because beacons need them from
- that counter as well and mac80211 cannot guarantee proper sequencing.
- If this flag is set, the driver should instruct the hardware to
- assign a sequence number to the frame or assign one itself. Cf. IEEE
- 802.11-2007 7.1.3.4.1 paragraph 3. This flag will always be set for
- beacons and always be clear for frames without a sequence number field.
- 驱动程序必须为此帧分配一个序列号,序列号看是否是重传
检索ctl
得到一些控制字段的信息—ieee80211.h
ath10k里也有的
line43
#define IEEE80211_FCTL_VERS 0x0003
#define IEEE80211_FCTL_FTYPE 0x000c
#define IEEE80211_FCTL_STYPE 0x00f0
#define IEEE80211_FCTL_TODS 0x0100
#define IEEE80211_FCTL_FROMDS 0x0200
#define IEEE80211_FCTL_MOREFRAGS 0x0400
#define IEEE80211_FCTL_RETRY 0x0800
#define IEEE80211_FCTL_PM 0x1000
#define IEEE80211_FCTL_MOREDATA 0x2000
#define IEEE80211_FCTL_PROTECTED 0x4000
#define IEEE80211_FCTL_ORDER 0x8000
#define IEEE80211_FCTL_CTL_EXT 0x0f00/*extension 扩展*/
#define IEEE80211_SCTL_FRAG 0x000F
#define IEEE80211_SCTL_SEQ 0xFFF0
FCTL对应的是帧的控制字段
SCTL对应的是seq_ctl字段
ragment number(片段编号)在上层封包被切割处理时使用,第一个片段的编号为0。其后每个片段依序累加1,方便帧进行重组。所有帧片段都会具有相同的顺序编号,如果是重传帧,则顺序编号不会有任何改变。
sequence number(顺序编号)位的作用,相当于已传帧的计数器取4096 的模(modulo)。此计数器由0 起算,MAC 每处理一个上层封包就会累加1。
如果发生重传,则顺序编号不变,便于进行帧处理,丢弃重复帧。
主要是将我们发送的帧进行编号,对重新传输的帧进行刷选,保证帧的正确性。
- 对于我自己的网卡驱动rtl8821ae
- drivers\net\wireless\realtek\rtlwifi\rti8821ae
trx.c文件
line39
static u8 _rtl8821ae_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue)
{
__le16 fc = rtl_get_fc(skb);
if (unlikely(ieee80211_is_beacon(fc)))
return QSLT_BEACON;
if (ieee80211_is_mgmt(fc) || ieee80211_is_ctl(fc))
return QSLT_MGNT;
return skb->priority;
}
找ieee80211_is_ctl(fc)定义的地方
在include/linux/ieee80211.h
line61
#define IEEE80211_FTYPE_CTL 0x0004
用在line357-364
/**
* ieee80211_is_ctl - check if type is IEEE80211_FTYPE_CTL
* @fc: frame control bytes in little-endian byteorder
*/
static inline bool ieee80211_is_ctl(__le16 fc)
{
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
cpu_to_le16(IEEE80211_FTYPE_CTL);
}