if_ath.c (1b1a8e411e9723b152dfcc516eab368952870882) | if_ath.c (9cccabebd778a60157b313f05f2029c900b971d4) |
---|---|
1/*- 2 * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 962 unchanged lines hidden (view full) --- 971 bf->bf_node = NULL; 972 } 973 /* 974 * NB: the beacon data buffer must be 32-bit aligned; 975 * we assume the mbuf routines will return us something 976 * with this alignment (perhaps should assert). 977 */ 978 rs = &ni->ni_rates; | 1/*- 2 * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 962 unchanged lines hidden (view full) --- 971 bf->bf_node = NULL; 972 } 973 /* 974 * NB: the beacon data buffer must be 32-bit aligned; 975 * we assume the mbuf routines will return us something 976 * with this alignment (perhaps should assert). 977 */ 978 rs = &ni->ni_rates; |
979 pktlen = 8 + 2 + 2+ 2+ni->ni_esslen + 2+rs->rs_nrates + 6; | 979 pktlen = sizeof (struct ieee80211_frame) 980 + 8 + 2 + 2 + 2+ni->ni_esslen + 2+rs->rs_nrates + 6; |
980 if (rs->rs_nrates > IEEE80211_RATE_SIZE) 981 pktlen += 2; 982 if (pktlen <= MHLEN) 983 MGETHDR(m, M_DONTWAIT, MT_DATA); 984 else 985 m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); 986 if (m == NULL) { 987 DPRINTF(("ath_beacon_alloc: cannot get mbuf/cluster; size %u\n", --- 54 unchanged lines hidden (view full) --- 1042 *frm++ = 4; /* length */ 1043 *frm++ = 0; /* DTIM count */ 1044 *frm++ = 1; /* DTIM period */ 1045 *frm++ = 0; /* bitmap control */ 1046 *frm++ = 0; /* Partial Virtual Bitmap (variable length) */ 1047 } 1048 frm = ieee80211_add_xrates(frm, rs); 1049 m->m_pkthdr.len = m->m_len = frm - mtod(m, u_int8_t *); | 981 if (rs->rs_nrates > IEEE80211_RATE_SIZE) 982 pktlen += 2; 983 if (pktlen <= MHLEN) 984 MGETHDR(m, M_DONTWAIT, MT_DATA); 985 else 986 m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); 987 if (m == NULL) { 988 DPRINTF(("ath_beacon_alloc: cannot get mbuf/cluster; size %u\n", --- 54 unchanged lines hidden (view full) --- 1043 *frm++ = 4; /* length */ 1044 *frm++ = 0; /* DTIM count */ 1045 *frm++ = 1; /* DTIM period */ 1046 *frm++ = 0; /* bitmap control */ 1047 *frm++ = 0; /* Partial Virtual Bitmap (variable length) */ 1048 } 1049 frm = ieee80211_add_xrates(frm, rs); 1050 m->m_pkthdr.len = m->m_len = frm - mtod(m, u_int8_t *); |
1051 KASSERT(m->m_pkthdr.len <= pktlen, 1052 ("beacon bigger than expected, len %u calculated %u", 1053 m->m_pkthdr.len, pktlen)); |
|
1050 1051 DPRINTF2(("ath_beacon_alloc: m %p len %u\n", m, m->m_len)); 1052 error = bus_dmamap_load_mbuf(sc->sc_dmat, bf->bf_dmamap, m, 1053 ath_mbuf_load_cb, bf, 1054 BUS_DMA_NOWAIT); 1055 if (error != 0) { 1056 m_freem(m); 1057 return error; 1058 } 1059 KASSERT(bf->bf_nseg == 1, 1060 ("ath_beacon_alloc: multi-segment packet; nseg %u", 1061 bf->bf_nseg)); 1062 bf->bf_m = m; 1063 1064 /* setup descriptors */ 1065 ds = bf->bf_desc; 1066 1067 ds->ds_link = 0; 1068 ds->ds_data = bf->bf_segs[0].ds_addr; | 1054 1055 DPRINTF2(("ath_beacon_alloc: m %p len %u\n", m, m->m_len)); 1056 error = bus_dmamap_load_mbuf(sc->sc_dmat, bf->bf_dmamap, m, 1057 ath_mbuf_load_cb, bf, 1058 BUS_DMA_NOWAIT); 1059 if (error != 0) { 1060 m_freem(m); 1061 return error; 1062 } 1063 KASSERT(bf->bf_nseg == 1, 1064 ("ath_beacon_alloc: multi-segment packet; nseg %u", 1065 bf->bf_nseg)); 1066 bf->bf_m = m; 1067 1068 /* setup descriptors */ 1069 ds = bf->bf_desc; 1070 1071 ds->ds_link = 0; 1072 ds->ds_data = bf->bf_segs[0].ds_addr; |
1069 /* XXX verify mbuf data area covers this roundup */ | |
1070 /* 1071 * Calculate rate code. 1072 * XXX everything at min xmit rate 1073 */ 1074 rt = sc->sc_currates; 1075 KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode)); 1076 if (ic->ic_flags & IEEE80211_F_SHPREAMBLE) 1077 rate = rt->info[0].rateCode | rt->info[0].shortPreamble; --- 7 unchanged lines hidden (view full) --- 1085 , rate, 1 /* series 0 rate/tries */ 1086 , HAL_TXKEYIX_INVALID /* no encryption */ 1087 , 0 /* antenna mode */ 1088 , HAL_TXDESC_NOACK /* no ack for beacons */ 1089 , 0 /* rts/cts rate */ 1090 , 0 /* rts/cts duration */ 1091 ); 1092 /* NB: beacon's BufLen must be a multiple of 4 bytes */ | 1073 /* 1074 * Calculate rate code. 1075 * XXX everything at min xmit rate 1076 */ 1077 rt = sc->sc_currates; 1078 KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode)); 1079 if (ic->ic_flags & IEEE80211_F_SHPREAMBLE) 1080 rate = rt->info[0].rateCode | rt->info[0].shortPreamble; --- 7 unchanged lines hidden (view full) --- 1088 , rate, 1 /* series 0 rate/tries */ 1089 , HAL_TXKEYIX_INVALID /* no encryption */ 1090 , 0 /* antenna mode */ 1091 , HAL_TXDESC_NOACK /* no ack for beacons */ 1092 , 0 /* rts/cts rate */ 1093 , 0 /* rts/cts duration */ 1094 ); 1095 /* NB: beacon's BufLen must be a multiple of 4 bytes */ |
1096 /* XXX verify mbuf data area covers this roundup */ |
|
1093 ath_hal_filltxdesc(ah, ds 1094 , roundup(bf->bf_segs[0].ds_len, 4) /* buffer length */ 1095 , AH_TRUE /* first segment */ 1096 , AH_TRUE /* last segment */ 1097 ); 1098 1099 return 0; 1100} --- 1467 unchanged lines hidden --- | 1097 ath_hal_filltxdesc(ah, ds 1098 , roundup(bf->bf_segs[0].ds_len, 4) /* buffer length */ 1099 , AH_TRUE /* first segment */ 1100 , AH_TRUE /* last segment */ 1101 ); 1102 1103 return 0; 1104} --- 1467 unchanged lines hidden --- |