diff options
-rw-r--r-- | drivers/net/wireless/libertas/tx.c | 66 |
1 files changed, 24 insertions, 42 deletions
diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c index 749535e3f770..10596f3bb59a 100644 --- a/drivers/net/wireless/libertas/tx.c +++ b/drivers/net/wireless/libertas/tx.c | |||
@@ -49,16 +49,16 @@ static u32 convert_radiotap_rate_to_mv(u8 rate) | |||
49 | } | 49 | } |
50 | 50 | ||
51 | /** | 51 | /** |
52 | * @brief This function processes a single packet and sends | 52 | * @brief This function checks the conditions and sends packet to IF |
53 | * to IF layer | 53 | * layer if everything is ok. |
54 | * | 54 | * |
55 | * @param priv A pointer to struct lbs_private structure | 55 | * @param priv A pointer to struct lbs_private structure |
56 | * @param skb A pointer to skb which includes TX packet | 56 | * @param skb A pointer to skb which includes TX packet |
57 | * @return 0 or -1 | 57 | * @return 0 or -1 |
58 | */ | 58 | */ |
59 | static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb) | 59 | int lbs_process_tx(struct lbs_private *priv, struct sk_buff *skb) |
60 | { | 60 | { |
61 | int ret = 0; | 61 | int ret = -1; |
62 | struct txpd localtxpd; | 62 | struct txpd localtxpd; |
63 | struct txpd *plocaltxpd = &localtxpd; | 63 | struct txpd *plocaltxpd = &localtxpd; |
64 | u8 *p802x_hdr; | 64 | u8 *p802x_hdr; |
@@ -68,16 +68,31 @@ static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb) | |||
68 | 68 | ||
69 | lbs_deb_enter(LBS_DEB_TX); | 69 | lbs_deb_enter(LBS_DEB_TX); |
70 | 70 | ||
71 | lbs_deb_hex(LBS_DEB_TX, "TX Data", skb->data, min_t(unsigned int, skb->len, 100)); | ||
72 | |||
73 | if (priv->dnld_sent) { | ||
74 | lbs_pr_alert( "TX error: dnld_sent = %d, not sending\n", | ||
75 | priv->dnld_sent); | ||
76 | goto done; | ||
77 | } | ||
78 | |||
79 | if ((priv->psstate == PS_STATE_SLEEP) || | ||
80 | (priv->psstate == PS_STATE_PRE_SLEEP)) { | ||
81 | lbs_pr_alert("TX error: packet xmit in %ssleep mode\n", | ||
82 | priv->psstate == PS_STATE_SLEEP?"":"pre-"); | ||
83 | goto done; | ||
84 | } | ||
85 | |||
71 | if (priv->surpriseremoved) | 86 | if (priv->surpriseremoved) |
72 | return -1; | 87 | return -1; |
73 | 88 | ||
74 | if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) { | 89 | if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) { |
75 | lbs_deb_tx("tx err: skb length %d 0 or > %zd\n", | 90 | lbs_deb_tx("tx err: skb length %d 0 or > %zd\n", |
76 | skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE); | 91 | skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE); |
77 | ret = -1; | 92 | goto done_tx; |
78 | goto done; | ||
79 | } | 93 | } |
80 | 94 | ||
95 | ret = 0; | ||
81 | memset(plocaltxpd, 0, sizeof(struct txpd)); | 96 | memset(plocaltxpd, 0, sizeof(struct txpd)); |
82 | 97 | ||
83 | plocaltxpd->tx_packet_length = cpu_to_le16(skb->len); | 98 | plocaltxpd->tx_packet_length = cpu_to_le16(skb->len); |
@@ -130,12 +145,12 @@ static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb) | |||
130 | 145 | ||
131 | if (ret) { | 146 | if (ret) { |
132 | lbs_deb_tx("tx err: hw_host_to_card returned 0x%X\n", ret); | 147 | lbs_deb_tx("tx err: hw_host_to_card returned 0x%X\n", ret); |
133 | goto done; | 148 | goto done_tx; |
134 | } | 149 | } |
135 | 150 | ||
136 | lbs_deb_tx("SendSinglePacket succeeds\n"); | 151 | lbs_deb_tx("%s succeeds\n", __func__); |
137 | 152 | ||
138 | done: | 153 | done_tx: |
139 | if (!ret) { | 154 | if (!ret) { |
140 | priv->stats.tx_packets++; | 155 | priv->stats.tx_packets++; |
141 | priv->stats.tx_bytes += skb->len; | 156 | priv->stats.tx_bytes += skb->len; |
@@ -159,39 +174,6 @@ done: | |||
159 | dev_kfree_skb_any(skb); | 174 | dev_kfree_skb_any(skb); |
160 | } | 175 | } |
161 | 176 | ||
162 | lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret); | ||
163 | return ret; | ||
164 | } | ||
165 | |||
166 | |||
167 | /** | ||
168 | * @brief This function checks the conditions and sends packet to IF | ||
169 | * layer if everything is ok. | ||
170 | * | ||
171 | * @param priv A pointer to struct lbs_private structure | ||
172 | * @return n/a | ||
173 | */ | ||
174 | int lbs_process_tx(struct lbs_private *priv, struct sk_buff *skb) | ||
175 | { | ||
176 | int ret = -1; | ||
177 | |||
178 | lbs_deb_enter(LBS_DEB_TX); | ||
179 | lbs_deb_hex(LBS_DEB_TX, "TX Data", skb->data, min_t(unsigned int, skb->len, 100)); | ||
180 | |||
181 | if (priv->dnld_sent) { | ||
182 | lbs_pr_alert( "TX error: dnld_sent = %d, not sending\n", | ||
183 | priv->dnld_sent); | ||
184 | goto done; | ||
185 | } | ||
186 | |||
187 | if ((priv->psstate == PS_STATE_SLEEP) || | ||
188 | (priv->psstate == PS_STATE_PRE_SLEEP)) { | ||
189 | lbs_pr_alert("TX error: packet xmit in %ssleep mode\n", | ||
190 | priv->psstate == PS_STATE_SLEEP?"":"pre-"); | ||
191 | goto done; | ||
192 | } | ||
193 | |||
194 | ret = SendSinglePacket(priv, skb); | ||
195 | done: | 177 | done: |
196 | lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret); | 178 | lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret); |
197 | return ret; | 179 | return ret; |