All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH wireless-next v3 0/6] wifi: brcmfmac: AWDL for AirDrop on Apple T2 Macs
@ 2026-11-27 12:40 Andre Eikmeyer
  2026-11-27 12:40 ` [PATCH wireless-next v3 1/6] wifi: brcmfmac: move the interface_create definitions to fwil_types.h Andre Eikmeyer
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Andre Eikmeyer @ 2026-11-27 12:40 UTC (permalink / raw)
  To: arend.vanspriel
  Cc: linux-wireless, brcm80211, brcm80211-dev-list.pdl, linux-kernel,
	Sasha Finkelstein, Sven Peter, Janne Grunau, Aditya Garg,
	Andre Eikmeyer

This series adds AWDL support to brcmfmac, so Linux on the Apple T2 Macs
can send and receive files over AirDrop with Apple and latest Google or
Samsung devices.

On these Macs the Apple firmware runs AWDL itself. The host creates an
AWDL interface and sets its parameters, the firmware keeps the AWDL
schedule and carries the AWDL frames and data. Election, peer discovery
and AirDrop run in user space, which talks to the driver through vendor
commands and events of the Broadcom OUI. As discussed on v1, vendor
commands are the exception agreed for AWDL, so the vendor header
becomes ABI with this series.

The user space side is t2-drop, published under GPL license

  https://github.com/kaiT2en/KaiT2en-Fedora/tree/main/apps/t2-drop

Tested on a MacBookPro15,1 (BCM4364, firmware 9.30.514.0.32.5.94) with
a MacBook Air M4 as peer. AirDrop in both directions with varying file
sizes up to 2GB.
v2 runs on the BCM4364 and BCM4377 machines of the T2 Linux community.

Changes in v3:
- awdl.c and awdl.h are ISC
- Patch 3: keep the abandoned AWDL interface until its late event is
  claimed, and take an interface event that arrives right after the
  timeout instead of failing
- Patch 5: remove an AWDL interface the firmware removed on its own from
  a work item with RTNL and the wiphy mutex. Then send AWDL_STOPPED.
  Answer a START dropped before system sleep with -ECANCELED. Document
  that SET_SYNC fails with -EBADE while the firmware does not know a new
  master yet
- All patches except 3 and 5 are acknowledged by Arend

Changes in v2:
- Drop v1 patch 1, wireless-next matches the firmware capabilities as
  whole words already
- Rebase on wireless-next, patches 1, 2 and 4 have Arend's Ack
- Patch 3: remove an AWDL interface that shows up after the interface
  event timed out, tie the network device to the wiphy device in sysfs
  and keep its name, keep the AWDL address out of the ARP offload table
  of the primary interface, kernel-doc for the return values
- Patch 4: add the AWDL header in brcmf_netdev_start_xmit(), so tx and
  rx count the bytes of the Ethernet frame, kernel-doc. The MTU stays at
  1500, the firmware takes full size frames with the added header
- Patch 5: document where the parameter tables come from and the
  firmware versions they are used with, fail AWDL_START when awdl,
  awdl_config or slot_bss are rejected, return firmware errors from
  SET_FRAMES and SET_SYNC, a quirk in feature.c instead of the chip
  check, reject AWDL_STOP while a start is queued, AWDL_STOPPED with
  -ENOLINK when the firmware removes the interface, UNSPEC first in the
  vendor events
- Patch 6: abstract event codes for the AWDL events, mapped and
  registered by the WCC vendor module, log dropped events

v2: https://lore.kernel.org/all/20261125190254.176055-1-dev@deq.rocks/
v1: https://lore.kernel.org/all/20261104151547.70333-1-dev@deq.rocks/

Andre Eikmeyer (6):
  wifi: brcmfmac: move the interface_create definitions to fwil_types.h
  wifi: brcmfmac: detect AWDL support of the firmware
  wifi: brcmfmac: create and remove the AWDL interface
  wifi: brcmfmac: add the AWDL data path
  wifi: brcmfmac: add vendor commands for AWDL
  wifi: brcmfmac: pass AWDL frames and role changes to user space

 .../broadcom/brcm80211/brcmfmac/Makefile      |    3 +-
 .../broadcom/brcm80211/brcmfmac/awdl.c        | 1163 +++++++++++++++++
 .../broadcom/brcm80211/brcmfmac/awdl.h        |  123 ++
 .../broadcom/brcm80211/brcmfmac/cfg80211.c    |   49 +-
 .../broadcom/brcm80211/brcmfmac/core.c        |   82 +-
 .../broadcom/brcm80211/brcmfmac/core.h        |    7 +
 .../broadcom/brcm80211/brcmfmac/feature.c     |   32 +
 .../broadcom/brcm80211/brcmfmac/feature.h     |    8 +-
 .../broadcom/brcm80211/brcmfmac/fweh.c        |   19 +
 .../broadcom/brcm80211/brcmfmac/fweh.h        |    7 +-
 .../broadcom/brcm80211/brcmfmac/fwil_types.h  |   46 +
 .../broadcom/brcm80211/brcmfmac/vendor.c      |   90 ++
 .../broadcom/brcm80211/brcmfmac/vendor.h      |  109 ++
 .../broadcom/brcm80211/brcmfmac/wcc/core.c    |   39 +
 14 files changed, 1723 insertions(+), 54 deletions(-)
 create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/awdl.c
 create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/awdl.h


base-commit: 18d0bedbb5f0538396cb7f763ed9cd1dd69c5b23
-- 
2.56.0


^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: [PATCH wireless-next v3 3/6] wifi: brcmfmac: create and remove the AWDL interface
@ 2026-11-28 23:08 kernel test robot
  0 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2026-11-28 23:08 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

Unfiltered warning: this smatch report is sent as-is and has not been
reviewed for false positives, so please treat it with due skepticism.

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20261127124104.233236-4-dev@deq.rocks>
References: <20261127124104.233236-4-dev@deq.rocks>
TO: Andre Eikmeyer <dev@deq.rocks>
TO: arend.vanspriel@broadcom.com
CC: linux-wireless@vger.kernel.org
CC: brcm80211@lists.linux.dev
CC: brcm80211-dev-list.pdl@broadcom.com
CC: linux-kernel@vger.kernel.org
CC: Sasha Finkelstein <k@chaosmail.tech>
CC: Sven Peter <sven@kernel.org>
CC: Janne Grunau <j@jannau.net>
CC: Aditya Garg <aditya.garg@linux.dev>
CC: Andre Eikmeyer <dev@deq.rocks>
CC: Yossef Osman <Yossef.Osman@proton.me>

Hi Andre,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 18d0bedbb5f0538396cb7f763ed9cd1dd69c5b23]

url:    https://github.com/intel-lab-lkp/linux/commits/Andre-Eikmeyer/wifi-brcmfmac-move-the-interface_create-definitions-to-fwil_types-h/20261127-134059
base:   18d0bedbb5f0538396cb7f763ed9cd1dd69c5b23
patch link:    https://lore.kernel.org/r/20261127124104.233236-4-dev%40deq.rocks
patch subject: [PATCH wireless-next v3 3/6] wifi: brcmfmac: create and remove the AWDL interface
:::::: branch date: 34 hours ago
:::::: commit date: 34 hours ago
config: xtensa-randconfig-2200-20261128 (https://download.01.org/0day-ci/archive/20261129/20261129000248.BRevkZNG-lkp@intel.com/config)
compiler: xtensa-linux-gcc (GCC) 8.5.0
smatch: v0.5.0-9187-g5189e3fb

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/20261129000248.BRevkZNG-lkp@intel.com/

New smatch warnings:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c:1064 brcmf_inetaddr_changed() error: we previously assumed 'ifp' could be null (see line 1055)

Old smatch warnings:
arch/xtensa/include/asm/thread_info.h:97 current_thread_info() warn: inconsistent indenting

vim +/ifp +1064 drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c

f1ac3aa212af6dd Rafał Miłecki  2017-02-24  1037  
44129ed04b2b01c Franky Lin     2016-01-02  1038  #ifdef CONFIG_INET
44129ed04b2b01c Franky Lin     2016-01-02  1039  #define ARPOL_MAX_ENTRIES	8
44129ed04b2b01c Franky Lin     2016-01-02  1040  static int brcmf_inetaddr_changed(struct notifier_block *nb,
44129ed04b2b01c Franky Lin     2016-01-02  1041  				  unsigned long action, void *data)
44129ed04b2b01c Franky Lin     2016-01-02  1042  {
44129ed04b2b01c Franky Lin     2016-01-02  1043  	struct brcmf_pub *drvr = container_of(nb, struct brcmf_pub,
44129ed04b2b01c Franky Lin     2016-01-02  1044  					      inetaddr_notifier);
44129ed04b2b01c Franky Lin     2016-01-02  1045  	struct in_ifaddr *ifa = data;
44129ed04b2b01c Franky Lin     2016-01-02  1046  	struct net_device *ndev = ifa->ifa_dev->dev;
44129ed04b2b01c Franky Lin     2016-01-02  1047  	struct brcmf_if *ifp;
44129ed04b2b01c Franky Lin     2016-01-02  1048  	int idx, i, ret;
44129ed04b2b01c Franky Lin     2016-01-02  1049  	u32 val;
44129ed04b2b01c Franky Lin     2016-01-02  1050  	__be32 addr_table[ARPOL_MAX_ENTRIES] = {0};
44129ed04b2b01c Franky Lin     2016-01-02  1051  
44129ed04b2b01c Franky Lin     2016-01-02  1052  	/* Find out if the notification is meant for us */
44129ed04b2b01c Franky Lin     2016-01-02  1053  	for (idx = 0; idx < BRCMF_MAX_IFS; idx++) {
44129ed04b2b01c Franky Lin     2016-01-02  1054  		ifp = drvr->iflist[idx];
44129ed04b2b01c Franky Lin     2016-01-02 @1055  		if (ifp && ifp->ndev == ndev)
44129ed04b2b01c Franky Lin     2016-01-02  1056  			break;
44129ed04b2b01c Franky Lin     2016-01-02  1057  		if (idx == BRCMF_MAX_IFS - 1)
44129ed04b2b01c Franky Lin     2016-01-02  1058  			return NOTIFY_DONE;
44129ed04b2b01c Franky Lin     2016-01-02  1059  	}
44129ed04b2b01c Franky Lin     2016-01-02  1060  
8b2b9df358a00c4 Andre Eikmeyer 2026-11-27  1061  	/* ARP offload would put the address into the table of the primary
8b2b9df358a00c4 Andre Eikmeyer 2026-11-27  1062  	 * interface, the AWDL interface has none of its own
8b2b9df358a00c4 Andre Eikmeyer 2026-11-27  1063  	 */
8b2b9df358a00c4 Andre Eikmeyer 2026-11-27 @1064  	if (ifp->awdl)
8b2b9df358a00c4 Andre Eikmeyer 2026-11-27  1065  		return NOTIFY_DONE;
8b2b9df358a00c4 Andre Eikmeyer 2026-11-27  1066  
44129ed04b2b01c Franky Lin     2016-01-02  1067  	/* check if arp offload is supported */
44129ed04b2b01c Franky Lin     2016-01-02  1068  	ret = brcmf_fil_iovar_int_get(ifp, "arpoe", &val);
44129ed04b2b01c Franky Lin     2016-01-02  1069  	if (ret)
44129ed04b2b01c Franky Lin     2016-01-02  1070  		return NOTIFY_OK;
44129ed04b2b01c Franky Lin     2016-01-02  1071  
44129ed04b2b01c Franky Lin     2016-01-02  1072  	/* old version only support primary index */
44129ed04b2b01c Franky Lin     2016-01-02  1073  	ret = brcmf_fil_iovar_int_get(ifp, "arp_version", &val);
44129ed04b2b01c Franky Lin     2016-01-02  1074  	if (ret)
44129ed04b2b01c Franky Lin     2016-01-02  1075  		val = 1;
44129ed04b2b01c Franky Lin     2016-01-02  1076  	if (val == 1)
44129ed04b2b01c Franky Lin     2016-01-02  1077  		ifp = drvr->iflist[0];
44129ed04b2b01c Franky Lin     2016-01-02  1078  
44129ed04b2b01c Franky Lin     2016-01-02  1079  	/* retrieve the table from firmware */
44129ed04b2b01c Franky Lin     2016-01-02  1080  	ret = brcmf_fil_iovar_data_get(ifp, "arp_hostip", addr_table,
44129ed04b2b01c Franky Lin     2016-01-02  1081  				       sizeof(addr_table));
44129ed04b2b01c Franky Lin     2016-01-02  1082  	if (ret) {
dcb1471bc6d0541 Rafał Miłecki  2019-02-19  1083  		bphy_err(drvr, "fail to get arp ip table err:%d\n", ret);
44129ed04b2b01c Franky Lin     2016-01-02  1084  		return NOTIFY_OK;
44129ed04b2b01c Franky Lin     2016-01-02  1085  	}
44129ed04b2b01c Franky Lin     2016-01-02  1086  
44129ed04b2b01c Franky Lin     2016-01-02  1087  	for (i = 0; i < ARPOL_MAX_ENTRIES; i++)
44129ed04b2b01c Franky Lin     2016-01-02  1088  		if (ifa->ifa_address == addr_table[i])
44129ed04b2b01c Franky Lin     2016-01-02  1089  			break;
44129ed04b2b01c Franky Lin     2016-01-02  1090  
44129ed04b2b01c Franky Lin     2016-01-02  1091  	switch (action) {
44129ed04b2b01c Franky Lin     2016-01-02  1092  	case NETDEV_UP:
44129ed04b2b01c Franky Lin     2016-01-02  1093  		if (i == ARPOL_MAX_ENTRIES) {
44129ed04b2b01c Franky Lin     2016-01-02  1094  			brcmf_dbg(TRACE, "add %pI4 to arp table\n",
44129ed04b2b01c Franky Lin     2016-01-02  1095  				  &ifa->ifa_address);
44129ed04b2b01c Franky Lin     2016-01-02  1096  			/* set it directly */
44129ed04b2b01c Franky Lin     2016-01-02  1097  			ret = brcmf_fil_iovar_data_set(ifp, "arp_hostip",
44129ed04b2b01c Franky Lin     2016-01-02  1098  				&ifa->ifa_address, sizeof(ifa->ifa_address));
44129ed04b2b01c Franky Lin     2016-01-02  1099  			if (ret)
dcb1471bc6d0541 Rafał Miłecki  2019-02-19  1100  				bphy_err(drvr, "add arp ip err %d\n", ret);
44129ed04b2b01c Franky Lin     2016-01-02  1101  		}
44129ed04b2b01c Franky Lin     2016-01-02  1102  		break;
44129ed04b2b01c Franky Lin     2016-01-02  1103  	case NETDEV_DOWN:
44129ed04b2b01c Franky Lin     2016-01-02  1104  		if (i < ARPOL_MAX_ENTRIES) {
44129ed04b2b01c Franky Lin     2016-01-02  1105  			addr_table[i] = 0;
44129ed04b2b01c Franky Lin     2016-01-02  1106  			brcmf_dbg(TRACE, "remove %pI4 from arp table\n",
44129ed04b2b01c Franky Lin     2016-01-02  1107  				  &ifa->ifa_address);
44129ed04b2b01c Franky Lin     2016-01-02  1108  			/* clear the table in firmware */
44129ed04b2b01c Franky Lin     2016-01-02  1109  			ret = brcmf_fil_iovar_data_set(ifp, "arp_hostip_clear",
44129ed04b2b01c Franky Lin     2016-01-02  1110  						       NULL, 0);
44129ed04b2b01c Franky Lin     2016-01-02  1111  			if (ret) {
dcb1471bc6d0541 Rafał Miłecki  2019-02-19  1112  				bphy_err(drvr, "fail to clear arp ip table err:%d\n",
44129ed04b2b01c Franky Lin     2016-01-02  1113  					 ret);
44129ed04b2b01c Franky Lin     2016-01-02  1114  				return NOTIFY_OK;
44129ed04b2b01c Franky Lin     2016-01-02  1115  			}
44129ed04b2b01c Franky Lin     2016-01-02  1116  			for (i = 0; i < ARPOL_MAX_ENTRIES; i++) {
cd2bc19c61b2da8 Franky Lin     2016-02-17  1117  				if (addr_table[i] == 0)
cd2bc19c61b2da8 Franky Lin     2016-02-17  1118  					continue;
cd2bc19c61b2da8 Franky Lin     2016-02-17  1119  				ret = brcmf_fil_iovar_data_set(ifp, "arp_hostip",
cd2bc19c61b2da8 Franky Lin     2016-02-17  1120  							       &addr_table[i],
44129ed04b2b01c Franky Lin     2016-01-02  1121  							       sizeof(addr_table[i]));
44129ed04b2b01c Franky Lin     2016-01-02  1122  				if (ret)
dcb1471bc6d0541 Rafał Miłecki  2019-02-19  1123  					bphy_err(drvr, "add arp ip err %d\n",
44129ed04b2b01c Franky Lin     2016-01-02  1124  						 ret);
44129ed04b2b01c Franky Lin     2016-01-02  1125  			}
44129ed04b2b01c Franky Lin     2016-01-02  1126  		}
44129ed04b2b01c Franky Lin     2016-01-02  1127  		break;
44129ed04b2b01c Franky Lin     2016-01-02  1128  	default:
44129ed04b2b01c Franky Lin     2016-01-02  1129  		break;
44129ed04b2b01c Franky Lin     2016-01-02  1130  	}
44129ed04b2b01c Franky Lin     2016-01-02  1131  
44129ed04b2b01c Franky Lin     2016-01-02  1132  	return NOTIFY_OK;
44129ed04b2b01c Franky Lin     2016-01-02  1133  }
44129ed04b2b01c Franky Lin     2016-01-02  1134  #endif
44129ed04b2b01c Franky Lin     2016-01-02  1135  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-11-29 15:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 12:40 [PATCH wireless-next v3 0/6] wifi: brcmfmac: AWDL for AirDrop on Apple T2 Macs Andre Eikmeyer
2026-11-27 12:40 ` [PATCH wireless-next v3 1/6] wifi: brcmfmac: move the interface_create definitions to fwil_types.h Andre Eikmeyer
2026-11-27 12:41 ` [PATCH wireless-next v3 2/6] wifi: brcmfmac: detect AWDL support of the firmware Andre Eikmeyer
2026-11-27 12:41 ` [PATCH wireless-next v3 3/6] wifi: brcmfmac: create and remove the AWDL interface Andre Eikmeyer
2026-11-29 15:38   ` Arend van Spriel
2026-11-27 12:41 ` [PATCH wireless-next v3 4/6] wifi: brcmfmac: add the AWDL data path Andre Eikmeyer
2026-11-27 12:41 ` [PATCH wireless-next v3 5/6] wifi: brcmfmac: add vendor commands for AWDL Andre Eikmeyer
2026-11-29 15:38   ` Arend van Spriel
2026-11-27 12:41 ` [PATCH wireless-next v3 6/6] wifi: brcmfmac: pass AWDL frames and role changes to user space Andre Eikmeyer
  -- strict thread matches above, loose matches on Subject: below --
2026-11-28 23:08 [PATCH wireless-next v3 3/6] wifi: brcmfmac: create and remove the AWDL interface kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.