Commit ceb2e4ea authored by Pavani Muthyala's avatar Pavani Muthyala Committed by Kalle Valo

rsi: separate function for data packet descriptor

Data packet descriptor preparation code is moved a separate
function.
Signed-off-by: default avatarPavani Muthyala <pavani.muthyala@redpinesignals.com>
Signed-off-by: default avatarAmitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: default avatarPrameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 0eb42586
...@@ -108,25 +108,15 @@ static int rsi_prepare_mgmt_desc(struct rsi_common *common, struct sk_buff *skb) ...@@ -108,25 +108,15 @@ static int rsi_prepare_mgmt_desc(struct rsi_common *common, struct sk_buff *skb)
return 0; return 0;
} }
/** /* This function prepares descriptor for given data packet */
* rsi_send_data_pkt() - This function sends the recieved data packet from static int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff *skb)
* driver to device.
* @common: Pointer to the driver private structure.
* @skb: Pointer to the socket buffer structure.
*
* Return: status: 0 on success, -1 on failure.
*/
int rsi_send_data_pkt(struct rsi_common *common, struct sk_buff *skb)
{ {
struct rsi_hw *adapter = common->priv;
struct ieee80211_hdr *wh = NULL; struct ieee80211_hdr *wh = NULL;
struct ieee80211_tx_info *info; struct ieee80211_tx_info *info;
struct ieee80211_vif *vif = NULL;
struct skb_info *tx_params; struct skb_info *tx_params;
struct ieee80211_bss_conf *bss; struct ieee80211_bss_conf *bss;
struct rsi_data_desc *data_desc; struct rsi_data_desc *data_desc;
struct xtended_desc *xtend_desc; struct xtended_desc *xtend_desc;
int status;
u8 ieee80211_size = MIN_802_11_HDR_LEN; u8 ieee80211_size = MIN_802_11_HDR_LEN;
u8 header_size; u8 header_size;
u8 vap_id = 0; u8 vap_id = 0;
...@@ -137,22 +127,16 @@ int rsi_send_data_pkt(struct rsi_common *common, struct sk_buff *skb) ...@@ -137,22 +127,16 @@ int rsi_send_data_pkt(struct rsi_common *common, struct sk_buff *skb)
bss = &info->control.vif->bss_conf; bss = &info->control.vif->bss_conf;
tx_params = (struct skb_info *)info->driver_data; tx_params = (struct skb_info *)info->driver_data;
if (!bss->assoc) {
status = -EINVAL;
goto err;
}
header_size = FRAME_DESC_SZ + sizeof(struct xtended_desc); header_size = FRAME_DESC_SZ + sizeof(struct xtended_desc);
if (header_size > skb_headroom(skb)) { if (header_size > skb_headroom(skb)) {
rsi_dbg(ERR_ZONE, "%s: Unable to send pkt\n", __func__); rsi_dbg(ERR_ZONE, "%s: Unable to send pkt\n", __func__);
status = -ENOSPC; return -ENOSPC;
goto err;
} }
skb_push(skb, header_size); skb_push(skb, header_size);
dword_align_bytes = ((unsigned long)skb->data & 0x3f); dword_align_bytes = ((unsigned long)skb->data & 0x3f);
if (header_size > skb_headroom(skb)) { if (header_size > skb_headroom(skb)) {
rsi_dbg(ERR_ZONE, "%s: Not enough headroom\n", __func__); rsi_dbg(ERR_ZONE, "%s: Not enough headroom\n", __func__);
status = -ENOSPC; return -ENOSPC;
goto err;
} }
skb_push(skb, dword_align_bytes); skb_push(skb, dword_align_bytes);
header_size += dword_align_bytes; header_size += dword_align_bytes;
...@@ -164,7 +148,6 @@ int rsi_send_data_pkt(struct rsi_common *common, struct sk_buff *skb) ...@@ -164,7 +148,6 @@ int rsi_send_data_pkt(struct rsi_common *common, struct sk_buff *skb)
xtend_desc = (struct xtended_desc *)&skb->data[FRAME_DESC_SZ]; xtend_desc = (struct xtended_desc *)&skb->data[FRAME_DESC_SZ];
wh = (struct ieee80211_hdr *)&skb->data[header_size]; wh = (struct ieee80211_hdr *)&skb->data[header_size];
seq_num = (le16_to_cpu(wh->seq_ctrl) >> 4); seq_num = (le16_to_cpu(wh->seq_ctrl) >> 4);
vif = adapter->vifs[0];
data_desc->xtend_desc_size = header_size - FRAME_DESC_SZ; data_desc->xtend_desc_size = header_size - FRAME_DESC_SZ;
...@@ -227,11 +210,33 @@ int rsi_send_data_pkt(struct rsi_common *common, struct sk_buff *skb) ...@@ -227,11 +210,33 @@ int rsi_send_data_pkt(struct rsi_common *common, struct sk_buff *skb)
data_desc->sta_id = vap_id; data_desc->sta_id = vap_id;
} }
return 0;
}
/* This function sends received data packet from driver to device */
int rsi_send_data_pkt(struct rsi_common *common, struct sk_buff *skb)
{
struct rsi_hw *adapter = common->priv;
struct ieee80211_tx_info *info;
struct ieee80211_bss_conf *bss;
int status = -EIO;
info = IEEE80211_SKB_CB(skb);
bss = &info->control.vif->bss_conf;
if (!bss->assoc) {
status = -EINVAL;
goto err;
}
status = rsi_prepare_data_desc(common, skb);
if (status)
goto err;
status = adapter->host_intf_ops->write_pkt(common->priv, skb->data, status = adapter->host_intf_ops->write_pkt(common->priv, skb->data,
skb->len); skb->len);
if (status) if (status)
rsi_dbg(ERR_ZONE, "%s: Failed to write pkt\n", rsi_dbg(ERR_ZONE, "%s: Failed to write pkt\n", __func__);
__func__);
err: err:
++common->tx_stats.total_tx_pkt_freed[skb->priority]; ++common->tx_stats.total_tx_pkt_freed[skb->priority];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment