Re: [PATCH] staging: rtl8712: switch to common ieee80211 headers

2020-06-02 Thread Dan Carpenter
On Tue, Jun 02, 2020 at 04:58:46PM +0100, Pascal Terjan wrote:
> On Tue, 2 Jun 2020 at 15:57, Larry Finger  wrote:
> >
> > On 6/1/20 3:24 PM, Pascal Terjan wrote:
> > > This patch switches to  and  and
> > > deletes a lot of duplicate definitions plus many unused ones.
> > >
> > > Non obvious changes:
> > > - struct ieee80211_ht_cap is different enough that I preferred to keep
> > >(and rename) it for now.
> > > - mcs_rate in translate_scan was not read after being set, so I deleted
> > >that part rather than using the renamed struct
> > > - WLAN_CAPABILITY_BSS is replaced with WLAN_CAPABILITY_ESS which is the
> > >corresponding one with same value
> > >
> > > Signed-off-by: Pascal Terjan 
> >
> > This patch does not apply to the staging repo, current mainline, or
> > wireless-drivers-next. Where did you intend it to go? Staging is the 
> > correct tree.
> 
> It was against staging-testing as there is a (trivial) merge conflict
> in there with 
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/commit/?h=staging-testing=2aaeaaff1ae21b2817256435c7fc0095eeda61ae
> which is also in staging-next
> What is the best practice in such case?

It has to apply against staging-next so that's fine.

> 
> Thanks to kbuild test robot I found that it is failing to build there
> because I forgot to add a dependency on CFG80211 in Kconfig, so I will
> need to send a v2.

Yup.

regards,
dan carpenter



Re: [PATCH] staging: rtl8712: switch to common ieee80211 headers

2020-06-02 Thread Pascal Terjan
On Tue, 2 Jun 2020 at 15:57, Larry Finger  wrote:
>
> On 6/1/20 3:24 PM, Pascal Terjan wrote:
> > This patch switches to  and  and
> > deletes a lot of duplicate definitions plus many unused ones.
> >
> > Non obvious changes:
> > - struct ieee80211_ht_cap is different enough that I preferred to keep
> >(and rename) it for now.
> > - mcs_rate in translate_scan was not read after being set, so I deleted
> >that part rather than using the renamed struct
> > - WLAN_CAPABILITY_BSS is replaced with WLAN_CAPABILITY_ESS which is the
> >corresponding one with same value
> >
> > Signed-off-by: Pascal Terjan 
>
> This patch does not apply to the staging repo, current mainline, or
> wireless-drivers-next. Where did you intend it to go? Staging is the correct 
> tree.

It was against staging-testing as there is a (trivial) merge conflict
in there with 
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/commit/?h=staging-testing=2aaeaaff1ae21b2817256435c7fc0095eeda61ae
which is also in staging-next
What is the best practice in such case?

Thanks to kbuild test robot I found that it is failing to build there
because I forgot to add a dependency on CFG80211 in Kconfig, so I will
need to send a v2.


Re: [PATCH] staging: rtl8712: switch to common ieee80211 headers

2020-06-02 Thread kbuild test robot
Hi Pascal,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]
[also build test ERROR on next-20200602]
[cannot apply to v5.7]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:
https://github.com/0day-ci/linux/commits/Pascal-Terjan/staging-rtl8712-switch-to-common-ieee80211-headers/20200602-042517
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
77f55d1305c11fb729b88f2c3f7881ba0831fa6f
config: i386-randconfig-a011-20200602 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce (this is a W=1 build):
# save the attached .config to linux build tree
make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>, old ones prefixed by <<):

ld: drivers/staging/rtl8712/rtl8712_recv.o: in function `amsdu_to_msdu':
>> drivers/staging/rtl8712/rtl8712_recv.c:377: undefined reference to 
>> `bridge_tunnel_header'
>> ld: drivers/staging/rtl8712/rtl8712_recv.c:375: undefined reference to 
>> `rfc1042_header'
>> ld: drivers/staging/rtl8712/rtl8712_recv.c:377: undefined reference to 
>> `bridge_tunnel_header'
>> ld: drivers/staging/rtl8712/rtl8712_recv.c:375: undefined reference to 
>> `rfc1042_header'
ld: drivers/staging/rtl8712/rtl871x_recv.o: in function 
`r8712_wlanhdr_to_ethhdr':
>> drivers/staging/rtl8712/rtl871x_recv.c:603: undefined reference to 
>> `rfc1042_header'
>> ld: drivers/staging/rtl8712/rtl871x_recv.c:606: undefined reference to 
>> `bridge_tunnel_header'
>> ld: drivers/staging/rtl8712/rtl871x_recv.c:603: undefined reference to 
>> `rfc1042_header'
>> ld: drivers/staging/rtl8712/rtl871x_recv.c:606: undefined reference to 
>> `bridge_tunnel_header'

vim +377 drivers/staging/rtl8712/rtl8712_recv.c

2865d42c78a912 Larry Finger2010-08-20  314  
fc898688aa37c0 Nishka Dasgupta 2019-08-08  315  static void 
amsdu_to_msdu(struct _adapter *padapter, union recv_frame *prframe)
2865d42c78a912 Larry Finger2010-08-20  316  {
2865d42c78a912 Larry Finger2010-08-20  317  int a_len, 
padding_len;
2865d42c78a912 Larry Finger2010-08-20  318  u16 eth_type, 
nSubframe_Length;
2865d42c78a912 Larry Finger2010-08-20  319  u8  nr_subframes, i;
b952f4dff27512 yuan linyu  2017-06-18  320  unsigned char *pdata;
2865d42c78a912 Larry Finger2010-08-20  321  struct rx_pkt_attrib 
*pattrib;
2865d42c78a912 Larry Finger2010-08-20  322  _pkt *sub_skb, 
*subframes[MAX_SUBFRAME_COUNT];
2865d42c78a912 Larry Finger2010-08-20  323  struct recv_priv 
*precvpriv = >recvpriv;
2865d42c78a912 Larry Finger2010-08-20  324  struct  __queue 
*pfree_recv_queue = &(precvpriv->free_recv_queue);
2865d42c78a912 Larry Finger2010-08-20  325  
2865d42c78a912 Larry Finger2010-08-20  326  nr_subframes = 0;
2865d42c78a912 Larry Finger2010-08-20  327  pattrib = 
>u.hdr.attrib;
2865d42c78a912 Larry Finger2010-08-20  328  recvframe_pull(prframe, 
prframe->u.hdr.attrib.hdrlen);
2865d42c78a912 Larry Finger2010-08-20  329  if 
(prframe->u.hdr.attrib.iv_len > 0)
2865d42c78a912 Larry Finger2010-08-20  330  
recvframe_pull(prframe, prframe->u.hdr.attrib.iv_len);
2865d42c78a912 Larry Finger2010-08-20  331  a_len = 
prframe->u.hdr.len;
2865d42c78a912 Larry Finger2010-08-20  332  pdata = 
prframe->u.hdr.rx_data;
2865d42c78a912 Larry Finger2010-08-20  333  while (a_len > 
ETH_HLEN) {
2865d42c78a912 Larry Finger2010-08-20  334  /* Offset 12 
denote 2 mac address */
2865d42c78a912 Larry Finger2010-08-20  335  
nSubframe_Length = *((u16 *)(pdata + 12));
2865d42c78a912 Larry Finger2010-08-20  336  /*==m==>change 
the length order*/
2865d42c78a912 Larry Finger2010-08-20  337  
nSubframe_Length = (nSubframe_Length >> 8) +
2865d42c78a912 Larry Finger2010-08-20  338  
   (nSubframe_Length << 8);
2865d42c78a912 Larry Finger2010-08-20  339  if (a_len < 
(ETHERNET_HEADER_SIZE + nSubframe_Length)) {
87a573ada017b4 Przemo Firszt   2012-12-10  340  
netdev_warn(padapter->pnetdev, "r8712u: nRemain_Length is %d and 
nSubframe_Length is: %d\n",
2865d42c78a912 Larry Finger2010-08-20  341  
a_len, nSubframe_Length);
2865d42c78a912 Larry Finger2010-08-20  342  goto 
exit;
2865d42c78a912 Larry Finger2010-08-20  343  }
2865d42c78a912 Larry Finger2010-08-20  344  /* move the 
data point to data content */

Re: [PATCH] staging: rtl8712: switch to common ieee80211 headers

2020-06-02 Thread Larry Finger

On 6/1/20 3:24 PM, Pascal Terjan wrote:

This patch switches to  and  and
deletes a lot of duplicate definitions plus many unused ones.

Non obvious changes:
- struct ieee80211_ht_cap is different enough that I preferred to keep
   (and rename) it for now.
- mcs_rate in translate_scan was not read after being set, so I deleted
   that part rather than using the renamed struct
- WLAN_CAPABILITY_BSS is replaced with WLAN_CAPABILITY_ESS which is the
   corresponding one with same value

Signed-off-by: Pascal Terjan 


This patch does not apply to the staging repo, current mainline, or 
wireless-drivers-next. Where did you intend it to go? Staging is the correct tree.


Larry


[PATCH] staging: rtl8712: switch to common ieee80211 headers

2020-06-01 Thread Pascal Terjan
This patch switches to  and  and
deletes a lot of duplicate definitions plus many unused ones.

Non obvious changes:
- struct ieee80211_ht_cap is different enough that I preferred to keep
  (and rename) it for now.
- mcs_rate in translate_scan was not read after being set, so I deleted
  that part rather than using the renamed struct
- WLAN_CAPABILITY_BSS is replaced with WLAN_CAPABILITY_ESS which is the
  corresponding one with same value

Signed-off-by: Pascal Terjan 
---
 drivers/staging/rtl8712/ieee80211.h   | 584 +-
 drivers/staging/rtl8712/rtl8712_recv.c|   7 +-
 drivers/staging/rtl8712/rtl871x_ht.h  |   2 +-
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c |  13 +-
 drivers/staging/rtl8712/rtl871x_mlme.c|  14 +-
 drivers/staging/rtl8712/rtl871x_recv.c|   7 +-
 drivers/staging/rtl8712/rtl871x_recv.h|   2 -
 drivers/staging/rtl8712/rtl871x_xmit.c|   2 +-
 drivers/staging/rtl8712/wifi.h|  21 +-
 9 files changed, 20 insertions(+), 632 deletions(-)

diff --git a/drivers/staging/rtl8712/ieee80211.h 
b/drivers/staging/rtl8712/ieee80211.h
index dabaa8fd34fb..61eff7c5746b 100644
--- a/drivers/staging/rtl8712/ieee80211.h
+++ b/drivers/staging/rtl8712/ieee80211.h
@@ -14,14 +14,8 @@
 #ifndef __IEEE80211_H
 #define __IEEE80211_H
 
-#include "osdep_service.h"
-#include "drv_types.h"
-#include "wifi.h"
-#include 
-#include 
+#include 
 
-#define MGMT_QUEUE_NUM 5
-#define ETH_ALEN   6
 #define IEEE_CMD_SET_WPA_PARAM 1
 #define IEEE_CMD_SET_WPA_IE2
 #define IEEE_CMD_SET_ENCRYPTION3
@@ -102,162 +96,11 @@ struct ieee_param {
} u;
 };
 
-#define IEEE80211_DATA_LEN 2304
-/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
- * 6.2.1.1.2.
- *
- * The figure in section 7.1.2 suggests a body size of up to 2312
- * bytes is allowed, which is a bit confusing, I suspect this
- * represents the 2304 bytes of real data, plus a possible 8 bytes of
- * WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro)
- */
-
-#define IEEE80211_HLEN 30
-#define IEEE80211_FRAME_LEN(IEEE80211_DATA_LEN + IEEE80211_HLEN)
-
-/* this is stolen from ipw2200 driver */
-#define IEEE_IBSS_MAC_HASH_SIZE 31
-
-struct ieee_ibss_seq {
-   u8 mac[ETH_ALEN];
-   u16 seq_num;
-   u16 frag_num;
-   unsigned long packet_time;
-   struct list_head list;
-};
-
-struct ieee80211_hdr {
-   __le16 frame_ctl;
-   __le16 duration_id;
-   u8 addr1[ETH_ALEN];
-   u8 addr2[ETH_ALEN];
-   u8 addr3[ETH_ALEN];
-   __le16 seq_ctl;
-   u8 addr4[ETH_ALEN];
-}  __packed __aligned(2);
-
-struct ieee80211_hdr_3addr {
-   __le16 frame_ctl;
-   __le16 duration_id;
-   u8 addr1[ETH_ALEN];
-   u8 addr2[ETH_ALEN];
-   u8 addr3[ETH_ALEN];
-   __le16 seq_ctl;
-}  __packed __aligned(2);
-
-struct ieee80211_hdr_qos {
-   __le16 frame_ctl;
-   __le16 duration_id;
-   u8 addr1[ETH_ALEN];
-   u8 addr2[ETH_ALEN];
-   u8 addr3[ETH_ALEN];
-   __le16 seq_ctl;
-   u8 addr4[ETH_ALEN];
-   __le16  qc;
-}   __packed __aligned(2);
-
-struct  ieee80211_hdr_3addr_qos {
-   __le16 frame_ctl;
-   __le16 duration_id;
-   u8  addr1[ETH_ALEN];
-   u8  addr2[ETH_ALEN];
-   u8  addr3[ETH_ALEN];
-   __le16 seq_ctl;
-   __le16 qc;
-}  __packed;
-
-struct eapol {
-   u8 snap[6];
-   __be16 ethertype;
-   u8 version;
-   u8 type;
-   __le16 length;
-} __packed;
-
-enum eap_type {
-   EAP_PACKET = 0,
-   EAPOL_START,
-   EAPOL_LOGOFF,
-   EAPOL_KEY,
-   EAPOL_ENCAP_ASF_ALERT
-};
-
-#define IEEE80211_3ADDR_LEN 24
-#define IEEE80211_4ADDR_LEN 30
-#define IEEE80211_FCS_LEN4
-
 #define MIN_FRAG_THRESHOLD 256U
 #defineMAX_FRAG_THRESHOLD 2346U
 
-/* Frame control field constants */
-#define IEEE80211_FCTL_VERS0x0002
-#define IEEE80211_FCTL_FTYPE   0x000c
-#define IEEE80211_FCTL_STYPE   0x00f0
-#define IEEE80211_FCTL_TODS0x0100
-#define IEEE80211_FCTL_FROMDS  0x0200
-#define IEEE80211_FCTL_MOREFRAGS   0x0400
-#define IEEE80211_FCTL_RETRY   0x0800
-#define IEEE80211_FCTL_PM  0x1000
-#define IEEE80211_FCTL_MOREDATA0x2000
-#define IEEE80211_FCTL_WEP 0x4000
-#define IEEE80211_FCTL_ORDER   0x8000
-
-#define IEEE80211_FTYPE_MGMT   0x
-#define IEEE80211_FTYPE_CTL0x0004
-#define IEEE80211_FTYPE_DATA   0x0008
-
-/* management */
-#define IEEE80211_STYPE_ASSOC_REQ  0x
-#define IEEE80211_STYPE_ASSOC_RESP 0x0010
-#define IEEE80211_STYPE_REASSOC_REQ0x0020
-#define IEEE80211_STYPE_REASSOC_RESP   0x0030
-#define IEEE80211_STYPE_PROBE_REQ  0x0040
-#define IEEE80211_STYPE_PROBE_RESP 0x0050
-#define IEEE80211_STYPE_BEACON 0x0080
-#define IEEE80211_STYPE_ATIM