diff mbox

[1/6] qtnfmac: implement net_device_ops callback to set MAC address

Message ID 20180531091102.28666-2-sergey.matyukevich.os@quantenna.com (mailing list archive)
State Accepted
Commit ed9f34bb9d338734ed8ec3d7f1269a28ef0a553e
Delegated to: Kalle Valo
Headers show

Commit Message

Sergey Matyukevich May 31, 2018, 9:10 a.m. UTC
From: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>

Implement net_device_ops::ndo_set_mac_address callback to allow for
setting interface MAC address. Implementation is done through existing
CHANGE_INTF firmware command. All validation is to be done by firmware.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
---
 drivers/net/wireless/quantenna/qtnfmac/core.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Comments

Kalle Valo June 27, 2018, 3:54 p.m. UTC | #1
Sergey Matyukevich <sergey.matyukevich.os@quantenna.com> wrote:

> From: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
> 
> Implement net_device_ops::ndo_set_mac_address callback to allow for
> setting interface MAC address. Implementation is done through existing
> CHANGE_INTF firmware command. All validation is to be done by firmware.
> 
> Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>

2 patches applied to wireless-drivers-next.git, thanks.

ed9f34bb9d33 qtnfmac: implement net_device_ops callback to set MAC address
6fbef9540af0 qtnfmac: enable source MAC address randomization support
Sergey Matyukevich June 29, 2018, 9:26 a.m. UTC | #2
> Sergey Matyukevich <sergey.matyukevich.os@quantenna.com> wrote:
> 
> > From: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
> >
> > Implement net_device_ops::ndo_set_mac_address callback to allow for
> > setting interface MAC address. Implementation is done through existing
> > CHANGE_INTF firmware command. All validation is to be done by firmware.
> >
> > Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
> 
> 2 patches applied to wireless-drivers-next.git, thanks.
> 
> ed9f34bb9d33 qtnfmac: implement net_device_ops callback to set MAC address
> 6fbef9540af0 qtnfmac: enable source MAC address randomization support

Hello Kalle,

I see the other 4 patches in this series are in 'Deferred' state. Could you
please clarify what that means. Do you have any concerns about those
remaining patches or any actions are needed from our side ?

Regards,
Sergey
Kalle Valo June 29, 2018, 9:43 a.m. UTC | #3
Sergey Matyukevich <sergey.matyukevich.os@quantenna.com> writes:

>> Sergey Matyukevich <sergey.matyukevich.os@quantenna.com> wrote:
>> 
>> > From: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
>> >
>> > Implement net_device_ops::ndo_set_mac_address callback to allow for
>> > setting interface MAC address. Implementation is done through existing
>> > CHANGE_INTF firmware command. All validation is to be done by firmware.
>> >
>> > Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
>> 
>> 2 patches applied to wireless-drivers-next.git, thanks.
>> 
>> ed9f34bb9d33 qtnfmac: implement net_device_ops callback to set MAC address
>> 6fbef9540af0 qtnfmac: enable source MAC address randomization support
>
> Hello Kalle,
>
> I see the other 4 patches in this series are in 'Deferred' state. Could you
> please clarify what that means. Do you have any concerns about those
> remaining patches or any actions are needed from our side ?

I saw there was a comment on one patch and other patch used vendor
commands which I need to review carefully. I didn't have time at the
time so I put them to deferred and try to get back soon.
Sergey Matyukevich June 29, 2018, 12:03 p.m. UTC | #4
> Sergey Matyukevich <sergey.matyukevich.os@quantenna.com> writes:
> 
> >> Sergey Matyukevich <sergey.matyukevich.os@quantenna.com> wrote:
> >>
> >> > From: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
> >> >
> >> > Implement net_device_ops::ndo_set_mac_address callback to allow for
> >> > setting interface MAC address. Implementation is done through existing
> >> > CHANGE_INTF firmware command. All validation is to be done by firmware.
> >> >
> >> > Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
> >>
> >> 2 patches applied to wireless-drivers-next.git, thanks.
> >>
> >> ed9f34bb9d33 qtnfmac: implement net_device_ops callback to set MAC address
> >> 6fbef9540af0 qtnfmac: enable source MAC address randomization support
> >
> > Hello Kalle,
> >
> > I see the other 4 patches in this series are in 'Deferred' state. Could you
> > please clarify what that means. Do you have any concerns about those
> > remaining patches or any actions are needed from our side ?
> 
> I saw there was a comment on one patch and other patch used vendor
> commands which I need to review carefully. I didn't have time at the
> time so I put them to deferred and try to get back soon.

Ok, understood.

Regards,
Sergey
diff mbox

Patch

diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.c b/drivers/net/wireless/quantenna/qtnfmac/core.c
index a6a450984f9a..c318340e1bd5 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/core.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/core.c
@@ -179,6 +179,30 @@  static void qtnf_netdev_tx_timeout(struct net_device *ndev)
 	}
 }
 
+static int qtnf_netdev_set_mac_address(struct net_device *ndev, void *addr)
+{
+	struct qtnf_vif *vif = qtnf_netdev_get_priv(ndev);
+	struct sockaddr *sa = addr;
+	int ret;
+	unsigned char old_addr[ETH_ALEN];
+
+	memcpy(old_addr, sa->sa_data, sizeof(old_addr));
+
+	ret = eth_mac_addr(ndev, sa);
+	if (ret)
+		return ret;
+
+	qtnf_scan_done(vif->mac, true);
+
+	ret = qtnf_cmd_send_change_intf_type(vif, vif->wdev.iftype,
+					     sa->sa_data);
+
+	if (ret)
+		memcpy(ndev->dev_addr, old_addr, ETH_ALEN);
+
+	return ret;
+}
+
 /* Network device ops handlers */
 const struct net_device_ops qtnf_netdev_ops = {
 	.ndo_open = qtnf_netdev_open,
@@ -186,6 +210,7 @@  const struct net_device_ops qtnf_netdev_ops = {
 	.ndo_start_xmit = qtnf_netdev_hard_start_xmit,
 	.ndo_tx_timeout = qtnf_netdev_tx_timeout,
 	.ndo_get_stats64 = qtnf_netdev_get_stats64,
+	.ndo_set_mac_address = qtnf_netdev_set_mac_address,
 };
 
 static int qtnf_mac_init_single_band(struct wiphy *wiphy,