enic: updates to version 2.1.1.13
Subsystems (2)
cover enic: updates to version 2.1.1.13
This patch series implements the following enic driver updates:
01/4 - enic: Add support for new fw devcmds for port profile handling 02/4 - enic: Add wrapper routines for new fw devcmds for port profile handling 03/4 - enic: Cleanups in port profile helper code
04/4 - enic: Add support for PORT_REQUEST_PREASSOCIATE_RR
PATCH 1/4 enic: Add support for new fw devcmds for port profile handling
From: Roopa Prabhu <[email protected]>
This patch introduces new fw devcmds for port profile handling. These new commands are similar to the current fw commands for port profile handling. The only difference being that the new commands split the existing port profile handling devcmds into multiple fw commands, giving the driver finer control over port profile operations.
--- drivers/net/enic/vnic_dev.c | 97 +++++++++++++++++++++++----------------- drivers/net/enic/vnic_dev.h | 6 ++ drivers/net/enic/vnic_devcmd.h | 57 +++++++++++++++++++++--- 3 files changed, 111 insertions(+), 49 deletions(-)
drivers/net/enic/vnic_dev.c +55 -42
@@ -786,48 +786,6 @@ int vnic_dev_init(struct vnic_dev *vdev, int arg)return r; } -int vnic_dev_init_done (struct vnic_dev *vdev,int *done,int *err) -{ -u64 a0 =0 , a1 =0 ; -int wait =1000 ; -int ret; - - *done =0 ; - - ret =vnic_dev_cmd (vdev,CMD_INIT_STATUS , &a0, &a1, wait); -if (ret) -return ret; - - *done = (a0 ==0 ); - - *err = (a0 ==0 ) ? (int )a1:0 ; - -return 0 ; -} - -int vnic_dev_init_prov (struct vnic_dev *vdev,u8 *buf,u32 len) -{ -u64 a0, a1 = len; -int wait =1000 ; -dma_addr_t prov_pa; -void *prov_buf; -int ret; - - prov_buf =pci_alloc_consistent (vdev->pdev, len, &prov_pa); -if (!prov_buf) -return -ENOMEM ; - -memcpy (prov_buf, buf, len); - - a0 = prov_pa; - - ret =vnic_dev_cmd (vdev,CMD_INIT_PROV_INFO , &a0, &a1, wait); - -pci_free_consistent (vdev->pdev, len, prov_buf, prov_pa); - -return ret; -} -int vnic_dev_deinit (struct vnic_dev *vdev) {u64 a0 =0 , a1 =0 ;
@@ -927,4 +885,59 @@ err_out:return NULL ; } +int vnic_dev_init_prov2 (struct vnic_dev *vdev,u8 *buf,u32 len) +{ +u64 a0, a1 = len; +int wait =1000 ; +dma_addr_t prov_pa; +void *prov_buf; +int ret; + + prov_buf =pci_alloc_consistent (vdev->pdev, len, &prov_pa); +if (!prov_buf) +return -ENOMEM ; +memcpy (prov_buf, buf, len); + + a0 = prov_pa; + + ret =vnic_dev_cmd (vdev,CMD_INIT_PROV_INFO2 , &a0, &a1, wait); + +pci_free_consistent (vdev->pdev, len, prov_buf, prov_pa); + +return ret; +} + +int vnic_dev_enable2 (struct vnic_dev *vdev,int active) +{ +u64 a0, a1 =0 ; +int wait =1000 ; + + a0 = (active ?CMD_ENABLE2_ACTIVE :0 ); + +return vnic_dev_cmd (vdev,CMD_ENABLE2 , &a0, &a1, wait); +} + +static int vnic_dev_cmd_status (struct vnic_dev *vdev,enum vnic_devcmd_cmd cmd, +int *status) +{ +u64 a0 = cmd, a1 =0 ; +int wait =1000 ; +int ret; + + ret =vnic_dev_cmd (vdev,CMD_STATUS , &a0, &a1, wait); +if (!ret) + *status = (int )a0; + +return ret; +} + +int vnic_dev_enable2_done (struct vnic_dev *vdev,int *status) +{ +return vnic_dev_cmd_status (vdev,CMD_ENABLE2 , status); +} + +int vnic_dev_deinit_done (struct vnic_dev *vdev,int *status) +{ +return vnic_dev_cmd_status (vdev,CMD_DEINIT , status); +}
drivers/net/enic/vnic_dev.h +4 -2
@@ -108,8 +108,6 @@ int vnic_dev_disable(struct vnic_dev *vdev);int vnic_dev_open (struct vnic_dev *vdev,int arg);int vnic_dev_open_done (struct vnic_dev *vdev,int *done);int vnic_dev_init (struct vnic_dev *vdev,int arg); -int vnic_dev_init_done (struct vnic_dev *vdev,int *done,int *err); -int vnic_dev_init_prov (struct vnic_dev *vdev,u8 *buf,u32 len);int vnic_dev_deinit (struct vnic_dev *vdev);int vnic_dev_hang_reset (struct vnic_dev *vdev,int arg);int vnic_dev_hang_reset_done (struct vnic_dev *vdev,int *done);
@@ -122,5 +120,9 @@ int vnic_dev_set_ig_vlan_rewrite_mode(struct vnic_dev *vdev,struct vnic_dev *vnic_dev_register (struct vnic_dev *vdev,void *priv,struct pci_dev *pdev,struct vnic_dev_bar *bar,unsigned int num_bars); +int vnic_dev_init_prov2 (struct vnic_dev *vdev,u8 *buf,u32 len); +int vnic_dev_enable2 (struct vnic_dev *vdev,int active); +int vnic_dev_enable2_done (struct vnic_dev *vdev,int *status); +int vnic_dev_deinit_done (struct vnic_dev *vdev,int *status);#endif /* _VNIC_DEV_H_ */
drivers/net/enic/vnic_devcmd.h +52 -5
75 lines not on this page · raw message
PATCH 2/4 enic: Add wrapper routines for new fw devcmds for port profile handling
In reply to Roopa PrabhuFrom: Roopa Prabhu <[email protected]>
This patch adds wrapper routines to new port profile related fw devcmds and removes the old ones
--- drivers/net/enic/enic_dev.c | 62 ++++++++++++++++++++++++++++++++++++++++--- drivers/net/enic/enic_dev.h | 7 +++-- 2 files changed, 63 insertions(+), 6 deletions(-)
drivers/net/enic/enic_dev.c +58 -4
@@ -177,24 +177,24 @@ int enic_vnic_dev_deinit(struct enic *enic)return err; } -int enic_dev_init_prov (struct enic *enic,struct vic_provinfo *vp) +int enic_dev_init_prov2 (struct enic *enic,struct vic_provinfo *vp) {int err;spin_lock (&enic->devcmd_lock); - err =vnic_dev_init_prov (enic->vdev, + err =vnic_dev_init_prov2 (enic->vdev, (u8 *)vp,vic_provinfo_size (vp));spin_unlock (&enic->devcmd_lock);return err; } -int enic_dev_init_done (struct enic *enic,int *done,int *error) +int enic_dev_deinit_done (struct enic *enic,int *status) {int err;spin_lock (&enic->devcmd_lock); - err =vnic_dev_init_done (enic->vdev, done, error); + err =vnic_dev_deinit_done (enic->vdev, status);spin_unlock (&enic->devcmd_lock);return err;
@@ -219,3 +219,57 @@ void enic_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)enic_del_vlan (enic, vid);spin_unlock (&enic->devcmd_lock); } + +int enic_dev_enable2 (struct enic *enic,int active) +{ +int err; + +spin_lock (&enic->devcmd_lock); + err =vnic_dev_enable2 (enic->vdev, active); +spin_unlock (&enic->devcmd_lock); + +return err; +} + +int enic_dev_enable2_done (struct enic *enic,int *status) +{ +int err; + +spin_lock (&enic->devcmd_lock); + err =vnic_dev_enable2_done (enic->vdev, status); +spin_unlock (&enic->devcmd_lock); + +return err; +} + +int enic_dev_status_to_errno (int devcmd_status) +{ +switch (devcmd_status) { +case ERR_SUCCESS : +return 0 ; +case ERR_EINVAL : +return -EINVAL ; +case ERR_EFAULT : +return -EFAULT ; +case ERR_EPERM : +return -EPERM ; +case ERR_EBUSY : +return -EBUSY ; +case ERR_ECMDUNKNOWN : +case ERR_ENOTSUPPORTED : +return -EOPNOTSUPP ; +case ERR_EBADSTATE : +return -EINVAL ; +case ERR_ENOMEM : +return -ENOMEM ; +case ERR_ETIMEDOUT : +return -ETIMEDOUT ; +case ERR_ELINKDOWN : +return -ENETDOWN ; +case ERR_EINPROGRESS : +return -EINPROGRESS ; +case ERR_EMAXRES : +default : +return (devcmd_status <0 ) ? devcmd_status :-1 ; + } +}
drivers/net/enic/enic_dev.h +5 -2
@@ -35,7 +35,10 @@ int enic_dev_set_ig_vlan_rewrite_mode(struct enic *enic);int enic_dev_enable (struct enic *enic);int enic_dev_disable (struct enic *enic);int enic_vnic_dev_deinit (struct enic *enic); -int enic_dev_init_prov (struct enic *enic,struct vic_provinfo *vp); -int enic_dev_init_done (struct enic *enic,int *done,int *error); +int enic_dev_init_prov2 (struct enic *enic,struct vic_provinfo *vp); +int enic_dev_deinit_done (struct enic *enic,int *status); +int enic_dev_enable2 (struct enic *enic,int arg); +int enic_dev_enable2_done (struct enic *enic,int *status); +int enic_dev_status_to_errno (int devcmd_status);#endif /* _ENIC_DEV_H_ */
PATCH 3/4 enic: Cleanups in port profile helper code
In reply to Roopa PrabhuFrom: Roopa Prabhu <[email protected]>
This patch does the following:
- Introduces a new macro VIC_PROVINFO_ADD_TLV
- Adds a new OS type in vic_generic_prov_os_type
- Changes some vic_provinfo* helper routine args to constants
--- drivers/net/enic/vnic_vic.c | 5 +++-- drivers/net/enic/vnic_vic.h | 13 +++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-)
drivers/net/enic/vnic_vic.c +3 -2
@@ -23,7 +23,8 @@#include "vnic_vic.h" -struct vic_provinfo *vic_provinfo_alloc (gfp_t flags,u8 *oui,u8 type) +struct vic_provinfo *vic_provinfo_alloc (gfp_t flags,const u8 *oui, +const u8 type) {struct vic_provinfo *vp;
@@ -47,7 +48,7 @@ void vic_provinfo_free(struct vic_provinfo *vp) }int vic_provinfo_add_tlv (struct vic_provinfo *vp,u16 type,u16 length, -void *value) +const void *value) {struct vic_provinfo_tlv *tlv;
drivers/net/enic/vnic_vic.h +11 -2
@@ -47,6 +47,7 @@ enum vic_generic_prov_os_type {VIC_GENERIC_PROV_OS_TYPE_ESX =1 ,VIC_GENERIC_PROV_OS_TYPE_LINUX =2 ,VIC_GENERIC_PROV_OS_TYPE_WINDOWS =3 , + VIC_GENERIC_PROV_OS_TYPE_SOLARIS = 4, }; struct vic_provinfo {
@@ -61,14 +62,22 @@ struct vic_provinfo { } tlv[0]; } __packed; +#define VIC_PROVINFO_ADD_TLV (vp, tlvtype, tlvlen, data) \ + do { \ + err = vic_provinfo_add_tlv(vp, tlvtype, tlvlen, data); \ + if (err) \ + goto add_tlv_failure; \ + } while (0) +#define VIC_PROVINFO_MAX_DATA 1385#define VIC_PROVINFO_MAX_TLV_DATA (VIC_PROVINFO_MAX_DATA - \ sizeof(struct vic_provinfo)) -struct vic_provinfo *vic_provinfo_alloc (gfp_t flags,u8 *oui,u8 type); +struct vic_provinfo *vic_provinfo_alloc (gfp_t flags,const u8 *oui, +const u8 type);void vic_provinfo_free (struct vic_provinfo *vp);int vic_provinfo_add_tlv (struct vic_provinfo *vp,u16 type,u16 length, -void *value); +const void *value);size_t vic_provinfo_size (struct vic_provinfo *vp);#endif /* _VNIC_VIC_H_ */
PATCH 4/4 enic: Add support for PORT_REQUEST_PREASSOCIATE_RR
In reply to Roopa PrabhuFrom: Roopa Prabhu <[email protected]>
Current enic code only supports ASSOCIATE and DISASSOCIATE port profile operations. This patch adds enic support for port profile PORT_REQUEST_PREASSOCIATE_RR operation. The VIC adapter (8021qbh) is capable of handling port profile requests done in two steps namely PREASSOCIATE_RR and ASSOCIATE today. The motivation to support PREASSOCIATE_RR comes mainly from its use as an optimization during VM migration ie, to do resource reservation on destination host before resources on source host are released.
PREASSOCIATE_RR is a VDP operation and according to the latest at IEEE, 8021qbh will also need to support VDP commands.
In addition to handling the new PORT_REQUEST_PREASSOCIATE_RR operation this patch also does the below:
- Introduces handlers for PORT_REQUEST operations
- Moves most of the port profile handling code to new files enic_pp.[ch]
- Uses new fw devcmds for port profile operations
--- drivers/net/enic/Makefile | 2 drivers/net/enic/enic.h | 4 - drivers/net/enic/enic_main.c | 196 ++++++++----------------------- drivers/net/enic/enic_pp.c | 264 ++++++++++++++++++++++++++++++++++++++++++ drivers/net/enic/enic_pp.h | 27 ++++ 5 files changed, 344 insertions(+), 149 deletions(-) create mode 100644 drivers/net/enic/enic_pp.c create mode 100644 drivers/net/enic/enic_pp.h
drivers/net/enic/Makefile +1 -1
@@ -1,5 +1,5 @@ obj-$(CONFIG_ENIC) := enic.o enic-y := enic_main.o vnic_cq.o vnic_intr.o vnic_wq.o \ - enic_res.o enic_dev.o vnic_dev.o vnic_rq.o vnic_vic.o + enic_res.o enic_dev.o enic_pp.o vnic_dev.o vnic_rq.o vnic_vic.o
drivers/net/enic/enic.h +3 -1
@@ -32,7 +32,7 @@#define DRV_NAME "enic"#define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver" -#define DRV_VERSION "2.1.1.12" +#define DRV_VERSION "2.1.1.13"#define DRV_COPYRIGHT "Copyright 2008-2011 Cisco Systems, Inc"#define ENIC_BARS_MAX 6
@@ -120,4 +120,6 @@ static inline struct device *enic_get_dev(struct enic *enic) return &(enic->pdev->dev); } +void enic_reset_addr_lists (struct enic *enic); +#endif /* _ENIC_H_ */
drivers/net/enic/enic_main.c +49 -147
253 lines not on this page · raw message
drivers/net/enic/enic_pp.c new file +264 -0
264 lines not on this page · raw message
drivers/net/enic/enic_pp.h new file +27 -0
@@ -0,0 +1,27 @@ +/* +* Copyright 2011 Cisco Systems, Inc. All rights reserved. +* +* This program is free software; you may redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; version 2 of the License. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +*/ + +#ifndef _ENIC_PP_H_ +#define _ENIC_PP_H_ + +int enic_process_set_pp_request (struct enic *enic, +struct enic_port_profile *prev_pp,int *restore_pp); +int enic_process_get_pp_request (struct enic *enic,int request, +u16 *response); + +#endif /* _ENIC_PP_H_ */
David Miller
maintainerFrom: Roopa Prabhu <[email protected]>
Date: Tue, 29 Mar 2011 23:35:46 -0700
Quoted 10 lines
This patch series implements the following enic driver updates:
01/4 - enic: Add support for new fw devcmds for port profile handling 02/4 - enic: Add wrapper routines for new fw devcmds for port profile handling 03/4 - enic: Cleanups in port profile helper code
04/4 - enic: Add support forPORT_REQUEST_PREASSOCIATE_RRSigned-off-by Roopa Prabhu <[email protected]>Signed-off-by David Wang <[email protected]>Signed-off-by Christian Benvenuti <[email protected]>
All applied.