]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
cxgb4: use port number to set mac addr
authorAnumula Murali Mohan Reddy <anumula@chelsio.com>
Fri, 6 Dec 2024 06:20:14 +0000 (11:50 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Dec 2024 17:06:11 +0000 (18:06 +0100)
[ Upstream commit 356983f569c1f5991661fc0050aa263792f50616 ]

t4_set_vf_mac_acl() uses pf to set mac addr, but t4vf_get_vf_mac_acl()
uses port number to get mac addr, this leads to error when an attempt
to set MAC address on VF's of PF2 and PF3.
This patch fixes the issue by using port number to set mac address.

Fixes: e0cdac65ba26 ("cxgb4vf: configure ports accessible by the VF")
Signed-off-by: Anumula Murali Mohan Reddy <anumula@chelsio.com>
Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20241206062014.49414-1-anumula@chelsio.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c

index 2dd4869156291b8272c95e5fb3b6563024134a72..81cf29c807178d15c7e600a43959298f8dfe5097 100644 (file)
@@ -2086,7 +2086,7 @@ void t4_idma_monitor(struct adapter *adapter,
                     struct sge_idma_monitor_state *idma,
                     int hz, int ticks);
 int t4_set_vf_mac_acl(struct adapter *adapter, unsigned int vf,
-                     unsigned int naddr, u8 *addr);
+                     u8 start, unsigned int naddr, u8 *addr);
 void t4_tp_pio_read(struct adapter *adap, u32 *buff, u32 nregs,
                    u32 start_index, bool sleep_ok);
 void t4_tp_tm_pio_read(struct adapter *adap, u32 *buff, u32 nregs,
index 3c28a1c3c1ed771bf007d47d04d8c22024884805..720f2ca7f8566e1bc39f7e152d0efb90057bf1dc 100644 (file)
@@ -3249,7 +3249,7 @@ static int cxgb4_mgmt_set_vf_mac(struct net_device *dev, int vf, u8 *mac)
 
        dev_info(pi->adapter->pdev_dev,
                 "Setting MAC %pM on VF %d\n", mac, vf);
-       ret = t4_set_vf_mac_acl(adap, vf + 1, 1, mac);
+       ret = t4_set_vf_mac_acl(adap, vf + 1, pi->lport, 1, mac);
        if (!ret)
                ether_addr_copy(adap->vfinfo[vf].vf_mac_addr, mac);
        return ret;
index 7e8a8ea6d8f7d0d326c482b84ff0e09f93721b6a..51ea81638b31b92ddf7a9c586b2308da5d2e1b50 100644 (file)
@@ -10246,11 +10246,12 @@ out:
  *     t4_set_vf_mac - Set MAC address for the specified VF
  *     @adapter: The adapter
  *     @vf: one of the VFs instantiated by the specified PF
+ *     @start: The start port id associated with specified VF
  *     @naddr: the number of MAC addresses
  *     @addr: the MAC address(es) to be set to the specified VF
  */
 int t4_set_vf_mac_acl(struct adapter *adapter, unsigned int vf,
-                     unsigned int naddr, u8 *addr)
+                     u8 start, unsigned int naddr, u8 *addr)
 {
        struct fw_acl_mac_cmd cmd;
 
@@ -10265,7 +10266,7 @@ int t4_set_vf_mac_acl(struct adapter *adapter, unsigned int vf,
        cmd.en_to_len16 = cpu_to_be32((unsigned int)FW_LEN16(cmd));
        cmd.nmac = naddr;
 
-       switch (adapter->pf) {
+       switch (start) {
        case 3:
                memcpy(cmd.macaddr3, addr, sizeof(cmd.macaddr3));
                break;