- Use netdev_dbg() instead of RTLLIB_DEBUG_MGMT() - Remove RTLLIB_DEBUG_MGMT() - Pass net_device to auth_parse(), auth_rq_parse() and assoc_rq_parse() - Remove duplicated messages Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@xxxxxxxxx> --- drivers/staging/rtl8192e/rtllib.h | 2 - drivers/staging/rtl8192e/rtllib_rx.c | 71 +++++++++++++++---------------- drivers/staging/rtl8192e/rtllib_softmac.c | 50 ++++++++++------------ 3 files changed, 58 insertions(+), 65 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index a9b9cb9..faf94b4 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -703,8 +703,6 @@ do { \ #define RTLLIB_DL_ERR (1<<31) #define RTLLIB_DEBUG_INFO(f, a...) RTLLIB_DEBUG(RTLLIB_DL_INFO, f, ## a) -#define RTLLIB_DEBUG_MGMT(f, a...) RTLLIB_DEBUG(RTLLIB_DL_MGMT, f, ## a) - #ifndef ETH_P_PAE #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ #define ETH_P_IP 0x0800 /* Internet Protocol packet */ diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 1efdace..1c4eec2 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -1925,8 +1925,8 @@ static void rtllib_parse_mife_generic(struct rtllib_device *ieee, if (info_element->len > 4 && info_element->data[0] == 0x00 && info_element->data[1] == 0x50 && info_element->data[2] == 0xf2 && info_element->data[3] == 0x04) { - RTLLIB_DEBUG_MGMT("MFIE_TYPE_WZC: %d bytes\n", - info_element->len); + netdev_dbg(ieee->dev, "MFIE_TYPE_WZC: %d bytes\n", + info_element->len); network->wzc_ie_len = min(info_element->len+2, MAX_WZC_IE_LEN); memcpy(network->wzc_ie, info_element, network->wzc_ie_len); } @@ -1947,10 +1947,10 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, while (length >= sizeof(*info_element)) { if (sizeof(*info_element) + info_element->len > length) { - RTLLIB_DEBUG_MGMT("Info elem: parse failed: info_element->len + 2 > left : info_element->len+2=%zd left=%d, id=%d.\n", - info_element->len + - sizeof(*info_element), - length, info_element->id); + netdev_dbg(ieee->dev, + "Info elem: parse failed: info_element->len + 2 > left : info_element->len+2=%zd left=%d, id=%d.\n", + info_element->len + sizeof(*info_element), + length, info_element->id); /* We stop processing but don't return an error here * because some misbehaviour APs break this rule. ie. * Orinoco AP1000. @@ -1973,8 +1973,8 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, memset(network->ssid + network->ssid_len, 0, IW_ESSID_MAX_SIZE - network->ssid_len); - RTLLIB_DEBUG_MGMT("MFIE_TYPE_SSID: '%s' len=%d.\n", - network->ssid, network->ssid_len); + netdev_dbg(ieee->dev, "MFIE_TYPE_SSID: '%s' len=%d.\n", + network->ssid, network->ssid_len); break; case MFIE_TYPE_RATES: @@ -2001,8 +2001,8 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, } } - RTLLIB_DEBUG_MGMT("MFIE_TYPE_RATES: '%s' (%d)\n", - rates_str, network->rates_len); + netdev_dbg(ieee->dev, "MFIE_TYPE_RATES: '%s' (%d)\n", + rates_str, network->rates_len); break; case MFIE_TYPE_RATES_EX: @@ -2024,22 +2024,22 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, } } - RTLLIB_DEBUG_MGMT("MFIE_TYPE_RATES_EX: '%s' (%d)\n", - rates_str, network->rates_ex_len); + netdev_dbg(ieee->dev, "MFIE_TYPE_RATES_EX: '%s' (%d)\n", + rates_str, network->rates_ex_len); break; case MFIE_TYPE_DS_SET: - RTLLIB_DEBUG_MGMT("MFIE_TYPE_DS_SET: %d\n", - info_element->data[0]); + netdev_dbg(ieee->dev, "MFIE_TYPE_DS_SET: %d\n", + info_element->data[0]); network->channel = info_element->data[0]; break; case MFIE_TYPE_FH_SET: - RTLLIB_DEBUG_MGMT("MFIE_TYPE_FH_SET: ignored\n"); + netdev_dbg(ieee->dev, "MFIE_TYPE_FH_SET: ignored\n"); break; case MFIE_TYPE_CF_SET: - RTLLIB_DEBUG_MGMT("MFIE_TYPE_CF_SET: ignored\n"); + netdev_dbg(ieee->dev, "MFIE_TYPE_CF_SET: ignored\n"); break; case MFIE_TYPE_TIM: @@ -2078,22 +2078,22 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, case MFIE_TYPE_ERP: network->erp_value = info_element->data[0]; network->flags |= NETWORK_HAS_ERP_VALUE; - RTLLIB_DEBUG_MGMT("MFIE_TYPE_ERP_SET: %d\n", - network->erp_value); + netdev_dbg(ieee->dev, "MFIE_TYPE_ERP_SET: %d\n", + network->erp_value); break; case MFIE_TYPE_IBSS_SET: network->atim_window = info_element->data[0]; - RTLLIB_DEBUG_MGMT("MFIE_TYPE_IBSS_SET: %d\n", - network->atim_window); + netdev_dbg(ieee->dev, "MFIE_TYPE_IBSS_SET: %d\n", + network->atim_window); break; case MFIE_TYPE_CHALLENGE: - RTLLIB_DEBUG_MGMT("MFIE_TYPE_CHALLENGE: ignored\n"); + netdev_dbg(ieee->dev, "MFIE_TYPE_CHALLENGE: ignored\n"); break; case MFIE_TYPE_GENERIC: - RTLLIB_DEBUG_MGMT("MFIE_TYPE_GENERIC: %d bytes\n", - info_element->len); + netdev_dbg(ieee->dev, "MFIE_TYPE_GENERIC: %d bytes\n", + info_element->len); rtllib_parse_mife_generic(ieee, info_element, network, &tmp_htcap_len, @@ -2101,8 +2101,8 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, break; case MFIE_TYPE_RSN: - RTLLIB_DEBUG_MGMT("MFIE_TYPE_RSN: %d bytes\n", - info_element->len); + netdev_dbg(ieee->dev, "MFIE_TYPE_RSN: %d bytes\n", + info_element->len); network->rsn_ie_len = min(info_element->len + 2, MAX_WPA_IE_LEN); memcpy(network->rsn_ie, info_element, @@ -2183,10 +2183,10 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, break; /* TODO */ default: - RTLLIB_DEBUG_MGMT - ("Unsupported info element: %s (%d)\n", - get_info_element_string(info_element->id), - info_element->id); + netdev_dbg(ieee->dev, + "Unsupported info element: %s (%d)\n", + get_info_element_string(info_element->id), + info_element->id); break; } @@ -2645,8 +2645,8 @@ void rtllib_rx_mgt(struct rtllib_device *ieee, switch (WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl))) { case RTLLIB_STYPE_BEACON: - RTLLIB_DEBUG_MGMT("received BEACON (%d)\n", - WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl))); + netdev_dbg(ieee->dev, "received BEACON (%d)\n", + WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl))); rtllib_process_probe_response( ieee, (struct rtllib_probe_response *)header, stats); @@ -2659,15 +2659,14 @@ void rtllib_rx_mgt(struct rtllib_device *ieee, break; case RTLLIB_STYPE_PROBE_RESP: - RTLLIB_DEBUG_MGMT("received PROBE RESPONSE (%d)\n", - WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl))); + netdev_dbg(ieee->dev, "received PROBE RESPONSE (%d)\n", + WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl))); rtllib_process_probe_response(ieee, (struct rtllib_probe_response *)header, stats); break; case RTLLIB_STYPE_PROBE_REQ: - RTLLIB_DEBUG_MGMT("received PROBE RESQUEST (%d)\n", - WLAN_FC_GET_STYPE( - le16_to_cpu(header->frame_ctl))); + netdev_dbg(ieee->dev, "received PROBE RESQUEST (%d)\n", + WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl))); if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) && ((ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER) && diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index ffa182b..b8405db 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -1438,10 +1438,10 @@ void rtllib_associate_abort(struct rtllib_device *ieee) * with, so we retry or just get back to NO_LINK and scanning */ if (ieee->state == RTLLIB_ASSOCIATING_AUTHENTICATING) { - RTLLIB_DEBUG_MGMT("Authentication failed\n"); + netdev_dbg(ieee->dev, "Authentication failed\n"); ieee->softmac_stats.no_auth_rs++; } else { - RTLLIB_DEBUG_MGMT("Association failed\n"); + netdev_dbg(ieee->dev, "Association failed\n"); ieee->softmac_stats.no_ass_rs++; } @@ -1463,7 +1463,7 @@ static void rtllib_associate_step1(struct rtllib_device *ieee, u8 *daddr) struct rtllib_network *beacon = &ieee->current_network; struct sk_buff *skb; - RTLLIB_DEBUG_MGMT("Stopping scan\n"); + netdev_dbg(ieee->dev, "Stopping scan\n"); ieee->softmac_stats.tx_auth_rq++; @@ -1473,7 +1473,7 @@ static void rtllib_associate_step1(struct rtllib_device *ieee, u8 *daddr) rtllib_associate_abort(ieee); else { ieee->state = RTLLIB_ASSOCIATING_AUTHENTICATING; - RTLLIB_DEBUG_MGMT("Sending authentication request\n"); + netdev_dbg(ieee->dev, "Sending authentication request\n"); softmac_mgmt_xmit(skb, ieee); if (!timer_pending(&ieee->associate_timer)) { ieee->associate_timer.expires = jiffies + (HZ / 2); @@ -1501,7 +1501,8 @@ static void rtllib_auth_challenge(struct rtllib_device *ieee, u8 *challenge, int *(c++) = chlen; memcpy(c, challenge, chlen); - RTLLIB_DEBUG_MGMT("Sending authentication challenge response\n"); + netdev_dbg(ieee->dev, + "Sending authentication challenge response\n"); rtllib_encrypt_fragment(ieee, skb, sizeof(struct rtllib_hdr_3addr)); @@ -1519,7 +1520,7 @@ static void rtllib_associate_step2(struct rtllib_device *ieee) del_timer_sync(&ieee->associate_timer); - RTLLIB_DEBUG_MGMT("Sending association request\n"); + netdev_dbg(ieee->dev, "Sending association request\n"); ieee->softmac_stats.tx_ass_rq++; skb = rtllib_association_req(beacon, ieee); @@ -1792,14 +1793,15 @@ void rtllib_softmac_check_all_nets(struct rtllib_device *ieee) spin_unlock_irqrestore(&ieee->lock, flags); } -static inline u16 auth_parse(struct sk_buff *skb, u8 **challenge, int *chlen) +static inline u16 auth_parse(struct net_device *dev, struct sk_buff *skb, + u8 **challenge, int *chlen) { struct rtllib_authentication *a; u8 *t; if (skb->len < (sizeof(struct rtllib_authentication) - sizeof(struct rtllib_info_element))) { - RTLLIB_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len); + netdev_dbg(dev, "invalid len in auth resp: %d\n", skb->len); return 0xcafe; } *challenge = NULL; @@ -1817,14 +1819,13 @@ static inline u16 auth_parse(struct sk_buff *skb, u8 **challenge, int *chlen) return cpu_to_le16(a->status); } -static int auth_rq_parse(struct sk_buff *skb, u8 *dest) +static int auth_rq_parse(struct net_device *dev, struct sk_buff *skb, u8 *dest) { struct rtllib_authentication *a; if (skb->len < (sizeof(struct rtllib_authentication) - sizeof(struct rtllib_info_element))) { - RTLLIB_DEBUG_MGMT("invalid len in auth request: %d\n", - skb->len); + netdev_dbg(dev, "invalid len in auth request: %d\n", skb->len); return -1; } a = (struct rtllib_authentication *) skb->data; @@ -1884,14 +1885,13 @@ static short probe_rq_parse(struct rtllib_device *ieee, struct sk_buff *skb, return !strncmp(ssid, ieee->current_network.ssid, ssidlen); } -static int assoc_rq_parse(struct sk_buff *skb, u8 *dest) +static int assoc_rq_parse(struct net_device *dev, struct sk_buff *skb, u8 *dest) { struct rtllib_assoc_request_frame *a; if (skb->len < (sizeof(struct rtllib_assoc_request_frame) - sizeof(struct rtllib_info_element))) { - - RTLLIB_DEBUG_MGMT("invalid len in auth request:%d\n", skb->len); + netdev_dbg(dev, "invalid len in auth request:%d\n", skb->len); return -1; } @@ -1909,7 +1909,8 @@ static inline u16 assoc_parse(struct rtllib_device *ieee, struct sk_buff *skb, u16 status_code; if (skb->len < sizeof(struct rtllib_assoc_response_frame)) { - RTLLIB_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len); + netdev_dbg(ieee->dev, "Invalid len in auth resp: %d\n", + skb->len); return 0xcafe; } @@ -1949,7 +1950,7 @@ static inline void rtllib_rx_auth_rq(struct rtllib_device *ieee, ieee->softmac_stats.rx_auth_rq++; - status = auth_rq_parse(skb, dest); + status = auth_rq_parse(ieee->dev, skb, dest); if (status != -1) rtllib_resp_to_auth(ieee, status, dest); } @@ -1961,7 +1962,7 @@ static inline void rtllib_rx_assoc_rq(struct rtllib_device *ieee, u8 dest[ETH_ALEN] __aligned(2); ieee->softmac_stats.rx_ass_rq++; - if (assoc_rq_parse(skb, dest) != -1) + if (assoc_rq_parse(ieee->dev, skb, dest) != -1) rtllib_resp_to_assoc_rq(ieee, dest); netdev_info(ieee->dev, "New client associated: %pM\n", dest); @@ -2235,8 +2236,8 @@ inline int rtllib_rx_assoc_resp(struct rtllib_device *ieee, struct sk_buff *skb, struct rtllib_assoc_response_frame *assoc_resp; struct rtllib_hdr_3addr *header = (struct rtllib_hdr_3addr *) skb->data; - RTLLIB_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n", - WLAN_FC_GET_STYPE(header->frame_ctl)); + netdev_dbg(ieee->dev, "received [RE]ASSOCIATION RESPONSE (%d)\n", + WLAN_FC_GET_STYPE(header->frame_ctl)); if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && ieee->state == RTLLIB_ASSOCIATING_AUTHENTICATED && @@ -2297,9 +2298,6 @@ inline int rtllib_rx_assoc_resp(struct rtllib_device *ieee, struct sk_buff *skb, netdev_info(ieee->dev, "Association response status code 0x%x\n", errcode); - RTLLIB_DEBUG_MGMT( - "Association response status code 0x%x\n", - errcode); if (ieee->AsocRetryCount < RT_ASOC_RETRY_LIMIT) queue_delayed_work_rsl(ieee->wq, &ieee->associate_procedure_wq, 0); @@ -2317,13 +2315,10 @@ static void rtllib_rx_auth_resp(struct rtllib_device *ieee, struct sk_buff *skb) int chlen = 0; bool bSupportNmode = true, bHalfSupportNmode = false; - errcode = auth_parse(skb, &challenge, &chlen); + errcode = auth_parse(ieee->dev, skb, &challenge, &chlen); if (errcode) { ieee->softmac_stats.rx_auth_rs_err++; - RTLLIB_DEBUG_MGMT("Authentication respose status code 0x%x", - errcode); - netdev_info(ieee->dev, "Authentication respose status code 0x%x", errcode); rtllib_associate_abort(ieee); @@ -2373,7 +2368,8 @@ inline int rtllib_rx_auth(struct rtllib_device *ieee, struct sk_buff *skb, if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) { if (ieee->state == RTLLIB_ASSOCIATING_AUTHENTICATING && (ieee->iw_mode == IW_MODE_INFRA)) { - RTLLIB_DEBUG_MGMT("Received authentication response"); + netdev_dbg(ieee->dev, + "Received authentication response"); rtllib_rx_auth_resp(ieee, skb); } else if (ieee->iw_mode == IW_MODE_MASTER) { rtllib_rx_auth_rq(ieee, skb); -- 1.8.4.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel