From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@google.com, andrew+netdev@lunn.ch,
netdev@vger.kernel.org
Cc: Dima Ruinskiy <dima.ruinskiy@intel.com>,
anthony.l.nguyen@intel.com, allen.lan@intel.com,
"Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>
Subject: [PATCH net-next 14/15] igc: Support ACPI-based MAC pass-through
Date: Wed, 5 Aug 2026 14:35:39 -0700 [thread overview]
Message-ID: <20260805213541.2281287-15-anthony.l.nguyen@intel.com> (raw)
In-Reply-To: <20260805213541.2281287-1-anthony.l.nguyen@intel.com>
From: Dima Ruinskiy <dima.ruinskiy@intel.com>
Some systems implement a system MAC address object in the ACPI table,
using either \\_SB.AMAC or \\MACA object names. This system MAC address,
when enabled, is intended to override the permanent MAC address of the
network controller.
Implement lookup of the relevant ACPI object names and use them to
initialize the MAC address.
On systems where the feature is disabled or unsupported, the ACPI objects
do not exist or do not contain a valid Ethernet MAC, causing a fallback
to the existing MAC address initialization path.
Assisted-by: GitHub-Copilot:claude-opus-4.7
Signed-off-by: Dima Ruinskiy <dima.ruinskiy@intel.com>
Tested-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/igc/igc_main.c | 64 ++++++++++++++++++++++-
1 file changed, 62 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index 21d2fe38a41a..424c12c0394a 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -11,6 +11,8 @@
#include <net/pkt_sched.h>
#include <linux/bpf_trace.h>
#include <net/xdp_sock_drv.h>
+#include <linux/acpi.h>
+#include <linux/hex.h>
#include <linux/pci.h>
#include <linux/mdio.h>
@@ -7105,6 +7107,57 @@ static enum hrtimer_restart igc_qbv_scheduling_timer(struct hrtimer *timer)
return HRTIMER_NORESTART;
}
+static bool igc_get_acpi_mac_passthru(u8 *mac)
+{
+ static const struct {
+ const char *name;
+ acpi_object_type type;
+ u32 length;
+ } sources[] = {
+ { "\\_SB.AMAC", ACPI_TYPE_BUFFER, 23 },
+ { "\\MACA", ACPI_TYPE_STRING, 22 },
+ };
+ struct acpi_buffer buffer;
+ union acpi_object *obj;
+ bool mac_found = false;
+ acpi_status status;
+ u8 buf[ETH_ALEN];
+ int i;
+
+ if (!IS_ENABLED(CONFIG_ACPI))
+ return false;
+
+ for (i = 0; i < ARRAY_SIZE(sources) && !mac_found; i++) {
+ buffer.length = ACPI_ALLOCATE_BUFFER;
+ buffer.pointer = NULL;
+
+ status = acpi_evaluate_object(NULL, (char *)sources[i].name,
+ NULL, &buffer);
+ if (ACPI_FAILURE(status))
+ continue;
+
+ obj = buffer.pointer;
+ if (!obj || obj->type != sources[i].type ||
+ obj->string.length != sources[i].length)
+ goto free_obj;
+
+ if (strncmp(obj->string.pointer, "_AUXMAC_#", 9) ||
+ obj->string.pointer[21] != '#')
+ goto free_obj;
+
+ if (hex2bin(buf, obj->string.pointer + 9, ETH_ALEN) ||
+ !is_valid_ether_addr(buf))
+ goto free_obj;
+
+ ether_addr_copy(mac, buf);
+ mac_found = true;
+free_obj:
+ kfree(obj);
+ }
+
+ return mac_found;
+}
+
/**
* igc_probe - Device Initialization Routine
* @pdev: PCI device information struct
@@ -7268,9 +7321,16 @@ static int igc_probe(struct pci_dev *pdev,
}
if (eth_platform_get_mac_address(&pdev->dev, hw->mac.addr)) {
- /* copy the MAC address out of the NVM */
- if (hw->mac.ops.read_mac_addr(hw))
+ /* Look for a system-provided MAC in the ACPI table before
+ * falling back to reading the address from the NVM.
+ */
+ if (igc_get_acpi_mac_passthru(hw->mac.addr)) {
+ netdev->addr_assign_type = NET_ADDR_STOLEN;
+ dev_info(&pdev->dev, "Using ACPI pass-through MAC addr %pM\n",
+ hw->mac.addr);
+ } else if (hw->mac.ops.read_mac_addr(hw)) {
dev_err(&pdev->dev, "NVM Read Error\n");
+ }
}
eth_hw_addr_set(netdev, hw->mac.addr);
--
2.47.1
next prev parent reply other threads:[~2026-08-05 21:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-05 21:35 [PATCH net-next 00/15][pull request] Intel Wired LAN Driver Updates 2026-08-05 (ice, i40e, igc, e1000e) Tony Nguyen
2026-08-05 21:35 ` [PATCH net-next 01/15] ice: add support for unmanaged DPLL on E830 NIC Tony Nguyen
2026-08-05 21:35 ` [PATCH net-next 02/15] ice: always do GCS if hardware supports it Tony Nguyen
2026-08-05 21:35 ` [PATCH net-next 03/15] ice: use NETIF_F_HW_CSUM instead of IP/IPV6 Tony Nguyen
2026-08-05 21:35 ` [PATCH net-next 04/15] virtchnl: add VIRTCHNL_VLAN_ETHERTYPE_88E7 support Tony Nguyen
2026-08-05 21:35 ` [PATCH net-next 05/15] ice: add 0x88E7 handling to SW validation paths Tony Nguyen
2026-08-05 21:35 ` [PATCH net-next 06/15] ice: reduce loglevel to debug for 'Can't delete DSCP' message Tony Nguyen
2026-08-05 21:35 ` [PATCH net-next 07/15] ice: use ice_fill_eth_hdr() in ice_fill_sw_rule() Tony Nguyen
2026-08-05 21:35 ` [PATCH net-next 08/15] ice: increase OICR interrupt moderation rate to 20K interrupts/sec Tony Nguyen
2026-08-05 21:35 ` [PATCH net-next 09/15] ice: add rx timestamp tracepoint for debugging Tony Nguyen
2026-08-05 21:35 ` [PATCH net-next 10/15] i40e: prepare for XDP metadata ops support Tony Nguyen
2026-08-05 21:35 ` [PATCH net-next 11/15] i40e: add support for bpf_xdp_metadata_rx_hash() Tony Nguyen
2026-08-05 21:35 ` [PATCH net-next 12/15] i40e: add support for bpf_xdp_metadata_rx_vlan_tag() Tony Nguyen
2026-08-05 21:35 ` [PATCH net-next 13/15] i40e: Avoid repeating RX filter warning Tony Nguyen
2026-08-05 21:35 ` Tony Nguyen [this message]
2026-08-05 21:35 ` [PATCH net-next 15/15] e1000e: Avoid DMA re-mapping on RX copybreak Tony Nguyen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260805213541.2281287-15-anthony.l.nguyen@intel.com \
--to=anthony.l.nguyen@intel.com \
--cc=acelan.kao@canonical.com \
--cc=allen.lan@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dima.ruinskiy@intel.com \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox