void ol_rx_addba_handler( ol_txrx_pdev_handle pdev, u_int16_t peer_id, u_int8_t tid, u_int8_t win_sz) { unsigned round_pwr2_win_sz, array_size; struct ol_txrx_peer_t *peer; struct ol_rx_reorder_t *rx_reorder; peer = ol_txrx_peer_find_by_id(pdev, peer_id); if (peer == NULL) { return; } rx_reorder = &peer->tids_rx_reorder[tid]; TXRX_ASSERT2(win_sz <= 64); round_pwr2_win_sz = OL_RX_REORDER_ROUND_PWR2(win_sz); array_size = round_pwr2_win_sz * sizeof(struct ol_rx_reorder_array_elem_t); rx_reorder->array = adf_os_mem_alloc(pdev->osdev, array_size); TXRX_ASSERT1(rx_reorder->array); adf_os_mem_set(rx_reorder->array, 0x0, array_size); rx_reorder->win_sz_mask = round_pwr2_win_sz - 1; }
/* * Porting from Ap11PrepareForwardedPacket. * This routine is called when a RX data frame from an associated station is * to be forwarded to another associated station. We will prepare the * received packet so that it is suitable for transmission again. * Check that this Packet is suitable for forwarding. If yes, then * prepare the new 802.11 header. */ static inline void ol_ap_fwd_check(struct ol_txrx_vdev_t *vdev, adf_nbuf_t msdu) { struct ieee80211_frame *mac_header; unsigned char tmp_addr[6]; unsigned char type; unsigned char subtype; unsigned char fromds; unsigned char tods; mac_header = (struct ieee80211_frame *) (adf_nbuf_data(msdu)); TXRX_ASSERT1(mac_header); type = mac_header->i_fc[0] & IEEE80211_FC0_TYPE_MASK; subtype = mac_header->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK; tods = mac_header->i_fc[1] & IEEE80211_FC1_DIR_TODS; fromds = mac_header->i_fc[1] & IEEE80211_FC1_DIR_FROMDS; /* * Make sure no QOS or any other non-data subtype * Should be a ToDs data frame. * Make sure that this frame is unicast and not for us. * These packets should come up through the normal rx path and not forwarded. */ if (type != IEEE80211_FC0_TYPE_DATA || subtype != 0x0 || ((tods != 1) || (fromds != 0)) || (adf_os_mem_cmp( mac_header->i_addr3, vdev->mac_addr.raw, IEEE80211_ADDR_LEN) == 0)) { #ifdef DEBUG_HOST_RC TXRX_PRINT(TXRX_PRINT_LEVEL_INFO1, "Exit: %s | Unnecessary to adjust mac header\n", __func__); #endif } else { // Flip the ToDs bit to FromDs mac_header->i_fc[1] &= 0xfe; mac_header->i_fc[1] |= 0x2; /* * Flip the addresses * (ToDs, addr1, RA=BSSID) move to (FrDs, addr2, TA=BSSID) * (ToDs, addr2, SA) move to (FrDs, addr3, SA) * (ToDs, addr3, DA) move to (FrDs, addr1, DA) */ memcpy(tmp_addr, mac_header->i_addr2, sizeof (tmp_addr)); memcpy(mac_header->i_addr2, mac_header->i_addr1, sizeof (tmp_addr)); memcpy(mac_header->i_addr1, mac_header->i_addr3, sizeof (tmp_addr)); memcpy(mac_header->i_addr3, tmp_addr, sizeof (tmp_addr)); } }