Lines 1875-1881
Link Here
|
1875 |
&paddr, BUS_DMA_NOWAIT); |
1875 |
&paddr, BUS_DMA_NOWAIT); |
1876 |
if (error != 0 && error != EFBIG) { |
1876 |
if (error != 0 && error != EFBIG) { |
1877 |
device_printf(sc->sc_dev, |
1877 |
device_printf(sc->sc_dev, |
1878 |
"%s: can't not map mbuf, error %d\n", __func__, |
1878 |
"%s: can't map mbuf, error %d\n", __func__, |
1879 |
error); |
1879 |
error); |
1880 |
goto fail; |
1880 |
goto fail; |
1881 |
} |
1881 |
} |
Lines 2036-2041
Link Here
|
2036 |
m_freem(data->m); |
2036 |
m_freem(data->m); |
2037 |
data->m = NULL; |
2037 |
data->m = NULL; |
2038 |
} |
2038 |
} |
|
|
2039 |
if (data->ni != NULL) { |
2040 |
ieee80211_free_node(data->ni); |
2041 |
data->ni = NULL; |
2042 |
} |
2039 |
} |
2043 |
} |
2040 |
/* Clear TX descriptors. */ |
2044 |
/* Clear TX descriptors. */ |
2041 |
memset(ring->desc, 0, ring->desc_dma.size); |
2045 |
memset(ring->desc, 0, ring->desc_dma.size); |
Lines 2969-2975
Link Here
|
2969 |
return; |
2973 |
return; |
2970 |
} |
2974 |
} |
2971 |
/* Discard frames that are too short. */ |
2975 |
/* Discard frames that are too short. */ |
2972 |
if (len < sizeof (*wh)) { |
2976 |
if (len < sizeof (struct ieee80211_frame_ack)) { |
2973 |
DPRINTF(sc, IWN_DEBUG_RECV, "%s: frame too short: %d\n", |
2977 |
DPRINTF(sc, IWN_DEBUG_RECV, "%s: frame too short: %d\n", |
2974 |
__func__, len); |
2978 |
__func__, len); |
2975 |
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); |
2979 |
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); |
Lines 3021-3027
Link Here
|
3021 |
|
3025 |
|
3022 |
/* Grab a reference to the source node. */ |
3026 |
/* Grab a reference to the source node. */ |
3023 |
wh = mtod(m, struct ieee80211_frame *); |
3027 |
wh = mtod(m, struct ieee80211_frame *); |
3024 |
ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh); |
3028 |
if (len >= sizeof(struct ieee80211_frame_min)) |
|
|
3029 |
ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh); |
3030 |
else |
3031 |
ni = NULL; |
3025 |
nf = (ni != NULL && ni->ni_vap->iv_state == IEEE80211_S_RUN && |
3032 |
nf = (ni != NULL && ni->ni_vap->iv_state == IEEE80211_S_RUN && |
3026 |
(ic->ic_flags & IEEE80211_F_SCAN) == 0) ? sc->noise : -95; |
3033 |
(ic->ic_flags & IEEE80211_F_SCAN) == 0) ? sc->noise : -95; |
3027 |
|
3034 |
|
Lines 4047-4054
Link Here
|
4047 |
r2 = 0; /* Unused. */ |
4054 |
r2 = 0; /* Unused. */ |
4048 |
} else { |
4055 |
} else { |
4049 |
r1 = IWN_READ(sc, IWN_INT); |
4056 |
r1 = IWN_READ(sc, IWN_INT); |
4050 |
if (r1 == 0xffffffff || (r1 & 0xfffffff0) == 0xa5a5a5a0) |
4057 |
if (r1 == 0xffffffff || (r1 & 0xfffffff0) == 0xa5a5a5a0) { |
|
|
4058 |
IWN_UNLOCK(sc); |
4051 |
return; /* Hardware gone! */ |
4059 |
return; /* Hardware gone! */ |
|
|
4060 |
} |
4052 |
r2 = IWN_READ(sc, IWN_FH_INT); |
4061 |
r2 = IWN_READ(sc, IWN_FH_INT); |
4053 |
} |
4062 |
} |
4054 |
|
4063 |
|
Lines 4519-4525
Link Here
|
4519 |
return error; |
4528 |
return error; |
4520 |
} |
4529 |
} |
4521 |
/* Too many DMA segments, linearize mbuf. */ |
4530 |
/* Too many DMA segments, linearize mbuf. */ |
4522 |
m1 = m_collapse(m, M_NOWAIT, IWN_MAX_SCATTER); |
4531 |
m1 = m_collapse(m, M_NOWAIT, IWN_MAX_SCATTER - 1); |
4523 |
if (m1 == NULL) { |
4532 |
if (m1 == NULL) { |
4524 |
device_printf(sc->sc_dev, |
4533 |
device_printf(sc->sc_dev, |
4525 |
"%s: could not defrag mbuf\n", __func__); |
4534 |
"%s: could not defrag mbuf\n", __func__); |
Lines 4725-4731
Link Here
|
4725 |
return error; |
4734 |
return error; |
4726 |
} |
4735 |
} |
4727 |
/* Too many DMA segments, linearize mbuf. */ |
4736 |
/* Too many DMA segments, linearize mbuf. */ |
4728 |
m1 = m_collapse(m, M_NOWAIT, IWN_MAX_SCATTER); |
4737 |
m1 = m_collapse(m, M_NOWAIT, IWN_MAX_SCATTER - 1); |
4729 |
if (m1 == NULL) { |
4738 |
if (m1 == NULL) { |
4730 |
device_printf(sc->sc_dev, |
4739 |
device_printf(sc->sc_dev, |
4731 |
"%s: could not defrag mbuf\n", __func__); |
4740 |
"%s: could not defrag mbuf\n", __func__); |
Lines 4825-4832
Link Here
|
4825 |
/* NB: m is reclaimed on tx failure */ |
4834 |
/* NB: m is reclaimed on tx failure */ |
4826 |
ieee80211_free_node(ni); |
4835 |
ieee80211_free_node(ni); |
4827 |
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); |
4836 |
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); |
4828 |
} |
4837 |
} else |
4829 |
sc->sc_tx_timer = 5; |
4838 |
sc->sc_tx_timer = 5; |
4830 |
|
4839 |
|
4831 |
IWN_UNLOCK(sc); |
4840 |
IWN_UNLOCK(sc); |
4832 |
|
4841 |
|
Lines 4872-4880
Link Here
|
4872 |
if (iwn_tx_data(sc, m, ni) != 0) { |
4881 |
if (iwn_tx_data(sc, m, ni) != 0) { |
4873 |
ieee80211_free_node(ni); |
4882 |
ieee80211_free_node(ni); |
4874 |
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); |
4883 |
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); |
4875 |
continue; |
4884 |
} else |
4876 |
} |
4885 |
sc->sc_tx_timer = 5; |
4877 |
sc->sc_tx_timer = 5; |
|
|
4878 |
} |
4886 |
} |
4879 |
|
4887 |
|
4880 |
DPRINTF(sc, IWN_DEBUG_XMIT, "%s: done\n", __func__); |
4888 |
DPRINTF(sc, IWN_DEBUG_XMIT, "%s: done\n", __func__); |
Lines 4950-4956
Link Here
|
4950 |
IWN_LOCK(sc); |
4958 |
IWN_LOCK(sc); |
4951 |
memset(&sc->last_stat, 0, sizeof(struct iwn_stats)); |
4959 |
memset(&sc->last_stat, 0, sizeof(struct iwn_stats)); |
4952 |
IWN_UNLOCK(sc); |
4960 |
IWN_UNLOCK(sc); |
4953 |
error = 0; |
|
|
4954 |
break; |
4961 |
break; |
4955 |
default: |
4962 |
default: |
4956 |
error = EINVAL; |
4963 |
error = EINVAL; |
Lines 6818-6833
Link Here
|
6818 |
chan->active = htole16(dwell_active); |
6825 |
chan->active = htole16(dwell_active); |
6819 |
chan->passive = htole16(dwell_passive); |
6826 |
chan->passive = htole16(dwell_passive); |
6820 |
|
6827 |
|
6821 |
if (IEEE80211_IS_CHAN_5GHZ(c) && |
6828 |
if (IEEE80211_IS_CHAN_5GHZ(c)) |
6822 |
!(c->ic_flags & IEEE80211_CHAN_PASSIVE)) { |
|
|
6823 |
chan->rf_gain = 0x3b; |
6829 |
chan->rf_gain = 0x3b; |
6824 |
} else if (IEEE80211_IS_CHAN_5GHZ(c)) { |
6830 |
else |
6825 |
chan->rf_gain = 0x3b; |
|
|
6826 |
} else if (!(c->ic_flags & IEEE80211_CHAN_PASSIVE)) { |
6827 |
chan->rf_gain = 0x28; |
6831 |
chan->rf_gain = 0x28; |
6828 |
} else { |
|
|
6829 |
chan->rf_gain = 0x28; |
6830 |
} |
6831 |
|
6832 |
|
6832 |
DPRINTF(sc, IWN_DEBUG_STATE, |
6833 |
DPRINTF(sc, IWN_DEBUG_STATE, |
6833 |
"%s: chan %u flags 0x%x rf_gain 0x%x " |
6834 |
"%s: chan %u flags 0x%x rf_gain 0x%x " |
Lines 8809-8815
Link Here
|
8809 |
} |
8810 |
} |
8810 |
#ifdef IWN_DEBUG |
8811 |
#ifdef IWN_DEBUG |
8811 |
#define IWN_DESC(x) case x: return #x |
8812 |
#define IWN_DESC(x) case x: return #x |
8812 |
#define COUNTOF(array) (sizeof(array) / sizeof(array[0])) |
|
|
8813 |
|
8813 |
|
8814 |
/* |
8814 |
/* |
8815 |
* Translate CSR code to string |
8815 |
* Translate CSR code to string |
Lines 8880-8886
Link Here
|
8880 |
DPRINTF(sc, IWN_DEBUG_REGISTER, |
8880 |
DPRINTF(sc, IWN_DEBUG_REGISTER, |
8881 |
"CSR values: (2nd byte of IWN_INT_COALESCING is IWN_INT_PERIODIC)%s", |
8881 |
"CSR values: (2nd byte of IWN_INT_COALESCING is IWN_INT_PERIODIC)%s", |
8882 |
"\n"); |
8882 |
"\n"); |
8883 |
for (i = 0; i < COUNTOF(csr_tbl); i++){ |
8883 |
for (i = 0; i < nitems(csr_tbl); i++){ |
8884 |
DPRINTF(sc, IWN_DEBUG_REGISTER," %10s: 0x%08x ", |
8884 |
DPRINTF(sc, IWN_DEBUG_REGISTER," %10s: 0x%08x ", |
8885 |
iwn_get_csr_string(csr_tbl[i]), IWN_READ(sc, csr_tbl[i])); |
8885 |
iwn_get_csr_string(csr_tbl[i]), IWN_READ(sc, csr_tbl[i])); |
8886 |
if ((i+1) % 3 == 0) |
8886 |
if ((i+1) % 3 == 0) |