Commit 7868ee3b authored by Ajay Singh's avatar Ajay Singh Committed by Greg Kroah-Hartman

staging: wilc1000: refactor WILC_WFI_p2p_rx() to avoid line over 80 char

Fix 'line over 80 characters' issue found by checkpatch.pl script.
Refactor and split the function to avoid the checkpatch reported issues.
Signed-off-by: default avatarAjay Singh <ajay.kathat@microchip.com>
Reviewed-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 675a127e
......@@ -1358,12 +1358,49 @@ static void wilc_wfi_cfg_parse_tx_action(u8 *buf, u32 len, bool oper_ch,
op_channel_attr_index);
}
static void wilc_wfi_cfg_parse_rx_vendor_spec(struct wilc_priv *priv, u8 *buff,
u32 size)
{
int i;
u8 subtype;
struct wilc_vif *vif = netdev_priv(priv->dev);
subtype = buff[P2P_PUB_ACTION_SUBTYPE];
if ((subtype == GO_NEG_REQ || subtype == GO_NEG_RSP) && !wilc_ie) {
for (i = P2P_PUB_ACTION_SUBTYPE; i < size; i++) {
if (!memcmp(p2p_vendor_spec, &buff[i], 6)) {
p2p_recv_random = buff[i + 6];
wilc_ie = true;
break;
}
}
}
if (p2p_local_random <= p2p_recv_random) {
netdev_dbg(vif->ndev,
"PEER WILL BE GO LocaRand=%02x RecvRand %02x\n",
p2p_local_random, p2p_recv_random);
return;
}
if (subtype == GO_NEG_REQ || subtype == GO_NEG_RSP ||
subtype == P2P_INV_REQ || subtype == P2P_INV_RSP) {
for (i = P2P_PUB_ACTION_SUBTYPE + 2; i < size; i++) {
if (buff[i] == P2PELEM_ATTR_ID &&
!(memcmp(p2p_oui, &buff[i + 2], 4))) {
wilc_wfi_cfg_parse_rx_action(&buff[i + 6],
size - (i + 6));
break;
}
}
}
}
void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size)
{
struct wilc_priv *priv;
u32 header, pkt_offset;
struct host_if_drv *wfi_drv;
u32 i = 0;
s32 s32Freq;
priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
......@@ -1374,75 +1411,57 @@ void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size)
pkt_offset = GET_PKT_OFFSET(header);
if (pkt_offset & IS_MANAGMEMENT_CALLBACK) {
if (buff[FRAME_TYPE_ID] == IEEE80211_STYPE_PROBE_RESP) {
cfg80211_mgmt_tx_status(priv->wdev, priv->tx_cookie, buff, size, true, GFP_KERNEL);
return;
} else {
if (pkt_offset & IS_MGMT_STATUS_SUCCES)
cfg80211_mgmt_tx_status(priv->wdev, priv->tx_cookie, buff, size, true, GFP_KERNEL);
else
cfg80211_mgmt_tx_status(priv->wdev, priv->tx_cookie, buff, size, false, GFP_KERNEL);
bool ack = false;
if (buff[FRAME_TYPE_ID] == IEEE80211_STYPE_PROBE_RESP ||
pkt_offset & IS_MGMT_STATUS_SUCCES)
ack = true;
cfg80211_mgmt_tx_status(priv->wdev, priv->tx_cookie, buff, size,
ack, GFP_KERNEL);
return;
}
} else {
s32Freq = ieee80211_channel_to_frequency(curr_channel, NL80211_BAND_2GHZ);
if (ieee80211_is_action(buff[FRAME_TYPE_ID])) {
if (priv->cfg_scanning && time_after_eq(jiffies, (unsigned long)wfi_drv->p2p_timeout)) {
if (!ieee80211_is_action(buff[FRAME_TYPE_ID])) {
cfg80211_rx_mgmt(priv->wdev, s32Freq, 0, buff, size, 0);
return;
}
if (priv->cfg_scanning &&
time_after_eq(jiffies, (unsigned long)wfi_drv->p2p_timeout)) {
netdev_dbg(dev, "Receiving action wrong ch\n");
return;
}
if (buff[ACTION_CAT_ID] == PUB_ACTION_ATTR_ID) {
u8 subtype = buff[P2P_PUB_ACTION_SUBTYPE];
switch (buff[ACTION_SUBTYPE_ID]) {
case GAS_INITIAL_REQ:
break;
case GAS_INITIAL_RSP:
break;
case PUBLIC_ACT_VENDORSPEC:
if (!memcmp(p2p_oui, &buff[ACTION_SUBTYPE_ID + 1], 4)) {
if ((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP)) {
if (!wilc_ie) {
for (i = P2P_PUB_ACTION_SUBTYPE; i < size; i++) {
if (!memcmp(p2p_vendor_spec, &buff[i], 6)) {
p2p_recv_random = buff[i + 6];
wilc_ie = true;
break;
}
}
}
}
if (p2p_local_random > p2p_recv_random) {
if ((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP ||
buff[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_RSP)) {
for (i = P2P_PUB_ACTION_SUBTYPE + 2; i < size; i++) {
if (buff[i] == P2PELEM_ATTR_ID && !(memcmp(p2p_oui, &buff[i + 2], 4))) {
wilc_wfi_cfg_parse_rx_action(&buff[i + 6], size - (i + 6));
break;
}
}
}
} else {
netdev_dbg(dev, "PEER WILL BE GO LocaRand=%02x RecvRand %02x\n", p2p_local_random, p2p_recv_random);
}
}
if (!memcmp(p2p_oui, &buff[ACTION_SUBTYPE_ID + 1], 4))
wilc_wfi_cfg_parse_rx_vendor_spec(priv, buff,
size);
if ((subtype == GO_NEG_REQ || subtype == GO_NEG_RSP) &&
wilc_ie)
size -= 7;
if ((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP) && (wilc_ie)) {
cfg80211_rx_mgmt(priv->wdev, s32Freq, 0, buff, size - 7, 0);
return;
}
break;
default:
netdev_dbg(dev, "NOT HANDLED PUBLIC ACTION FRAME TYPE:%x\n", buff[ACTION_SUBTYPE_ID]);
netdev_dbg(dev,
"NOT HANDLED PUBLIC ACTION FRAME TYPE:%x\n",
buff[ACTION_SUBTYPE_ID]);
break;
}
}
}
cfg80211_rx_mgmt(priv->wdev, s32Freq, 0, buff, size, 0);
}
}
static void wilc_wfi_mgmt_tx_complete(void *priv, int status)
......
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