Message ID | 20221025112426.8954-4-snelson@pensando.io (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | ionic: VF attr replay and other updates | expand |
On Tue, 25 Oct 2022 04:24:24 -0700 Shannon Nelson wrote: > A new ionic dev_cmd is added to the interface in ionic_if.h, > with a new capabilities field in the ionic device identity to > signal its availability in the FW. The identity level code is > incremented to '2' to show support for this new capabilities > bitfield. > > If the driver has indicated with the new identity level that > it has the VF_CTRL command, newer FW will wait for the start > command before starting the VFs after a FW update or crash > recovery. > > This patch updates the driver to make use of the new VF start > control in fw_up path to be sure that the PF has set the user > attributes on the VF before the FW allows the VFs to restart. You need to tidy up the kdoc usage.. > @@ -54,6 +54,7 @@ enum ionic_cmd_opcode { > /* SR/IOV commands */ > IONIC_CMD_VF_GETATTR = 60, > IONIC_CMD_VF_SETATTR = 61, > + IONIC_CMD_VF_CTRL = 62, not documented > > /* QoS commands */ > IONIC_CMD_QOS_CLASS_IDENTIFY = 240, > +/** > + * struct ionic_vf_ctrl_cmd - VF control command > + * @opcode: Opcode for the command > + * @vf_index: VF Index. It is unused if op START_ALL is used. > + * @ctrl_opcode: VF control operation type > + */ > +struct ionic_vf_ctrl_cmd { > + u8 opcode; > + u8 ctrl_opcode; > + __le16 vf_index; > + u8 rsvd1[60]; not documented > +}; > + > +/** > + * struct ionic_vf_ctrl_comp - VF_CTRL command completion. > + * @status: Status of the command (enum ionic_status_code) > + */ > +struct ionic_vf_ctrl_comp { > + u8 status; > + u8 rsvd[15]; > +}; not documented For the rsvd fields you can use the /* private: */ comment, see the docs.
On 10/25/22 8:08 PM, Jakub Kicinski wrote: > > You need to tidy up the kdoc usage.. These additions are matching the style that is already in the file, which I think has some merit. Sure, I'll fix these specific kdoc complaints, but those few bits are going to look weirdly out-of-place with the rest of the file. I see that kdoc is unhappy with that whole file, but I wasn't prepared today to be tweaking the rest of the file to make kdoc happy. That is now on my list of near-future To-Do items. Just curious - when was the kdoc check added to the netdev submission checks? Have I just been missing it in the past? sln
On Tue, 25 Oct 2022 21:23:53 -0700 Shannon Nelson wrote: > These additions are matching the style that is already in the file, > which I think has some merit. Sure, I'll fix these specific kdoc > complaints, but those few bits are going to look weirdly out-of-place > with the rest of the file. Gotta start somewhere... > I see that kdoc is unhappy with that whole file, but I wasn't prepared > today to be tweaking the rest of the file to make kdoc happy. That is > now on my list of near-future To-Do items. Yeah, no need to do a whole-sale fix in this series, let's just prevent new problems from coming in. > Just curious - when was the kdoc check added to the netdev submission > checks? Have I just been missing it in the past? I was wondering as well, our check is pretty old, perhaps the behavior of ./scripts/kernel-doc changed or we just weren't as strict in enforcing this as maintainers? Kdoc mis-formatting happens sufficiently infrequently to make enforcing "no new warnings" feasible. I think mostly due to W=1 catching the issues in source files, so people notice right away. Unfortunately it doesn't check headers.
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.c b/drivers/net/ethernet/pensando/ionic/ionic_dev.c index 9d0514cfeb5c..626b9113e7c4 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.c @@ -481,6 +481,20 @@ int ionic_dev_cmd_vf_getattr(struct ionic *ionic, int vf, u8 attr, return err; } +void ionic_vf_start(struct ionic *ionic) +{ + union ionic_dev_cmd cmd = { + .vf_ctrl.opcode = IONIC_CMD_VF_CTRL, + .vf_ctrl.ctrl_opcode = IONIC_VF_CTRL_START_ALL, + }; + + if (!(ionic->ident.dev.capabilities & cpu_to_le64(IONIC_DEV_CAP_VF_CTRL))) + return; + + ionic_dev_cmd_go(&ionic->idev, &cmd); + ionic_dev_cmd_wait(ionic, DEVCMD_TIMEOUT); +} + /* LIF commands */ void ionic_dev_cmd_queue_identify(struct ionic_dev *idev, u16 lif_type, u8 qtype, u8 qver) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.h b/drivers/net/ethernet/pensando/ionic/ionic_dev.h index 563c302eb033..2a1d7b9c07e7 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.h @@ -124,6 +124,8 @@ static_assert(sizeof(struct ionic_vf_setattr_cmd) == 64); static_assert(sizeof(struct ionic_vf_setattr_comp) == 16); static_assert(sizeof(struct ionic_vf_getattr_cmd) == 64); static_assert(sizeof(struct ionic_vf_getattr_comp) == 16); +static_assert(sizeof(struct ionic_vf_ctrl_cmd) == 64); +static_assert(sizeof(struct ionic_vf_ctrl_comp) == 16); #endif /* __CHECKER__ */ struct ionic_devinfo { @@ -324,6 +326,7 @@ int ionic_dev_cmd_vf_getattr(struct ionic *ionic, int vf, u8 attr, struct ionic_vf_getattr_comp *comp); void ionic_dev_cmd_queue_identify(struct ionic_dev *idev, u16 lif_type, u8 qtype, u8 qver); +void ionic_vf_start(struct ionic *ionic); void ionic_dev_cmd_lif_identify(struct ionic_dev *idev, u8 type, u8 ver); void ionic_dev_cmd_lif_init(struct ionic_dev *idev, u16 lif_index, dma_addr_t addr); diff --git a/drivers/net/ethernet/pensando/ionic/ionic_if.h b/drivers/net/ethernet/pensando/ionic/ionic_if.h index 4a90f611c611..aaa88f3272e7 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_if.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_if.h @@ -54,6 +54,7 @@ enum ionic_cmd_opcode { /* SR/IOV commands */ IONIC_CMD_VF_GETATTR = 60, IONIC_CMD_VF_SETATTR = 61, + IONIC_CMD_VF_CTRL = 62, /* QoS commands */ IONIC_CMD_QOS_CLASS_IDENTIFY = 240, @@ -200,6 +201,7 @@ struct ionic_dev_reset_comp { }; #define IONIC_IDENTITY_VERSION_1 1 +#define IONIC_DEV_IDENTITY_VERSION_2 2 /** * struct ionic_dev_identify_cmd - Driver/device identify command @@ -253,6 +255,14 @@ union ionic_drv_identity { __le32 words[478]; }; +/** + * enum ionic_dev_capability - Device capabilities + * @IONIC_DEV_CAP_VF_CTRL: Device supports VF ctrl operations + */ +enum ionic_dev_capability { + IONIC_DEV_CAP_VF_CTRL = BIT(0), +}; + /** * union ionic_dev_identity - device identity information * @version: Version of device identify @@ -273,6 +283,7 @@ union ionic_drv_identity { * @hwstamp_mask: Bitmask for subtraction of hardware tick values. * @hwstamp_mult: Hardware tick to nanosecond multiplier. * @hwstamp_shift: Hardware tick to nanosecond divisor (power of two). + * @capabilities: Device capabilities */ union ionic_dev_identity { struct { @@ -290,6 +301,7 @@ union ionic_dev_identity { __le64 hwstamp_mask; __le32 hwstamp_mult; __le32 hwstamp_shift; + __le64 capabilities; }; __le32 words[478]; }; @@ -2044,6 +2056,33 @@ struct ionic_vf_getattr_comp { u8 color; }; +enum ionic_vf_ctrl_opcode { + IONIC_VF_CTRL_START_ALL = 0, + IONIC_VF_CTRL_START = 1, +}; + +/** + * struct ionic_vf_ctrl_cmd - VF control command + * @opcode: Opcode for the command + * @vf_index: VF Index. It is unused if op START_ALL is used. + * @ctrl_opcode: VF control operation type + */ +struct ionic_vf_ctrl_cmd { + u8 opcode; + u8 ctrl_opcode; + __le16 vf_index; + u8 rsvd1[60]; +}; + +/** + * struct ionic_vf_ctrl_comp - VF_CTRL command completion. + * @status: Status of the command (enum ionic_status_code) + */ +struct ionic_vf_ctrl_comp { + u8 status; + u8 rsvd[15]; +}; + /** * struct ionic_qos_identify_cmd - QoS identify command * @opcode: opcode @@ -2865,6 +2904,7 @@ union ionic_dev_cmd { struct ionic_vf_setattr_cmd vf_setattr; struct ionic_vf_getattr_cmd vf_getattr; + struct ionic_vf_ctrl_cmd vf_ctrl; struct ionic_lif_identify_cmd lif_identify; struct ionic_lif_init_cmd lif_init; @@ -2903,6 +2943,7 @@ union ionic_dev_cmd_comp { struct ionic_vf_setattr_comp vf_setattr; struct ionic_vf_getattr_comp vf_getattr; + struct ionic_vf_ctrl_comp vf_ctrl; struct ionic_lif_identify_comp lif_identify; struct ionic_lif_init_comp lif_init; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index a06b2da1e0c4..f5d39594ef54 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -2629,6 +2629,8 @@ static void ionic_vf_attr_replay(struct ionic_lif *lif) } up_read(&ionic->vf_op_lock); + + ionic_vf_start(ionic); } static const struct net_device_ops ionic_netdev_ops = { diff --git a/drivers/net/ethernet/pensando/ionic/ionic_main.c b/drivers/net/ethernet/pensando/ionic/ionic_main.c index 56f93b030551..ed9d8c995236 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_main.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_main.c @@ -533,7 +533,7 @@ int ionic_identify(struct ionic *ionic) sz = min(sizeof(ident->drv), sizeof(idev->dev_cmd_regs->data)); memcpy_toio(&idev->dev_cmd_regs->data, &ident->drv, sz); - ionic_dev_cmd_identify(idev, IONIC_IDENTITY_VERSION_1); + ionic_dev_cmd_identify(idev, IONIC_DEV_IDENTITY_VERSION_2); err = ionic_dev_cmd_wait(ionic, DEVCMD_TIMEOUT); if (!err) { sz = min(sizeof(ident->dev), sizeof(idev->dev_cmd_regs->data));
A new ionic dev_cmd is added to the interface in ionic_if.h, with a new capabilities field in the ionic device identity to signal its availability in the FW. The identity level code is incremented to '2' to show support for this new capabilities bitfield. If the driver has indicated with the new identity level that it has the VF_CTRL command, newer FW will wait for the start command before starting the VFs after a FW update or crash recovery. This patch updates the driver to make use of the new VF start control in fw_up path to be sure that the PF has set the user attributes on the VF before the FW allows the VFs to restart. Signed-off-by: Shannon Nelson <snelson@pensando.io> --- .../net/ethernet/pensando/ionic/ionic_dev.c | 14 +++++++ .../net/ethernet/pensando/ionic/ionic_dev.h | 3 ++ .../net/ethernet/pensando/ionic/ionic_if.h | 41 +++++++++++++++++++ .../net/ethernet/pensando/ionic/ionic_lif.c | 2 + .../net/ethernet/pensando/ionic/ionic_main.c | 2 +- 5 files changed, 61 insertions(+), 1 deletion(-)