Search Linux Wireless

Re: [PATCH] mt76: testmode: add support to set MAC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2021-11-09 05:08, Shayne Chen wrote:
Add support to set SA/DA/BSSID in testmode.
During mass production stage, some test scripts or test equipments need
to set fixed addresses to detect or parse if a test is passed.
Also, MAC setting is necessary for some tx/rx tests with rx filter,
to make sure rx site only receives expected packets.

Signed-off-by: Shayne Chen <shayne.chen@xxxxxxxxxxxx>
---
  drivers/net/wireless/mediatek/mt76/mt76.h     |  2 ++
  drivers/net/wireless/mediatek/mt76/testmode.c | 36 +++++++++++++++++--
  drivers/net/wireless/mediatek/mt76/testmode.h |  4 +++
  3 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index e2da720..e7ced94 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -599,6 +599,8 @@ struct mt76_testmode_data {
  	u8 tx_power[4];
  	u8 tx_power_control;
+ u8 addr[3][ETH_ALEN];
+
  	u32 tx_pending;
  	u32 tx_queued;
  	u16 tx_queued_limit;
diff --git a/drivers/net/wireless/mediatek/mt76/testmode.c b/drivers/net/wireless/mediatek/mt76/testmode.c
index 66afc2b..74621b9 100644
--- a/drivers/net/wireless/mediatek/mt76/testmode.c
+++ b/drivers/net/wireless/mediatek/mt76/testmode.c
@@ -126,9 +126,9 @@ int mt76_testmode_alloc_skb(struct mt76_phy *phy, u32 len)
hdr = __skb_put_zero(head, head_len);
  	hdr->frame_control = cpu_to_le16(fc);
-	memcpy(hdr->addr1, phy->macaddr, sizeof(phy->macaddr));
-	memcpy(hdr->addr2, phy->macaddr, sizeof(phy->macaddr));
-	memcpy(hdr->addr3, phy->macaddr, sizeof(phy->macaddr));
+	ether_addr_copy(hdr->addr1, td->addr[0]);
+	ether_addr_copy(hdr->addr2, td->addr[1]);
+	ether_addr_copy(hdr->addr3, td->addr[2]);
ether_addr_copy assumes that source and destination are u16 aligned. I'm not sure that's guaranteed for td->addr. I think you either need to stick to memcpy or make the alignment of td->addr explicit.

- Felix



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux