Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 289857
b: refs/heads/master
c: 57b9bef
h: refs/heads/master
i:
  289855: 0c34e79
v: v3
  • Loading branch information
Krishna Gudipati authored and David S. Miller committed Feb 2, 2012
1 parent dea1f79 commit 791ab48
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7161c76f0def54f5dc7fd9a5534bb3e3e2b2aa60
refs/heads/master: 57b9bef0d6990d088a5e840c88ae137d8e76202c
1 change: 1 addition & 0 deletions trunk/drivers/net/ethernet/brocade/bna/bfa_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ enum bfa_mode {
#define BFA_FLASH_PART_ENTRY_SIZE 32 /* partition entry size */
#define BFA_FLASH_PART_MAX 32 /* maximal # of partitions */
#define BFA_TOTAL_FLASH_SIZE 0x400000
#define BFA_FLASH_PART_FWIMG 2
#define BFA_FLASH_PART_MFG 7

/*
Expand Down
42 changes: 42 additions & 0 deletions trunk/drivers/net/ethernet/brocade/bna/bnad_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,47 @@ bnad_set_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom,
return ret;
}

static int
bnad_flash_device(struct net_device *netdev, struct ethtool_flash *eflash)
{
struct bnad *bnad = netdev_priv(netdev);
struct bnad_iocmd_comp fcomp;
const struct firmware *fw;
int ret = 0;

ret = request_firmware(&fw, eflash->data, &bnad->pcidev->dev);
if (ret) {
pr_err("BNA: Can't locate firmware %s\n", eflash->data);
goto out;
}

fcomp.bnad = bnad;
fcomp.comp_status = 0;

init_completion(&fcomp.comp);
spin_lock_irq(&bnad->bna_lock);
ret = bfa_nw_flash_update_part(&bnad->bna.flash, BFA_FLASH_PART_FWIMG,
bnad->id, (u8 *)fw->data, fw->size, 0,
bnad_cb_completion, &fcomp);
if (ret != BFA_STATUS_OK) {
pr_warn("BNA: Flash update failed with err: %d\n", ret);
ret = -EIO;
spin_unlock_irq(&bnad->bna_lock);
goto out;
}

spin_unlock_irq(&bnad->bna_lock);
wait_for_completion(&fcomp.comp);
if (fcomp.comp_status != BFA_STATUS_OK) {
ret = -EIO;
pr_warn("BNA: Firmware image update to flash failed with: %d\n",
fcomp.comp_status);
}
out:
release_firmware(fw);
return ret;
}

static const struct ethtool_ops bnad_ethtool_ops = {
.get_settings = bnad_get_settings,
.set_settings = bnad_set_settings,
Expand All @@ -1090,6 +1131,7 @@ static const struct ethtool_ops bnad_ethtool_ops = {
.get_eeprom_len = bnad_get_eeprom_len,
.get_eeprom = bnad_get_eeprom,
.set_eeprom = bnad_set_eeprom,
.flash_device = bnad_flash_device,
};

void
Expand Down

0 comments on commit 791ab48

Please sign in to comment.