Thread (44 messages) 44 messages, 4 authors, 2019-09-01

Re: [PATCH v6 net-next 12/19] ionic: Add Rx filter and rx_mode ndo support

From: Jakub Kicinski <hidden>
Date: 2019-08-29 23:06:36

On Thu, 29 Aug 2019 11:27:13 -0700, Shannon Nelson wrote:
quoted hunk ↗ jump to hunk
@@ -588,8 +866,26 @@ static int ionic_set_features(struct net_device *netdev,
 
 static int ionic_set_mac_address(struct net_device *netdev, void *sa)
 {
-	netdev_info(netdev, "%s: stubbed\n", __func__);
-	return 0;
+	struct sockaddr *addr = sa;
+	u8 *mac;
+
+	mac = (u8 *)addr->sa_data;
+	if (ether_addr_equal(netdev->dev_addr, mac))
+		return 0;
+
+	if (!is_valid_ether_addr(mac))
+		return -EADDRNOTAVAIL;
+
+	if (!is_zero_ether_addr(netdev->dev_addr)) {
+		netdev_info(netdev, "deleting mac addr %pM\n",
+			    netdev->dev_addr);
+		ionic_addr_del(netdev, netdev->dev_addr);
+	}
+
+	memcpy(netdev->dev_addr, mac, netdev->addr_len);
+	netdev_info(netdev, "updating mac addr %pM\n", mac);
+
+	return ionic_addr_add(netdev, mac);
 }
Please use the eth_prepare_mac_addr_change() and
eth_commit_mac_addr_change() helpers.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help