mbox series

[v2,net-next,0/2] ionic: add devlink dev flash support

Message ID 20200904000534.58052-1-snelson@pensando.io
Headers show
Series ionic: add devlink dev flash support | expand

Message

Shannon Nelson Sept. 4, 2020, 12:05 a.m. UTC
Add support for using devlink's dev flash facility to update the
firmware on an ionic device.  This is a simple model of pushing the
firmware file to the NIC, asking the NIC to unpack and install the file
into the device, and then selecting it for the next boot.  If any of
these steps fail, the whole transaction is failed.

We don't currently support doing these steps individually.  In the future
we want to be able to list the FW that is installed and selectable but
don't yet have the API to fully support that.

v2: change "Activate" to "Select" in status messages

Shannon Nelson (2):
  ionic: update the fw update api
  ionic: add devlink firmware update

 drivers/net/ethernet/pensando/ionic/Makefile  |   2 +-
 .../ethernet/pensando/ionic/ionic_devlink.c   |  14 ++
 .../ethernet/pensando/ionic/ionic_devlink.h   |   3 +
 .../net/ethernet/pensando/ionic/ionic_fw.c    | 195 ++++++++++++++++++
 .../net/ethernet/pensando/ionic/ionic_if.h    |  33 ++-
 .../net/ethernet/pensando/ionic/ionic_main.c  |  17 +-
 6 files changed, 251 insertions(+), 13 deletions(-)
 create mode 100644 drivers/net/ethernet/pensando/ionic/ionic_fw.c

Comments

Jakub Kicinski Sept. 4, 2020, 3:01 p.m. UTC | #1
On Thu,  3 Sep 2020 17:05:32 -0700 Shannon Nelson wrote:
> Add support for using devlink's dev flash facility to update the
> firmware on an ionic device.  This is a simple model of pushing the
> firmware file to the NIC, asking the NIC to unpack and install the file
> into the device, and then selecting it for the next boot.  If any of
> these steps fail, the whole transaction is failed.
> 
> We don't currently support doing these steps individually.  In the future
> we want to be able to list the FW that is installed and selectable but
> don't yet have the API to fully support that.
> 
> v2: change "Activate" to "Select" in status messages

Thanks!

Slightly off-topic for these patches but every new C file in ionic adds
a set of those warnings (from sparse, I think, because it still builds):

../drivers/net/ethernet/pensando/ionic/ionic_debugfs.c: note: in included file (through ../drivers/net/ethernet/pensando/ionic/ionic.h):
../drivers/net/ethernet/pensando/ionic/ionic_dev.h:37:1: error: static assertion failed: "sizeof(union ionic_dev_regs) == 4096"
../drivers/net/ethernet/pensando/ionic/ionic_dev.h:39:1: error: static assertion failed: "sizeof(union ionic_dev_cmd_regs) == 2048"
../drivers/net/ethernet/pensando/ionic/ionic_dev.h:55:1: error: static assertion failed: "sizeof(struct ionic_dev_getattr_comp) == 16"
../drivers/net/ethernet/pensando/ionic/ionic_dev.h:56:1: error: static assertion failed: "sizeof(struct ionic_dev_setattr_cmd) == 64"
../drivers/net/ethernet/pensando/ionic/ionic_dev.h:57:1: error: static assertion failed: "sizeof(struct ionic_dev_setattr_comp) == 16"
../drivers/net/ethernet/pensando/ionic/ionic_dev.h:67:1: error: static assertion failed: "sizeof(struct ionic_port_getattr_comp) == 16"
../drivers/net/ethernet/pensando/ionic/ionic_dev.h:77:1: error: static assertion failed: "sizeof(struct ionic_lif_getattr_comp) == 16"
../drivers/net/ethernet/pensando/ionic/ionic_dev.h:78:1: error: static assertion failed: "sizeof(struct ionic_lif_setattr_cmd) == 64"
../drivers/net/ethernet/pensando/ionic/ionic_dev.h:79:1: error: static assertion failed: "sizeof(struct ionic_lif_setattr_comp) == 16"
../drivers/net/ethernet/pensando/ionic/ionic_dev.h:81:1: error: static assertion failed: "sizeof(struct ionic_q_init_cmd) == 64"
../drivers/net/ethernet/pensando/ionic/ionic_dev.h:118:1: error: static assertion failed: "sizeof(struct ionic_vf_setattr_cmd) == 64"
../drivers/net/ethernet/pensando/ionic/ionic_dev.h:121:1: error: static assertion failed: "sizeof(struct ionic_vf_getattr_comp) == 16"

Any ideas on why?
Shannon Nelson Sept. 4, 2020, 6:20 p.m. UTC | #2
On 9/4/20 8:01 AM, Jakub Kicinski wrote:
> On Thu,  3 Sep 2020 17:05:32 -0700 Shannon Nelson wrote:
>> Add support for using devlink's dev flash facility to update the
>> firmware on an ionic device.  This is a simple model of pushing the
>> firmware file to the NIC, asking the NIC to unpack and install the file
>> into the device, and then selecting it for the next boot.  If any of
>> these steps fail, the whole transaction is failed.
>>
>> We don't currently support doing these steps individually.  In the future
>> we want to be able to list the FW that is installed and selectable but
>> don't yet have the API to fully support that.
>>
>> v2: change "Activate" to "Select" in status messages
> Thanks!
>
> Slightly off-topic for these patches but every new C file in ionic adds
> a set of those warnings (from sparse, I think, because it still builds):
>
> ../drivers/net/ethernet/pensando/ionic/ionic_debugfs.c: note: in included file (through ../drivers/net/ethernet/pensando/ionic/ionic.h):
> ../drivers/net/ethernet/pensando/ionic/ionic_dev.h:37:1: error: static assertion failed: "sizeof(union ionic_dev_regs) == 4096"
> ../drivers/net/ethernet/pensando/ionic/ionic_dev.h:39:1: error: static assertion failed: "sizeof(union ionic_dev_cmd_regs) == 2048"
> ../drivers/net/ethernet/pensando/ionic/ionic_dev.h:55:1: error: static assertion failed: "sizeof(struct ionic_dev_getattr_comp) == 16"
> ../drivers/net/ethernet/pensando/ionic/ionic_dev.h:56:1: error: static assertion failed: "sizeof(struct ionic_dev_setattr_cmd) == 64"
> ../drivers/net/ethernet/pensando/ionic/ionic_dev.h:57:1: error: static assertion failed: "sizeof(struct ionic_dev_setattr_comp) == 16"
> ../drivers/net/ethernet/pensando/ionic/ionic_dev.h:67:1: error: static assertion failed: "sizeof(struct ionic_port_getattr_comp) == 16"
> ../drivers/net/ethernet/pensando/ionic/ionic_dev.h:77:1: error: static assertion failed: "sizeof(struct ionic_lif_getattr_comp) == 16"
> ../drivers/net/ethernet/pensando/ionic/ionic_dev.h:78:1: error: static assertion failed: "sizeof(struct ionic_lif_setattr_cmd) == 64"
> ../drivers/net/ethernet/pensando/ionic/ionic_dev.h:79:1: error: static assertion failed: "sizeof(struct ionic_lif_setattr_comp) == 16"
> ../drivers/net/ethernet/pensando/ionic/ionic_dev.h:81:1: error: static assertion failed: "sizeof(struct ionic_q_init_cmd) == 64"
> ../drivers/net/ethernet/pensando/ionic/ionic_dev.h:118:1: error: static assertion failed: "sizeof(struct ionic_vf_setattr_cmd) == 64"
> ../drivers/net/ethernet/pensando/ionic/ionic_dev.h:121:1: error: static assertion failed: "sizeof(struct ionic_vf_getattr_comp) == 16"
>
> Any ideas on why?

It's probably related to this discussion:
https://lore.kernel.org/linux-sparse/ecdd10cb-0022-8f8a-ec36-9d51b3ae85ee@pensando.io/

I thought we'd worked out our struct alignment issues, but I'll see if I 
can carve out some time to take another look at that.

sln
Jakub Kicinski Sept. 4, 2020, 10:47 p.m. UTC | #3
On Fri, 4 Sep 2020 11:20:11 -0700 Shannon Nelson wrote:
> It's probably related to this discussion:
> https://lore.kernel.org/linux-sparse/ecdd10cb-0022-8f8a-ec36-9d51b3ae85ee@pensando.io/
> 
> I thought we'd worked out our struct alignment issues, but I'll see if I 
> can carve out some time to take another look at that.

Cool, could perhaps be something with union handling in sprase I see
that there were some changes in sparse.git recently regarding unions -
maybe it's fixed already.
Shannon Nelson Sept. 4, 2020, 10:52 p.m. UTC | #4
On 9/4/20 3:47 PM, Jakub Kicinski wrote:
> On Fri, 4 Sep 2020 11:20:11 -0700 Shannon Nelson wrote:
>> It's probably related to this discussion:
>> https://lore.kernel.org/linux-sparse/ecdd10cb-0022-8f8a-ec36-9d51b3ae85ee@pensando.io/
>>
>> I thought we'd worked out our struct alignment issues, but I'll see if I
>> can carve out some time to take another look at that.
> Cool, could perhaps be something with union handling in sprase I see
> that there were some changes in sparse.git recently regarding unions -
> maybe it's fixed already.

Probably not fixed for ionic, yet.  I just pulled down the latest(?) 
sparse 0.6.2 and see the same issues.  I can't get to it right now, but 
thanks for letting me know about it.

sln