Skip to content

Commit 402b764

Browse files
Hariprasad Shenaidavem330
authored andcommitted
cxgb4: Allow firmware flash, only if cxgb4 is the master driver
Adapter can go for a toss, if cxgb4 is loaded as slave and we try to upgrade the firmware. So add a check for the same before flashing firmware using ethtool. Signed-off-by: Hariprasad Shenai <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6b6948d commit 402b764

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,20 @@ static int set_flash(struct net_device *netdev, struct ethtool_flash *ef)
925925
const struct firmware *fw;
926926
struct adapter *adap = netdev2adap(netdev);
927927
unsigned int mbox = PCIE_FW_MASTER_M + 1;
928+
u32 pcie_fw;
929+
unsigned int master;
930+
u8 master_vld = 0;
931+
932+
pcie_fw = t4_read_reg(adap, PCIE_FW_A);
933+
master = PCIE_FW_MASTER_G(pcie_fw);
934+
if (pcie_fw & PCIE_FW_MASTER_VLD_F)
935+
master_vld = 1;
936+
/* if csiostor is the master return */
937+
if (master_vld && (master != adap->pf)) {
938+
dev_warn(adap->pdev_dev,
939+
"cxgb4 driver needs to be loaded as MASTER to support FW flash\n");
940+
return -EOPNOTSUPP;
941+
}
928942

929943
ef->data[sizeof(ef->data) - 1] = '\0';
930944
ret = request_firmware(&fw, ef->data, adap->pdev_dev);

0 commit comments

Comments
 (0)