i40e/i40evf: AVF series
Subsystems (4)
v3 cover i40e/i40evf: AVF series
This is the introduction of the Intel(R) Ethernet Adaptive Virtual Function driver code and device ID, as presented at the NetDEV 1.2 conference in 2016.
http://netdevconf.org/1.2/session.html?anjali-singhai
The idea is to convert the interface between the i40evf driver and the parent i40e PF driver to be generic, as the i40evf driver should in the future be able to run on top of other Intel PF drivers, and negotiate any features beyond a "base expected" set.
The series appears much bigger than it is due to the "move" of i40evf_virtchnl.h, which is a really a rename. Please make sure your git client shows the rename when doing git log --follow.
Series applies on top of the "i40e/i40evf: small fixes" series, otherwise there will be conflicts when they are merged.
NOTE: There are some minor checkpatch warnings but I've reviewed them, and they can be ignored.
v3: updated patch 4 to remove some unnecessary transforms to client
interface files, also had to update patch 9 to remove unused I40E_QUEUE_ defines
v2: updated patch 13,14 with Kconfig changes and added to i40evf.txt,
other patches were unchanged from v1
Jesse Brandeburg (11):
i40evf: drop i40e_type.h include i40e/i40evf: create and use new unified header file
i40e: use new unified virtchnl header file
virtchnl: rename i40e to generic virtchnl
virtchnl: move some code to core driver
virtchnl: convert to new macros i40e/virtchnl: refactor code for validate checks i40evf/virtchnl: whitespace cleanups
virtchnl: finish conversion to virtchnl interface i40e/virtchnl: move function to virtchnl
i40evf: update i40evf.txt with new content
Preethi Banala (1):
i40evf: Add support for Adaptive Virtual Function
Sridhar Samudrala (2):
virtchnl: Add pad fields to a couple of structures
virtchnl: Add compile time static asserts to validate structure sizes
Documentation/networking/i40evf.txt | 23 +- MAINTAINERS | 1 + drivers/net/ethernet/intel/Kconfig | 10 +- drivers/net/ethernet/intel/i40e/i40e.h | 2 +- drivers/net/ethernet/intel/i40e/i40e_client.c | 2 +- drivers/net/ethernet/intel/i40e/i40e_common.c | 2 +- drivers/net/ethernet/intel/i40e/i40e_prototype.h | 6 +- drivers/net/ethernet/intel/i40e/i40e_virtchnl.h | 449 ------------- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 474 +++++--------- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 9 +- drivers/net/ethernet/intel/i40evf/i40e_common.c | 15 +- drivers/net/ethernet/intel/i40evf/i40e_devids.h | 1 + drivers/net/ethernet/intel/i40evf/i40e_prototype.h | 6 +- drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h | 448 ------------- drivers/net/ethernet/intel/i40evf/i40evf.h | 26 +- drivers/net/ethernet/intel/i40evf/i40evf_client.c | 18 +- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 66 +- .../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 285 +++++---- include/linux/avf/virtchnl.h | 701 +++++++++++++++++++++ 19 files changed, 1109 insertions(+), 1435 deletions(-) delete mode 100644 drivers/net/ethernet/intel/i40e/i40e_virtchnl.h delete mode 100644 drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h create mode 100644 include/linux/avf/virtchnl.h
Signature · 1 line
2.9.3
PATCH v3 1/14 i40evf: drop i40e_type.h include
This drops the i40e_type.h include in anticipation of the next patch which moves this file to a location where type.h doesn't exist, and all the places this file is included already include i40e_type.h before this file.
--- drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h +0 -2
@@ -27,8 +27,6 @@#ifndef _I40E_VIRTCHNL_H_#define _I40E_VIRTCHNL_H_ -#include "i40e_type.h" -/* Description: * This header file describes the VF-PF communication protocol used * by the various i40e drivers.
Signature · 1 line
2.9.3
Bowers
PATCH v3 1/14 i40evf: drop i40e_type.h include
Quoted 8 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Jesse Brandeburg
Sent: Thursday, May 11, 2017 11:23 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next v3 01/14] i40evf: dropi40e_type.hinclude
Quoted 8 lines
This drops the
i40e_type.hinclude in anticipation of the next patch which moves this file to a location wheretype.hdoesn't exist, and all the places this file is included already includei40e_type.hbefore this file.Signed-off-by Jesse Brandeburg <[email protected]>--- drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h | 2 -- 1 file changed, 2 deletions(-)
PATCH v3 2/14 i40e/i40evf: create and use new unified header file
In reply to Jesse BrandeburgThis moves a header for i40evf to include/linux/avf/virtchnl.h. The directory name avf is an acronym for the Intel(R) Adaptive Virtual Function.
This first step creates the new file, which is a rename of drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h to include/linux/avf/virtchnl.h, and should show up in git as a rename when using git log --follow.
To keep things building after the move, the changes to the i40evf driver are made to point to the new include file location.
delete mode 100644 drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h create mode 100644 include/linux/avf/virtchnl.h --- MAINTAINERS | 1 + drivers/net/ethernet/intel/i40evf/i40e_common.c | 2 +- drivers/net/ethernet/intel/i40evf/i40e_prototype.h | 2 +- drivers/net/ethernet/intel/i40evf/i40evf.h | 2 +- .../intel/i40evf/i40e_virtchnl.h => include/linux/avf/virtchnl.h | 0 5 files changed, 4 insertions(+), 3 deletions(-) rename drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h => include/linux/avf/virtchnl.h (100%)
MAINTAINERS +1 -0
@@ -6673,6 +6673,7 @@ F: Documentation/networking/i40e.txt F: Documentation/networking/i40evf.txt F: drivers/net/ethernet/intel/ F: drivers/net/ethernet/intel/*/ +F: include/linux/avf/virtchnl.h INTEL RDMA RNIC DRIVER M: Faisal Latif <[email protected]>
drivers/net/ethernet/intel/i40evf/i40e_common.c +1 -1
@@ -27,7 +27,7 @@#include "i40e_type.h" #include "i40e_adminq.h" #include "i40e_prototype.h" -#include "i40e_virtchnl.h" +#include <linux/avf/virtchnl.h> /** * i40e_set_mac_type - Sets MAC type
drivers/net/ethernet/intel/i40evf/i40e_prototype.h +1 -1
@@ -29,7 +29,7 @@#include "i40e_type.h" #include "i40e_alloc.h" -#include "i40e_virtchnl.h" +#include <linux/avf/virtchnl.h> /* Prototypes for shared code functions that are not in * the standard function pointer structures. These are
drivers/net/ethernet/intel/i40evf/i40evf.h +1 -1
@@ -43,7 +43,7 @@#include <net/udp.h> #include "i40e_type.h" -#include "i40e_virtchnl.h" +#include <linux/avf/virtchnl.h> #include "i40e_txrx.h" #define DEFAULT_DEBUG_LEVEL_SHIFT 3
include/linux/avf/virtchnl.h renamed from drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h +0 -0
Signature · 1 line
2.9.3
Bowers
PATCH v3 2/14 i40e/i40evf: create and use new unified header file
Quoted 22 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Jesse Brandeburg
Sent: Thursday, May 11, 2017 11:23 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next v3 02/14] i40e/i40evf: create and use new unified header fileThis moves a header for i40evf to
include/linux/avf/virtchnl.h. The directory name avf is an acronym for the Intel(R) Adaptive Virtual Function.This first step creates the new file, which is a rename of
drivers/net/ethernet/intel/i40evf/i40e_virtchnl.htoinclude/linux/avf/virtchnl.h, and should show up in git as a rename when using git log --follow.To keep things building after the move, the changes to the i40evf driver are made to point to the new include file location.
Signed-off-by Jesse Brandeburg <[email protected]>
Quoted 9 lines
delete mode 100644 drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h create mode 100644 include/linux/avf/virtchnl.h --- MAINTAINERS | 1 + drivers/net/ethernet/intel/i40evf/i40e_common.c | 2 +- drivers/net/ethernet/intel/i40evf/i40e_prototype.h | 2 +- drivers/net/ethernet/intel/i40evf/i40evf.h | 2 +- .../intel/i40evf/i40e_virtchnl.h => include/linux/avf/virtchnl.h | 0 5 files changed, 4 insertions(+), 3 deletions(-) rename
PATCH v3 3/14 i40e: use new unified virtchnl header file
In reply to Jesse BrandeburgThis patch changes the i40e driver to start using the new virtchnl interface header file, and removes an already existing duplicate of the i40e_virtchnl.h file contained in the i40e directory.
delete mode 100644 drivers/net/ethernet/intel/i40e/i40e_virtchnl.h --- drivers/net/ethernet/intel/i40e/i40e.h | 2 +- drivers/net/ethernet/intel/i40e/i40e_common.c | 2 +- drivers/net/ethernet/intel/i40e/i40e_prototype.h | 2 +- drivers/net/ethernet/intel/i40e/i40e_virtchnl.h | 449 ----------------------- 4 files changed, 3 insertions(+), 452 deletions(-) delete mode 100644 drivers/net/ethernet/intel/i40e/i40e_virtchnl.h
drivers/net/ethernet/intel/i40e/i40e.h +1 -1
@@ -57,7 +57,7 @@#include "i40e_type.h" #include "i40e_prototype.h" #include "i40e_client.h" -#include "i40e_virtchnl.h" +#include <linux/avf/virtchnl.h> #include "i40e_virtchnl_pf.h" #include "i40e_txrx.h" #include "i40e_dcb.h"
drivers/net/ethernet/intel/i40e/i40e_common.c +1 -1
@@ -27,7 +27,7 @@#include "i40e_type.h" #include "i40e_adminq.h" #include "i40e_prototype.h" -#include "i40e_virtchnl.h" +#include <linux/avf/virtchnl.h> /** * i40e_set_mac_type - Sets MAC type
drivers/net/ethernet/intel/i40e/i40e_prototype.h +1 -1
@@ -29,7 +29,7 @@#include "i40e_type.h" #include "i40e_alloc.h" -#include "i40e_virtchnl.h" +#include <linux/avf/virtchnl.h> /* Prototypes for shared code functions that are not in * the standard function pointer structures. These are
drivers/net/ethernet/intel/i40e/i40e_virtchnl.h deleted +0 -449
449 lines not on this page · raw message
Signature · 1 line
2.9.3
Bowers
PATCH v3 3/14 i40e: use new unified virtchnl header file
Quoted 14 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Jesse Brandeburg
Sent: Thursday, May 11, 2017 11:23 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next v3 03/14] i40e: use new unified virtchnl header fileThis patch changes the i40e driver to start using the new virtchnl interface header file, and removes an already existing duplicate of the
i40e_virtchnl.hfile contained in the i40e directory.Signed-off-by Jesse Brandeburg <[email protected]>
Quoted 8 lines
delete mode 100644 drivers/net/ethernet/intel/i40e/i40e_virtchnl.h --- drivers/net/ethernet/intel/i40e/i40e.h | 2 +- drivers/net/ethernet/intel/i40e/i40e_common.c | 2 +- drivers/net/ethernet/intel/i40e/i40e_prototype.h | 2 +- drivers/net/ethernet/intel/i40e/i40e_virtchnl.h | 449 ----------------------- 4 files changed, 3 insertions(+), 452 deletions(-) delete mode 100644
drivers/net/ethernet/intel/i40e/i40e_virtchnl.h
PATCH v3 4/14 virtchnl: rename i40e to generic virtchnl
In reply to Jesse BrandeburgThis morphs all the i40e and i40evf references to/in virtchnl.h to be generic, using only automated methods. Updates all the callers to use the new names. A followup patch provides separate clean ups for messy line conversions from these "automatic" changes, to make them more reviewable.
Was executed with the following sed script:
sed -i -f transform_script drivers/net/ethernet/intel/i40e/i40e_client.c sed -i -f transform_script drivers/net/ethernet/intel/i40e/i40e_prototype.h sed -i -f transform_script drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c sed -i -f transform_script drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h sed -i -f transform_script drivers/net/ethernet/intel/i40evf/i40e_common.c sed -i -f transform_script drivers/net/ethernet/intel/i40evf/i40e_prototype.h sed -i -f transform_script drivers/net/ethernet/intel/i40evf/i40evf.h sed -i -f transform_script drivers/net/ethernet/intel/i40evf/i40evf_client.c sed -i -f transform_script drivers/net/ethernet/intel/i40evf/i40evf_main.c sed -i -f transform_script drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c sed -i -f transform_script include/linux/avf/virtchnl.h
transform_script:
----8<---- s/I40E_VIRTCHNL_SUPPORTED_QTYPES/SAVE_ME_SUPPORTED_QTYPES/g s/I40E_VIRTCHNL_VF_CAP/SAVE_ME_VF_CAP/g
s/I40E_VIRTCHNL_/VIRTCHNL_/g
s/i40e_virtchnl_/virtchnl_/g
s/i40e_vfr_/virtchnl_vfr_/g
s/I40E_VFR_/VIRTCHNL_VFR_/g
s/VIRTCHNL_OP_ADD_ETHER_ADDRESS/VIRTCHNL_OP_ADD_ETH_ADDR/g s/VIRTCHNL_OP_DEL_ETHER_ADDRESS/VIRTCHNL_OP_DEL_ETH_ADDR/g s/VIRTCHNL_OP_FCOE/VIRTCHNL_OP_RSVD/g
s/SAVE_ME_SUPPORTED_QTYPES/I40E_VIRTCHNL_SUPPORTED_QTYPES/g s/SAVE_ME_VF_CAP/I40E_VIRTCHNL_VF_CAP/g
----8<----
--- drivers/net/ethernet/intel/i40e/i40e_client.c | 2 +- drivers/net/ethernet/intel/i40e/i40e_prototype.h | 4 +- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 370 ++++++++++----------- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 6 +- drivers/net/ethernet/intel/i40evf/i40e_common.c | 10 +- drivers/net/ethernet/intel/i40evf/i40e_prototype.h | 4 +- drivers/net/ethernet/intel/i40evf/i40evf.h | 22 +- drivers/net/ethernet/intel/i40evf/i40evf_client.c | 18 +- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 48 +-- .../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 280 ++++++++-------- include/linux/avf/virtchnl.h | 233 ++++++------- 11 files changed, 499 insertions(+), 498 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_client.c +1 -1
@@ -565,7 +565,7 @@ static int i40e_client_virtchnl_send(struct i40e_info *ldev,struct i40e_hw *hw = &pf->hw;i40e_status err; - err =i40e_aq_send_msg_to_vf (hw, vf_id,I40E_VIRTCHNL_OP_IWARP , + err =i40e_aq_send_msg_to_vf (hw, vf_id,VIRTCHNL_OP_IWARP ,0 , msg, len,NULL );if (err) dev_err(&pf->pdev->dev, "Unable to send iWarp message to VF, error %d, aq status %d\n",
drivers/net/ethernet/intel/i40e/i40e_prototype.h +2 -2
@@ -333,10 +333,10 @@ static inline struct i40e_rx_ptype_decoded decode_rx_desc_ptype(u8 ptype)/* i40e_common for VF drivers*/ void i40e_vf_parse_hw_config (struct i40e_hw *hw, -struct i40e_virtchnl_vf_resource *msg); +struct virtchnl_vf_resource *msg);i40e_status i40e_vf_reset (struct i40e_hw *hw);i40e_status i40e_aq_send_msg_to_pf (struct i40e_hw *hw, -enum i40e_virtchnl_ops v_opcode, +enum virtchnl_ops v_opcode,i40e_status v_retval,u8 *msg,u16 msglen,struct i40e_asq_cmd_details *cmd_details);
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +185 -185
877 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +3 -3
@@ -81,13 +81,13 @@ struct i40e_vf {s16 vf_id;/* all VF vsis connect to the same parent */ enum i40e_switch_element_types parent_type; -struct i40e_virtchnl_version_info vf_ver; +struct virtchnl_version_info vf_ver;u32 driver_caps;/* reported by VF driver */ /* VF Port Extender (PE) stag if used */ u16 stag; -struct i40e_virtchnl_ether_addr default_lan_addr; +struct virtchnl_ether_addr default_lan_addr;u16 port_vlan_id;bool pf_set_mac;/* The VMM admin set the VF MAC address */ bool trusted;
@@ -115,7 +115,7 @@ struct i40e_vf {u16 num_vlan;/* RDMA Client */ -struct i40e_virtchnl_iwarp_qvlist_info *qvlist_info; +struct virtchnl_iwarp_qvlist_info *qvlist_info; };void i40e_free_vfs (struct i40e_pf *pf);
drivers/net/ethernet/intel/i40evf/i40e_common.c +5 -5
@@ -1054,7 +1054,7 @@ void i40evf_write_rx_ctl(struct i40e_hw *hw, u32 reg_addr, u32 reg_val)* completion before returning. **/ i40e_status i40e_aq_send_msg_to_pf (struct i40e_hw *hw, -enum i40e_virtchnl_ops v_opcode, +enum virtchnl_ops v_opcode,i40e_status v_retval,u8 *msg,u16 msglen,struct i40e_asq_cmd_details *cmd_details)
@@ -1092,9 +1092,9 @@ i40e_status i40e_aq_send_msg_to_pf(struct i40e_hw *hw,* with appropriate information. **/ void i40e_vf_parse_hw_config (struct i40e_hw *hw, -struct i40e_virtchnl_vf_resource *msg) +struct virtchnl_vf_resource *msg) { -struct i40e_virtchnl_vsi_resource *vsi_res; +struct virtchnl_vsi_resource *vsi_res;int i; vsi_res = &msg->vsi_res[0 ];
@@ -1104,7 +1104,7 @@ void i40e_vf_parse_hw_config(struct i40e_hw *hw, hw->dev_caps.num_tx_qp = msg->num_queue_pairs; hw->dev_caps.num_msix_vectors_vf = msg->max_vectors; hw->dev_caps.dcb = msg->vf_offload_flags & -I40E_VIRTCHNL_VF_OFFLOAD_L2 ; +VIRTCHNL_VF_OFFLOAD_L2 ; hw->dev_caps.fcoe =0 ;for (i =0 ; i < msg->num_vsis; i++) {if (vsi_res->vsi_type ==I40E_VSI_SRIOV ) {
@@ -1127,7 +1127,7 @@ void i40e_vf_parse_hw_config(struct i40e_hw *hw,**/ i40e_status i40e_vf_reset (struct i40e_hw *hw) { -return i40e_aq_send_msg_to_pf (hw,I40E_VIRTCHNL_OP_RESET_VF , +return i40e_aq_send_msg_to_pf (hw,VIRTCHNL_OP_RESET_VF ,0 ,NULL ,0 ,NULL ); }
drivers/net/ethernet/intel/i40evf/i40e_prototype.h +2 -2
@@ -87,10 +87,10 @@ static inline struct i40e_rx_ptype_decoded decode_rx_desc_ptype(u8 ptype)/* i40e_common for VF drivers*/ void i40e_vf_parse_hw_config (struct i40e_hw *hw, -struct i40e_virtchnl_vf_resource *msg); +struct virtchnl_vf_resource *msg);i40e_status i40e_vf_reset (struct i40e_hw *hw);i40e_status i40e_aq_send_msg_to_pf (struct i40e_hw *hw, -enum i40e_virtchnl_ops v_opcode, +enum virtchnl_ops v_opcode,i40e_status v_retval,u8 *msg,u16 msglen,struct i40e_asq_cmd_details *cmd_details);
drivers/net/ethernet/intel/i40evf/i40evf.h +11 -11
@@ -264,25 +264,25 @@ struct i40evf_adapter {bool netdev_registered;bool link_up;enum i40e_aq_link_speed link_speed; -enum i40e_virtchnl_ops current_op; +enum virtchnl_ops current_op;#define CLIENT_ALLOWED (_a) ((_a)->vf_res ? \ (_a)->vf_res->vf_offload_flags & \ - I40E_VIRTCHNL_VF_OFFLOAD_IWARP : \ + VIRTCHNL_VF_OFFLOAD_IWARP : \ 0)#define CLIENT_ENABLED (_a) ((_a)->cinst)/* RSS by the PF should be preferred over RSS via other methods. */ #define RSS_PF (_a) ((_a)->vf_res->vf_offload_flags & \ - I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF) + VIRTCHNL_VF_OFFLOAD_RSS_PF)#define RSS_AQ (_a) ((_a)->vf_res->vf_offload_flags & \ - I40E_VIRTCHNL_VF_OFFLOAD_RSS_AQ) + VIRTCHNL_VF_OFFLOAD_RSS_AQ)#define RSS_REG (_a) (!((_a)->vf_res->vf_offload_flags & \ - (I40E_VIRTCHNL_VF_OFFLOAD_RSS_AQ | \ - I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF))) + (VIRTCHNL_VF_OFFLOAD_RSS_AQ | \ + VIRTCHNL_VF_OFFLOAD_RSS_PF)))#define VLAN_ALLOWED (_a) ((_a)->vf_res->vf_offload_flags & \ - I40E_VIRTCHNL_VF_OFFLOAD_VLAN) -struct i40e_virtchnl_vf_resource *vf_res;/* incl. all VSIs */ -struct i40e_virtchnl_vsi_resource *vsi_res;/* our LAN VSI */ -struct i40e_virtchnl_version_info pf_version; + VIRTCHNL_VF_OFFLOAD_VLAN) +struct virtchnl_vf_resource *vf_res;/* incl. all VSIs */ +struct virtchnl_vsi_resource *vsi_res;/* our LAN VSI */ +struct virtchnl_version_info pf_version;#define PF_IS_V11 (_a) (((_a)->pf_version.major == 1) && \ ((_a)->pf_version.minor == 1))u16 msg_enable;
@@ -348,7 +348,7 @@ void i40evf_set_hena(struct i40evf_adapter *adapter);void i40evf_set_rss_key (struct i40evf_adapter *adapter);void i40evf_set_rss_lut (struct i40evf_adapter *adapter);void i40evf_virtchnl_completion (struct i40evf_adapter *adapter, -enum i40e_virtchnl_ops v_opcode, +enum virtchnl_ops v_opcode,i40e_status v_retval,u8 *msg,u16 msglen);int i40evf_config_rss (struct i40evf_adapter *adapter);int i40evf_lan_add_device (struct i40evf_adapter *adapter);
drivers/net/ethernet/intel/i40evf/i40evf_client.c +9 -9
@@ -120,7 +120,7 @@ static int i40evf_client_release_qvlist(struct i40e_info *ldev)return -EAGAIN ; err =i40e_aq_send_msg_to_pf (&adapter->hw, -I40E_VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP , +VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP ,I40E_SUCCESS ,NULL ,0 ,NULL );if (err)
@@ -410,7 +410,7 @@ static u32 i40evf_client_virtchnl_send(struct i40e_info *ldev,if (adapter->aq_required)return -EAGAIN ; - err =i40e_aq_send_msg_to_pf (&adapter->hw,I40E_VIRTCHNL_OP_IWARP , + err =i40e_aq_send_msg_to_pf (&adapter->hw,VIRTCHNL_OP_IWARP ,I40E_SUCCESS , msg, len,NULL );if (err) dev_err(&adapter->pdev->dev, "Unable to send iWarp message to PF, error %d, aq status %d\n",
@@ -431,7 +431,7 @@ static int i40evf_client_setup_qvlist(struct i40e_info *ldev,struct i40e_client *client, struct i40e_qvlist_info *qvlist_info) { - struct i40e_virtchnl_iwarp_qvlist_info *v_qvlist_info; + struct virtchnl_iwarp_qvlist_info *v_qvlist_info;struct i40evf_adapter *adapter = ldev->vf;struct i40e_qv_info *qv_info;i40e_status err;
@@ -453,14 +453,14 @@ static int i40evf_client_setup_qvlist(struct i40e_info *ldev,return -EINVAL ; } - v_qvlist_info = (struct i40e_virtchnl_iwarp_qvlist_info *)qvlist_info; - msg_size =sizeof (struct i40e_virtchnl_iwarp_qvlist_info ) + - (sizeof (struct i40e_virtchnl_iwarp_qv_info ) * + v_qvlist_info = (struct virtchnl_iwarp_qvlist_info *)qvlist_info; + msg_size =sizeof (struct virtchnl_iwarp_qvlist_info ) + + (sizeof (struct virtchnl_iwarp_qv_info ) * (v_qvlist_info->num_vectors -1 )); - adapter->client_pending |=BIT (I40E_VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP ); + adapter->client_pending |=BIT (VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP ); err =i40e_aq_send_msg_to_pf (&adapter->hw, -I40E_VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP , +VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP ,I40E_SUCCESS , (u8 *)v_qvlist_info, msg_size,NULL );if (err) {
@@ -474,7 +474,7 @@ static int i40evf_client_setup_qvlist(struct i40e_info *ldev,for (i =0 ; i <5 ; i++) {msleep (100 );if (!(adapter->client_pending & -BIT (I40E_VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP ))) { +BIT (VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP ))) { err =0 ;break ; }
drivers/net/ethernet/intel/i40evf/i40evf_main.c +24 -24
169 lines not on this page · raw message
drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +140 -140
713 lines not on this page · raw message
include/linux/avf/virtchnl.h +117 -116
467 lines not on this page · raw message
Signature · 1 line
2.9.3
Bowers
PATCH v3 4/14 virtchnl: rename i40e to generic virtchnl
Quoted 47 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Jesse Brandeburg
Sent: Thursday, May 11, 2017 11:23 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next v3 04/14] virtchnl: rename i40e to generic virtchnlThis morphs all the i40e and i40evf references to/in
virtchnl.hto be generic, using only automated methods. Updates all the callers to use the new names. A followup patch provides separate clean ups for messy line conversions from these "automatic" changes, to make them more reviewable.Was executed with the following sed script:
sed -i -ftransform_scriptdrivers/net/ethernet/intel/i40e/i40e_client.csed -i -ftransform_scriptdrivers/net/ethernet/intel/i40e/i40e_prototype.hsed -i -ftransform_scriptdrivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.csed -i -ftransform_scriptdrivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.hsed -i -ftransform_scriptdrivers/net/ethernet/intel/i40evf/i40e_common.csed -i -ftransform_scriptdrivers/net/ethernet/intel/i40evf/i40e_prototype.h
sed -i -ftransform_scriptdrivers/net/ethernet/intel/i40evf/i40evf.hsed -i -ftransform_scriptdrivers/net/ethernet/intel/i40evf/i40evf_client.csed -i -ftransform_scriptdrivers/net/ethernet/intel/i40evf/i40evf_main.csed -i -ftransform_scriptdrivers/net/ethernet/intel/i40evf/i40evf_virtchnl.csed -i -ftransform_scriptinclude/linux/avf/virtchnl.h
transform_script:
----8<---- s/I40E_VIRTCHNL_SUPPORTED_QTYPES/SAVE_ME_SUPPORTED_QTYPES/g s/I40E_VIRTCHNL_VF_CAP/SAVE_ME_VF_CAP/gs/I40E_VIRTCHNL_/VIRTCHNL_/g
s/i40e_virtchnl_/virtchnl_/g
s/i40e_vfr_/virtchnl_vfr_/g
s/I40E_VFR_/VIRTCHNL_VFR_/gs/VIRTCHNL_OP_ADD_ETHER_ADDRESS/VIRTCHNL_OP_ADD_ETH_ADDR/g s/VIRTCHNL_OP_DEL_ETHER_ADDRESS/VIRTCHNL_OP_DEL_ETH_ADDR/g s/VIRTCHNL_OP_FCOE/VIRTCHNL_OP_RSVD/g
s/SAVE_ME_SUPPORTED_QTYPES/I40E_VIRTCHNL_SUPPORTED_QTYPES/g s/SAVE_ME_VF_CAP/I40E_VIRTCHNL_VF_CAP/g
----8<----Signed-off-by Jesse Brandeburg <[email protected]>
Quoted 14 lines
--- drivers/net/ethernet/intel/i40e/i40e_client.c | 2 +- drivers/net/ethernet/intel/i40e/i40e_prototype.h | 4 +- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 370 ++++++++++-------- --- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 6 +- drivers/net/ethernet/intel/i40evf/i40e_common.c | 10 +- drivers/net/ethernet/intel/i40evf/i40e_prototype.h | 4 +- drivers/net/ethernet/intel/i40evf/i40evf.h | 22 +- drivers/net/ethernet/intel/i40evf/i40evf_client.c | 18 +- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 48 +-- .../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 280 ++++++++-------- include/linux/avf/virtchnl.h | 233 ++++++------- 11 files changed, 499 insertions(+), 498 deletions(-)
PATCH v3 5/14 virtchnl: move some code to core driver
In reply to Jesse BrandeburgBefore moving this function over to virtchnl.h, move some driver specific checks that had snuck into a fairly generic function, back into the caller of the function.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 30 +++++++++++++--------- 1 file changed, 18 insertions(+), 12 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +18 -12
@@ -2549,10 +2549,6 @@ static int i40e_vc_validate_vf_msg(struct i40e_vf *vf, u32 v_opcode,bool err_msg_format = false;int valid_len =0 ; -/* Check if VF is disabled. */ -if (test_bit (I40E_VF_STATE_DISABLED , &vf->vf_states)) -return I40E_ERR_PARAM ; -/* Validate message length. */ switch (v_opcode) {case VIRTCHNL_OP_VERSION :
@@ -2657,10 +2653,6 @@ static int i40e_vc_validate_vf_msg(struct i40e_vf *vf, u32 v_opcode,if (msglen >= valid_len) {struct virtchnl_rss_key *vrk = (struct virtchnl_rss_key *)msg; -if (vrk->key_len !=I40E_HKEY_ARRAY_SIZE ) { - err_msg_format = true; -break ; - } valid_len += vrk->key_len -1 ; }break ;
@@ -2669,10 +2661,6 @@ static int i40e_vc_validate_vf_msg(struct i40e_vf *vf, u32 v_opcode,if (msglen >= valid_len) {struct virtchnl_rss_lut *vrl = (struct virtchnl_rss_lut *)msg; -if (vrl->lut_entries !=I40E_VF_HLUT_ARRAY_SIZE ) { - err_msg_format = true; -break ; - } valid_len += vrl->lut_entries -1 ; }break ;
@@ -2719,9 +2707,27 @@ int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode,if (local_vf_id >= pf->num_alloc_vfs)return -EINVAL ; vf = &(pf->vf[local_vf_id]); + +/* Check if VF is disabled. */ +if (test_bit (I40E_VF_STATE_DISABLED , &vf->vf_states)) +return I40E_ERR_PARAM ; +/* perform basic checks on the msg */ ret =i40e_vc_validate_vf_msg (vf, v_opcode, v_retval, msg, msglen); +/* perform additional checks specific to this driver */ +if (v_opcode ==VIRTCHNL_OP_CONFIG_RSS_KEY ) { +struct virtchnl_rss_key *vrk = (struct virtchnl_rss_key *)msg; + +if (vrk->key_len !=I40E_HKEY_ARRAY_SIZE ) + ret = -EINVAL ; + }else if (v_opcode ==VIRTCHNL_OP_CONFIG_RSS_LUT ) { +struct virtchnl_rss_lut *vrl = (struct virtchnl_rss_lut *)msg; + +if (vrl->lut_entries !=I40E_VF_HLUT_ARRAY_SIZE ) + ret = -EINVAL ; + } +if (ret) {dev_err (&pf->pdev->dev,"Invalid message from VF %d, opcode %d, len %d\n" , local_vf_id, v_opcode, msglen);
Signature · 1 line
2.9.3
Bowers
PATCH v3 5/14 virtchnl: move some code to core driver
Quoted 12 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Jesse Brandeburg
Sent: Thursday, May 11, 2017 11:23 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next v3 05/14] virtchnl: move some code to core driverBefore moving this function over to
virtchnl.h, move some driver specific checks that had snuck into a fairly generic function, back into the caller of the function.
Quoted 5 lines
Signed-off-by Jesse Brandeburg <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 30 +++++++++++++---- ----- 1 file changed, 18 insertions(+), 12 deletions(-)
PATCH v3 6/14 virtchnl: convert to new macros
In reply to Jesse BrandeburgAs part of the conversion, change the arguments to VF_IS_V1[01] macros and move them to virtchnl.h
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 6 +++--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 3 --- include/linux/avf/virtchnl.h | 3 +++ 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +3 -3
@@ -1481,7 +1481,7 @@ static int i40e_vc_get_version_msg(struct i40e_vf *vf, u8 *msg) vf->vf_ver = *(struct virtchnl_version_info *)msg;/* VFs running the 1.0 API expect to get 1.0 back or they will cry. */ -if (VF_IS_V10 (vf)) +if (VF_IS_V10 (&vf->vf_ver)) info.minor =VIRTCHNL_VERSION_MINOR_NO_VF_CAPS ; return i40e_vc_send_msg_to_vf(vf, VIRTCHNL_OP_VERSION, I40E_SUCCESS, (u8 *)&info,
@@ -1521,7 +1521,7 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg) len =0 ; goto err; } -if (VF_IS_V11 (vf)) +if (VF_IS_V11 (&vf->vf_ver)) vf->driver_caps = *(u32 *)msg;else vf->driver_caps = VIRTCHNL_VF_OFFLOAD_L2 |
@@ -2557,7 +2557,7 @@ static int i40e_vc_validate_vf_msg(struct i40e_vf *vf, u32 v_opcode,case VIRTCHNL_OP_RESET_VF :break ;case VIRTCHNL_OP_GET_VF_RESOURCES : -if (VF_IS_V11 (vf)) +if (VF_IS_V11 (&vf->vf_ver)) valid_len =sizeof (u32);break ;case VIRTCHNL_OP_CONFIG_TX_QUEUE :
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +0 -3
@@ -40,9 +40,6 @@#define I40E_VLAN_MASK 0xFFF#define I40E_PRIORITY_MASK 0x7000 -#define VF_IS_V10 (_v) (((_v)->vf_ver.major == 1) && ((_v)->vf_ver.minor == 0)) -#define VF_IS_V11 (_v) (((_v)->vf_ver.major == 1) && ((_v)->vf_ver.minor == 1)) -/* Various queue ctrls */ enum i40e_queue_ctrl {I40E_QUEUE_CTRL_UNKNOWN =0 ,
include/linux/avf/virtchnl.h +3 -0
@@ -123,6 +123,9 @@ struct virtchnl_version_info {u32 minor; }; +#define VF_IS_V10 (_v) (((_v)->major == 1) && ((_v)->minor == 0)) +#define VF_IS_V11 (_ver) (((_ver)->major == 1) && ((_ver)->minor == 1)) +/* VIRTCHNL_OP_RESET_VF * VF sends this request to PF with no parameters * PF does NOT respond! VF driver must delay then poll VFGEN_RSTAT register
Signature · 1 line
2.9.3
Bowers
PATCH v3 6/14 virtchnl: convert to new macros
Quoted 11 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Jesse Brandeburg
Sent: Thursday, May 11, 2017 11:23 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next v3 06/14] virtchnl: convert to new macrosAs part of the conversion, change the arguments to VF_IS_V1[01] macros and move them to
virtchnl.h
Quoted 6 lines
Signed-off-by Jesse Brandeburg <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 6 +++--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 3 --- include/linux/avf/virtchnl.h | 3 +++ 3 files changed, 6 insertions(+), 6 deletions(-)
PATCH v3 7/14 i40e/virtchnl: refactor code for validate checks
In reply to Jesse BrandeburgThis change updates the arguments passed to the validate function and fixes the caller, as well as uses the new return values added to virtchnl.h
One other minor tweak, remove a duplicate set to zero of valid_len.
This is in preparation for moving the function to virtchnl.h.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 36 ++++++++++++---------- include/linux/avf/virtchnl.h | 17 ++++++++++ 2 files changed, 37 insertions(+), 16 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +20 -16
@@ -2536,15 +2536,16 @@ static int i40e_vc_set_rss_hena(struct i40e_vf *vf, u8 *msg, u16 msglen)/** * i40e_vc_validate_vf_msg -* @vf: pointer to the VF info +* @ver: Virtchnl version info +* @v_opcode: Opcode for the message * @msg: pointer to the msg buffer * @msglen: msg length -* @msghndl: msg handle * -* validate msg +* validate msg format against struct for each opcode **/ -static int i40e_vc_validate_vf_msg (struct i40e_vf *vf,u32 v_opcode, -u32 v_retval,u8 *msg,u16 msglen) +static int +i40e_vc_validate_vf_msg (struct virtchnl_version_info *ver,u32 v_opcode, +u8 *msg,u16 msglen) {bool err_msg_format = false;int valid_len =0 ;
@@ -2557,7 +2558,7 @@ static int i40e_vc_validate_vf_msg(struct i40e_vf *vf, u32 v_opcode,case VIRTCHNL_OP_RESET_VF :break ;case VIRTCHNL_OP_GET_VF_RESOURCES : -if (VF_IS_V11 (&vf->vf_ver)) +if (VF_IS_V11 (ver)) valid_len =sizeof (u32);break ;case VIRTCHNL_OP_CONFIG_TX_QUEUE :
@@ -2633,7 +2634,6 @@ static int i40e_vc_validate_vf_msg(struct i40e_vf *vf, u32 v_opcode, err_msg_format = true;break ;case VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP : - valid_len =0 ;break ;case VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP : valid_len =sizeof (struct virtchnl_iwarp_qvlist_info );
@@ -2673,15 +2673,13 @@ static int i40e_vc_validate_vf_msg(struct i40e_vf *vf, u32 v_opcode,case VIRTCHNL_OP_EVENT :case VIRTCHNL_OP_UNKNOWN :default : -return -EPERM ; +return VIRTCHNL_ERR_PARAM ; }/* few more checks */ -if ((valid_len != msglen) || (err_msg_format)) { -i40e_vc_send_resp_to_vf (vf, v_opcode,I40E_ERR_PARAM ); -return -EINVAL ; - }else { -return 0 ; - } +if ((valid_len != msglen) || (err_msg_format)) +return VIRTCHNL_STATUS_ERR_OPCODE_MISMATCH ; + +return 0 ; }/**
@@ -2713,7 +2711,7 @@ int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode,return I40E_ERR_PARAM ;/* perform basic checks on the msg */ - ret =i40e_vc_validate_vf_msg (vf, v_opcode, v_retval, msg, msglen); + ret =i40e_vc_validate_vf_msg (&vf->vf_ver, v_opcode, msg, msglen);/* perform additional checks specific to this driver */ if (v_opcode ==VIRTCHNL_OP_CONFIG_RSS_KEY ) {
@@ -2729,9 +2727,15 @@ int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode, }if (ret) { +i40e_vc_send_resp_to_vf (vf, v_opcode,I40E_ERR_PARAM );dev_err (&pf->pdev->dev,"Invalid message from VF %d, opcode %d, len %d\n" , local_vf_id, v_opcode, msglen); -return ret; +switch (ret) { +case VIRTCHNL_ERR_PARAM : +return -EPERM ; +default : +return -EINVAL ; + } }switch (v_opcode) {
include/linux/avf/virtchnl.h +17 -0
@@ -53,6 +53,23 @@* its queues, optionally add MAC and VLAN filters, and process traffic. */ +/* START GENERIC DEFINES +* Need to ensure the following enums and defines hold the same meaning and +* value in current and future projects +*/ + +/* Error Codes */ +enum virtchnl_status_code { +VIRTCHNL_STATUS_SUCCESS =0 , +VIRTCHNL_ERR_PARAM =-5 , +VIRTCHNL_STATUS_ERR_OPCODE_MISMATCH =-38 , +VIRTCHNL_STATUS_ERR_CQP_COMPL_ERROR =-39 , +VIRTCHNL_STATUS_ERR_INVALID_VF_ID =-40 , +VIRTCHNL_STATUS_NOT_SUPPORTED =-64 , +}; + +/* END GENERIC DEFINES */ +/* Opcodes for VF-PF communication. These are placed in the v_opcode field * of the virtchnl_msg structure. */
Signature · 1 line
2.9.3
Bowers
PATCH v3 7/14 i40e/virtchnl: refactor code for validate checks
Quoted 13 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Jesse Brandeburg
Sent: Thursday, May 11, 2017 11:23 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next v3 07/14] i40e/virtchnl: refactor code for validate checksThis change updates the arguments passed to the validate function and fixes the caller, as well as uses the new return values added to
virtchnl.hOne other minor tweak, remove a duplicate set to zero of
valid_len.
Quoted 8 lines
This is in preparation for moving the function to
virtchnl.h.Signed-off-by Jesse Brandeburg <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 36 ++++++++++++------ ---- include/linux/avf/virtchnl.h | 17 ++++++++++ 2 files changed, 37 insertions(+), 16 deletions(-)
PATCH v3 8/14 i40evf/virtchnl: whitespace cleanups
In reply to Jesse BrandeburgThis patch fixes up a bunch of whitespace issues introduced by the previous automated change of name from i40e to virtchnl.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 12 ++++-------- drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c | 3 +-- include/linux/avf/virtchnl.h | 6 +++--- 3 files changed, 8 insertions(+), 13 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +4 -8
@@ -1485,8 +1485,7 @@ static int i40e_vc_get_version_msg(struct i40e_vf *vf, u8 *msg) info.minor =VIRTCHNL_VERSION_MINOR_NO_VF_CAPS ;return i40e_vc_send_msg_to_vf (vf,VIRTCHNL_OP_VERSION ,I40E_SUCCESS , (u8 *)&info, -sizeof (struct -virtchnl_version_info )); +sizeof (struct virtchnl_version_info )); }/**
@@ -1544,11 +1543,9 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg) }else {if ((pf->flags &I40E_FLAG_RSS_AQ_CAPABLE ) && (vf->driver_caps &VIRTCHNL_VF_OFFLOAD_RSS_AQ )) - vfres->vf_offload_flags |= -VIRTCHNL_VF_OFFLOAD_RSS_AQ ; + vfres->vf_offload_flags |=VIRTCHNL_VF_OFFLOAD_RSS_AQ ;else - vfres->vf_offload_flags |= -VIRTCHNL_VF_OFFLOAD_RSS_REG ; + vfres->vf_offload_flags |=VIRTCHNL_VF_OFFLOAD_RSS_REG ; }if (pf->flags &I40E_FLAG_MULTIPLE_TCP_UDP_RSS_PCTYPE ) {
@@ -2530,8 +2527,7 @@ static int i40e_vc_set_rss_hena(struct i40e_vf *vf, u8 *msg, u16 msglen)/* send the response to the VF */ err: -return i40e_vc_send_resp_to_vf (vf,VIRTCHNL_OP_SET_RSS_HENA , - aq_ret); +return i40e_vc_send_resp_to_vf (vf,VIRTCHNL_OP_SET_RSS_HENA , aq_ret); }/**
drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +1 -2
@@ -1018,8 +1018,7 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter, ~(BIT (VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP ));break ;case VIRTCHNL_OP_GET_RSS_HENA_CAPS : { -struct virtchnl_rss_hena *vrh = - (struct virtchnl_rss_hena *)msg; +struct virtchnl_rss_hena *vrh = (struct virtchnl_rss_hena *)msg;if (msglen ==sizeof (*vrh)) adapter->hena = vrh->hena;else
include/linux/avf/virtchnl.h +3 -3
@@ -175,10 +175,10 @@ struct virtchnl_vsi_resource {#define VIRTCHNL_VF_OFFLOAD_IWARP 0x00000002#define VIRTCHNL_VF_OFFLOAD_FCOE 0x00000004#define VIRTCHNL_VF_OFFLOAD_RSS_AQ 0x00000008 -#define VIRTCHNL_VF_OFFLOAD_RSS_REG 0x00000010 -#define VIRTCHNL_VF_OFFLOAD_WB_ON_ITR 0x00000020 +#define VIRTCHNL_VF_OFFLOAD_RSS_REG 0x00000010 +#define VIRTCHNL_VF_OFFLOAD_WB_ON_ITR 0x00000020#define VIRTCHNL_VF_OFFLOAD_VLAN 0x00010000 -#define VIRTCHNL_VF_OFFLOAD_RX_POLLING 0x00020000 +#define VIRTCHNL_VF_OFFLOAD_RX_POLLING 0x00020000#define VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 0x00040000#define VIRTCHNL_VF_OFFLOAD_RSS_PF 0X00080000#define VIRTCHNL_VF_OFFLOAD_ENCAP 0X00100000
Signature · 1 line
2.9.3
Bowers
PATCH v3 8/14 i40evf/virtchnl: whitespace cleanups
Quoted 11 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Jesse Brandeburg
Sent: Thursday, May 11, 2017 11:23 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next v3 08/14] i40evf/virtchnl:
whitespace cleanupsThis patch fixes up a bunch of whitespace issues introduced by the previous automated change of name from i40e to virtchnl.
Quoted 6 lines
Signed-off-by Jesse Brandeburg <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 12 ++++-------- drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c | 3 +-- include/linux/avf/virtchnl.h | 6 +++--- 3 files changed, 8 insertions(+), 13 deletions(-)
PATCH v3 9/14 virtchnl: finish conversion to virtchnl interface
In reply to Jesse BrandeburgThis patch implements the complete version of the virtchnl.h file with final renames, and fixes the related code in i40e and i40evf.
It also expands comments, and adds details on the usage of certain fields.
In addition, due to the changes a couple of casts are needed to prevent errors found by sparse after renaming some fields.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 18 +-- drivers/net/ethernet/intel/i40evf/i40e_common.c | 2 +- drivers/net/ethernet/intel/i40evf/i40evf.h | 2 +- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 11 +- .../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 6 +- include/linux/avf/virtchnl.h | 128 +++++++++++++-------- 6 files changed, 102 insertions(+), 65 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +10 -8
@@ -77,7 +77,7 @@ static void i40e_vc_notify_vf_link_state(struct i40e_vf *vf)int abs_vf_id = vf->vf_id + (int )hw->func_caps.vf_base_id; pfe.event =VIRTCHNL_EVENT_LINK_CHANGE ; - pfe.severity =I40E_PF_EVENT_SEVERITY_INFO ; + pfe.severity =PF_EVENT_SEVERITY_INFO ;if (vf->link_forced) { pfe.event_data.link_event.link_status = vf->link_up; pfe.event_data.link_event.link_speed =
@@ -85,7 +85,8 @@ static void i40e_vc_notify_vf_link_state(struct i40e_vf *vf) }else { pfe.event_data.link_event.link_status = ls->link_info &I40E_AQ_LINK_UP ; - pfe.event_data.link_event.link_speed = ls->link_speed; + pfe.event_data.link_event.link_speed = + (enum virtchnl_link_speed )ls->link_speed; }i40e_aq_send_msg_to_vf (hw, abs_vf_id,VIRTCHNL_OP_EVENT ,0 , (u8 *)&pfe,sizeof (pfe),NULL );
@@ -116,7 +117,7 @@ void i40e_vc_notify_reset(struct i40e_pf *pf)struct virtchnl_pf_event pfe; pfe.event =VIRTCHNL_EVENT_RESET_IMPENDING ; - pfe.severity =I40E_PF_EVENT_SEVERITY_CERTAIN_DOOM ; + pfe.severity =PF_EVENT_SEVERITY_CERTAIN_DOOM ;i40e_vc_vf_broadcast (pf,VIRTCHNL_OP_EVENT ,0 , (u8 *)&pfe,sizeof (struct virtchnl_pf_event )); }
@@ -144,7 +145,7 @@ void i40e_vc_notify_vf_reset(struct i40e_vf *vf) abs_vf_id = vf->vf_id + (int )vf->pf->hw.func_caps.vf_base_id; pfe.event =VIRTCHNL_EVENT_RESET_IMPENDING ; - pfe.severity =I40E_PF_EVENT_SEVERITY_CERTAIN_DOOM ; + pfe.severity =PF_EVENT_SEVERITY_CERTAIN_DOOM ;i40e_aq_send_msg_to_vf (&vf->pf->hw, abs_vf_id,VIRTCHNL_OP_EVENT ,0 , (u8 *)&pfe,sizeof (struct virtchnl_pf_event ),NULL );
@@ -1586,7 +1587,7 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)if (vf->lan_vsi_idx) { vfres->vsi_res[0 ].vsi_id = vf->lan_vsi_id; - vfres->vsi_res[0 ].vsi_type =I40E_VSI_SRIOV ; + vfres->vsi_res[0 ].vsi_type =VIRTCHNL_VSI_SRIOV ; vfres->vsi_res[0 ].num_queue_pairs = vsi->alloc_queue_pairs;/* VFs only use TC 0 */ vfres->vsi_res[0 ].qset_handle
@@ -1680,7 +1681,7 @@ static int i40e_vc_config_promiscuous_mode_msg(struct i40e_vf *vf, goto error_param; }/* Multicast promiscuous handling*/ -if (info->flags &I40E_FLAG_VF_MULTICAST_PROMISC ) +if (info->flags &FLAG_VF_MULTICAST_PROMISC ) allmulti = true;if (vf->port_vlan_id) {
@@ -1731,7 +1732,7 @@ static int i40e_vc_config_promiscuous_mode_msg(struct i40e_vf *vf,clear_bit (I40E_VF_STATE_MC_PROMISC , &vf->vf_states); } -if (info->flags &I40E_FLAG_VF_UNICAST_PROMISC ) +if (info->flags &FLAG_VF_UNICAST_PROMISC ) alluni = true;if (vf->port_vlan_id) { aq_ret = i40e_aq_set_vsi_uc_promisc_on_vlan(hw, vsi->seid,
@@ -3241,7 +3242,7 @@ int i40e_ndo_set_vf_link_state(struct net_device *netdev, int vf_id, int link) abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; pfe.event =VIRTCHNL_EVENT_LINK_CHANGE ; - pfe.severity =I40E_PF_EVENT_SEVERITY_INFO ; + pfe.severity =PF_EVENT_SEVERITY_INFO ;switch (link) {case IFLA_VF_LINK_STATE_AUTO :
@@ -3249,6 +3250,7 @@ int i40e_ndo_set_vf_link_state(struct net_device *netdev, int vf_id, int link) pfe.event_data.link_event.link_status = pf->hw.phy.link_info.link_info &I40E_AQ_LINK_UP ; pfe.event_data.link_event.link_speed = + (enum virtchnl_link_speed ) pf->hw.phy.link_info.link_speed;break ;case IFLA_VF_LINK_STATE_ENABLE :
drivers/net/ethernet/intel/i40evf/i40e_common.c +1 -1
@@ -1107,7 +1107,7 @@ void i40e_vf_parse_hw_config(struct i40e_hw *hw,VIRTCHNL_VF_OFFLOAD_L2 ; hw->dev_caps.fcoe =0 ;for (i =0 ; i < msg->num_vsis; i++) { -if (vsi_res->vsi_type ==I40E_VSI_SRIOV ) { +if (vsi_res->vsi_type ==VIRTCHNL_VSI_SRIOV ) {ether_addr_copy (hw->mac.perm_addr, vsi_res->default_mac_addr); ether_addr_copy(hw->mac.addr,
drivers/net/ethernet/intel/i40evf/i40evf.h +1 -1
@@ -263,7 +263,7 @@ struct i40evf_adapter {struct work_struct watchdog_task;bool netdev_registered;bool link_up; -enum i40e_aq_link_speed link_speed; +enum virtchnl_link_speed link_speed;enum virtchnl_ops current_op;#define CLIENT_ALLOWED (_a) ((_a)->vf_res ? \ (_a)->vf_res->vf_offload_flags & \
drivers/net/ethernet/intel/i40evf/i40evf_main.c +6 -5
@@ -1707,13 +1707,13 @@ static void i40evf_watchdog_task(struct work_struct *work) }if (adapter->aq_required &I40EVF_FLAG_AQ_REQUEST_PROMISC ) { -i40evf_set_promiscuous (adapter,I40E_FLAG_VF_UNICAST_PROMISC | -I40E_FLAG_VF_MULTICAST_PROMISC ); +i40evf_set_promiscuous (adapter,FLAG_VF_UNICAST_PROMISC | +FLAG_VF_MULTICAST_PROMISC ); goto watchdog_done; }if (adapter->aq_required &I40EVF_FLAG_AQ_REQUEST_ALLMULTI ) { -i40evf_set_promiscuous (adapter,I40E_FLAG_VF_MULTICAST_PROMISC ); +i40evf_set_promiscuous (adapter,FLAG_VF_MULTICAST_PROMISC ); goto watchdog_done; }
@@ -1969,7 +1969,8 @@ static void i40evf_adminq_task(struct work_struct *work)break ;/* No event to process or error cleaning ARQ */ i40evf_virtchnl_completion (adapter, v_msg->v_opcode, - v_msg->v_retval, event.msg_buf, + (i40e_status )v_msg->v_retval, + event.msg_buf, event.msg_len);if (pending !=0 )memset (event.msg_buf,0 ,I40EVF_MAX_AQ_BUF_SIZE );
@@ -2410,7 +2411,7 @@ int i40evf_process_config(struct i40evf_adapter *adapter)/* got VF config message back from PF, now we can parse it */ for (i =0 ; i < vfres->num_vsis; i++) { -if (vfres->vsi_res[i].vsi_type ==I40E_VSI_SRIOV ) +if (vfres->vsi_res[i].vsi_type ==VIRTCHNL_VSI_SRIOV ) adapter->vsi_res = &vfres->vsi_res[i]; }if (!adapter->vsi_res) {
drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +3 -3
@@ -662,15 +662,15 @@ void i40evf_set_promiscuous(struct i40evf_adapter *adapter, int flags)return ; } - promisc_all =I40E_FLAG_VF_UNICAST_PROMISC | -I40E_FLAG_VF_MULTICAST_PROMISC ; + promisc_all =FLAG_VF_UNICAST_PROMISC | +FLAG_VF_MULTICAST_PROMISC ;if ((flags & promisc_all) == promisc_all) { adapter->flags |=I40EVF_FLAG_PROMISC_ON ; adapter->aq_required &= ~I40EVF_FLAG_AQ_REQUEST_PROMISC ;dev_info (&adapter->pdev->dev,"Entering promiscuous mode\n" ); } -if (flags &I40E_FLAG_VF_MULTICAST_PROMISC ) { +if (flags &FLAG_VF_MULTICAST_PROMISC ) { adapter->flags |=I40EVF_FLAG_ALLMULTI_ON ; adapter->aq_required &= ~I40EVF_FLAG_AQ_REQUEST_ALLMULTI ;dev_info (&adapter->pdev->dev,"Entering multicast promiscuous mode\n" );
include/linux/avf/virtchnl.h +81 -47
257 lines not on this page · raw message
Signature · 1 line
2.9.3
Bowers
PATCH v3 9/14 virtchnl: finish conversion to virtchnl interface
Quoted 17 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Jesse Brandeburg
Sent: Thursday, May 11, 2017 11:23 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next v3 09/14] virtchnl: finish conversion to virtchnl interfaceThis patch implements the complete version of the
virtchnl.hfile with final renames, and fixes the related code in i40e and i40evf.It also expands comments, and adds details on the usage of certain fields.
In addition, due to the changes a couple of casts are needed to prevent errors found by sparse after renaming some fields.
Signed-off-by Jesse Brandeburg <[email protected]>
Quoted 8 lines
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 18 +-- drivers/net/ethernet/intel/i40evf/i40e_common.c | 2 +- drivers/net/ethernet/intel/i40evf/i40evf.h | 2 +- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 11 +- .../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 6 +- include/linux/avf/virtchnl.h | 128 +++++++++++++-------- 6 files changed, 102 insertions(+), 65 deletions(-)
PATCH v3 10/14 i40e/virtchnl: move function to virtchnl
In reply to Jesse BrandeburgThis moves a function that is needed for the virtchnl interface from the i40e PF driver over to the virtchnl.h file.
It was manually verified that the function in question is unchanged except for the function name and function header, which explains the slight difference in the number of lines removed/added.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 150 +-------------------- include/linux/avf/virtchnl.h | 147 ++++++++++++++++++++ 2 files changed, 148 insertions(+), 149 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +1 -149
@@ -2532,154 +2532,6 @@ static int i40e_vc_set_rss_hena(struct i40e_vf *vf, u8 *msg, u16 msglen) }/** -* i40e_vc_validate_vf_msg -* @ver: Virtchnl version info -* @v_opcode: Opcode for the message -* @msg: pointer to the msg buffer -* @msglen: msg length -* -* validate msg format against struct for each opcode -**/ -static int -i40e_vc_validate_vf_msg (struct virtchnl_version_info *ver,u32 v_opcode, -u8 *msg,u16 msglen) -{ -bool err_msg_format = false; -int valid_len =0 ; - -/* Validate message length. */ -switch (v_opcode) { -case VIRTCHNL_OP_VERSION : - valid_len =sizeof (struct virtchnl_version_info ); -break ; -case VIRTCHNL_OP_RESET_VF : -break ; -case VIRTCHNL_OP_GET_VF_RESOURCES : -if (VF_IS_V11 (ver)) - valid_len =sizeof (u32); -break ; -case VIRTCHNL_OP_CONFIG_TX_QUEUE : - valid_len =sizeof (struct virtchnl_txq_info ); -break ; -case VIRTCHNL_OP_CONFIG_RX_QUEUE : - valid_len =sizeof (struct virtchnl_rxq_info ); -break ; -case VIRTCHNL_OP_CONFIG_VSI_QUEUES : - valid_len =sizeof (struct virtchnl_vsi_queue_config_info ); -if (msglen >= valid_len) { -struct virtchnl_vsi_queue_config_info *vqc = - (struct virtchnl_vsi_queue_config_info *)msg; - valid_len += (vqc->num_queue_pairs * -sizeof (struct -virtchnl_queue_pair_info )); -if (vqc->num_queue_pairs ==0 ) - err_msg_format = true; - } -break ; -case VIRTCHNL_OP_CONFIG_IRQ_MAP : - valid_len =sizeof (struct virtchnl_irq_map_info ); -if (msglen >= valid_len) { -struct virtchnl_irq_map_info *vimi = - (struct virtchnl_irq_map_info *)msg; - valid_len += (vimi->num_vectors * -sizeof (struct virtchnl_vector_map )); -if (vimi->num_vectors ==0 ) - err_msg_format = true; - } -break ; -case VIRTCHNL_OP_ENABLE_QUEUES : -case VIRTCHNL_OP_DISABLE_QUEUES : - valid_len =sizeof (struct virtchnl_queue_select ); -break ; -case VIRTCHNL_OP_ADD_ETH_ADDR : -case VIRTCHNL_OP_DEL_ETH_ADDR : - valid_len =sizeof (struct virtchnl_ether_addr_list ); -if (msglen >= valid_len) { -struct virtchnl_ether_addr_list *veal = - (struct virtchnl_ether_addr_list *)msg; - valid_len += veal->num_elements * -sizeof (struct virtchnl_ether_addr ); -if (veal->num_elements ==0 ) - err_msg_format = true; - } -break ; -case VIRTCHNL_OP_ADD_VLAN : -case VIRTCHNL_OP_DEL_VLAN : - valid_len =sizeof (struct virtchnl_vlan_filter_list ); -if (msglen >= valid_len) { -struct virtchnl_vlan_filter_list *vfl = - (struct virtchnl_vlan_filter_list *)msg; - valid_len += vfl->num_elements *sizeof (u16); -if (vfl->num_elements ==0 ) - err_msg_format = true; - } -break ; -case VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE : - valid_len =sizeof (struct virtchnl_promisc_info ); -break ; -case VIRTCHNL_OP_GET_STATS : - valid_len =sizeof (struct virtchnl_queue_select ); -break ; -case VIRTCHNL_OP_IWARP : -/* These messages are opaque to us and will be validated in -* the RDMA client code. We just need to check for nonzero -* length. The firmware will enforce max length restrictions. -*/ -if (msglen) - valid_len = msglen; -else - err_msg_format = true; -break ; -case VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP : -break ; -case VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP : - valid_len =sizeof (struct virtchnl_iwarp_qvlist_info ); -if (msglen >= valid_len) { -struct virtchnl_iwarp_qvlist_info *qv = - (struct virtchnl_iwarp_qvlist_info *)msg; -if (qv->num_vectors ==0 ) { - err_msg_format = true; -break ; - } - valid_len += ((qv->num_vectors -1 ) * -sizeof (struct virtchnl_iwarp_qv_info )); - } -break ; -case VIRTCHNL_OP_CONFIG_RSS_KEY : - valid_len =sizeof (struct virtchnl_rss_key ); -if (msglen >= valid_len) { -struct virtchnl_rss_key *vrk = - (struct virtchnl_rss_key *)msg; - valid_len += vrk->key_len -1 ; - } -break ; -case VIRTCHNL_OP_CONFIG_RSS_LUT : - valid_len =sizeof (struct virtchnl_rss_lut ); -if (msglen >= valid_len) { -struct virtchnl_rss_lut *vrl = - (struct virtchnl_rss_lut *)msg; - valid_len += vrl->lut_entries -1 ; - } -break ; -case VIRTCHNL_OP_GET_RSS_HENA_CAPS : -break ; -case VIRTCHNL_OP_SET_RSS_HENA : - valid_len =sizeof (struct virtchnl_rss_hena ); -break ; -/* These are always errors coming from the VF. */ -case VIRTCHNL_OP_EVENT : -case VIRTCHNL_OP_UNKNOWN : -default : -return VIRTCHNL_ERR_PARAM ; - } -/* few more checks */ -if ((valid_len != msglen) || (err_msg_format)) -return VIRTCHNL_STATUS_ERR_OPCODE_MISMATCH ; - -return 0 ; -} - -/** * i40e_vc_process_vf_msg * @pf: pointer to the PF structure * @vf_id: source VF id
@@ -2708,7 +2560,7 @@ int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode,return I40E_ERR_PARAM ;/* perform basic checks on the msg */ - ret =i40e_vc_validate_vf_msg (&vf->vf_ver, v_opcode, msg, msglen); + ret =virtchnl_vc_validate_vf_msg (&vf->vf_ver, v_opcode, msg, msglen);/* perform additional checks specific to this driver */ if (v_opcode ==VIRTCHNL_OP_CONFIG_RSS_KEY ) {
include/linux/avf/virtchnl.h +147 -0
151 lines not on this page · raw message
Signature · 1 line
2.9.3
Bowers
PATCH v3 10/14 i40e/virtchnl: move function to virtchnl
Quoted 15 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Jesse Brandeburg
Sent: Thursday, May 11, 2017 11:23 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next v3 10/14] i40e/virtchnl: move function to virtchnlThis moves a function that is needed for the virtchnl interface from the i40e PF driver over to the
virtchnl.hfile.It was manually verified that the function in question is unchanged except for the function name and function header, which explains the slight difference in the number of lines removed/added.
Quoted 5 lines
Signed-off-by Jesse Brandeburg <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 150 +-------------------- include/linux/avf/virtchnl.h | 147 ++++++++++++++++++++ 2 files changed, 148 insertions(+), 149 deletions(-)
PATCH v3 11/14 virtchnl: Add pad fields to a couple of structures
In reply to Jesse BrandeburgFrom: Sridhar Samudrala <[email protected]>
This removes holes and makes structure sizes consistent across 32 and 64 bit builds.
--- include/linux/avf/virtchnl.h | 3 +++ 1 file changed, 3 insertions(+)
include/linux/avf/virtchnl.h +3 -0
@@ -275,8 +275,10 @@ struct virtchnl_rxq_info {u16 splithdr_enabled;/* deprecated with AVF 1.0 */ u32 databuffer_size;u32 max_pkt_size; +u32 pad1;u64 dma_ring_addr;enum virtchnl_rx_hsplit rx_split_pos;/* deprecated with AVF 1.0 */ +u32 pad2; };/* VIRTCHNL_OP_CONFIG_VSI_QUEUES
@@ -295,6 +297,7 @@ struct virtchnl_queue_pair_info {struct virtchnl_vsi_queue_config_info {u16 vsi_id;u16 num_queue_pairs; +u32 pad;struct virtchnl_queue_pair_info qpair[1 ]; };
Signature · 1 line
2.9.3
Bowers
PATCH v3 11/14 virtchnl: Add pad fields to a couple of structures
Quoted 10 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Jesse Brandeburg
Sent: Thursday, May 11, 2017 11:23 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next v3 11/14] virtchnl: Add pad fields to a couple of structuresFrom: Sridhar Samudrala <[email protected]>
Quoted 8 lines
This removes holes and makes structure sizes consistent across 32 and 64 bit builds.
Signed-off-by Sridhar Samudrala <[email protected]>Signed-off-by Jesse Brandeburg <[email protected]>--- include/linux/avf/virtchnl.h | 3 +++ 1 file changed, 3 insertions(+)
PATCH v3 12/14 virtchnl: Add compile time static asserts to validate structure sizes
In reply to Jesse BrandeburgFrom: Sridhar Samudrala <[email protected]>
This uses preprocessor tricks to make sure that a divide by zero occurs if a struct changes size outside the expected number of bytes.
--- include/linux/avf/virtchnl.h | 50 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
include/linux/avf/virtchnl.h +50 -0
@@ -135,6 +135,14 @@ enum virtchnl_ops { VIRTCHNL_OP_SET_RSS_HENA = 26, }; +/* This macro is used to generate a compilation error if a structure +* is not exactly the correct length. It gives a divide by zero error if the +* structure is not of the correct size, otherwise it creates an enum that is +* never used. +*/ +#define VIRTCHNL_CHECK_STRUCT_LEN (n,X ) enum virtchnl_static_assert_enum_##X \ + { virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) } +/* Virtual channel message descriptor. This overlays the admin queue * descriptor. All other data is passed in external buffers. */
@@ -146,6 +154,8 @@ struct virtchnl_msg {u32 vfid;/* used by PF when sending to VF */ }; +VIRTCHNL_CHECK_STRUCT_LEN (20 , virtchnl_msg); +/* Message descriptions and data structures.*/ /* VIRTCHNL_OP_VERSION
@@ -169,6 +179,8 @@ struct virtchnl_version_info {u32 minor; }; +VIRTCHNL_CHECK_STRUCT_LEN (8 , virtchnl_version_info); +#define VF_IS_V10 (_v) (((_v)->major == 1) && ((_v)->minor == 0))#define VF_IS_V11 (_ver) (((_ver)->major == 1) && ((_ver)->minor == 1))
@@ -209,6 +221,8 @@ struct virtchnl_vsi_resource {u8 default_mac_addr[ETH_ALEN ]; }; +VIRTCHNL_CHECK_STRUCT_LEN (16 , virtchnl_vsi_resource); +/* VF offload flags * VIRTCHNL_VF_OFFLOAD_L2 flag is inclusive of base mode L2 offloads including * TX/RX Checksum offloading and TSO for non-tunnelled packets.
@@ -244,6 +258,8 @@ struct virtchnl_vf_resource {struct virtchnl_vsi_resource vsi_res[1 ]; }; +VIRTCHNL_CHECK_STRUCT_LEN (36 , virtchnl_vf_resource); +/* VIRTCHNL_OP_CONFIG_TX_QUEUE * VF sends this message to set up parameters for one TX queue. * External data buffer contains one instance of virtchnl_txq_info.
@@ -260,6 +276,8 @@ struct virtchnl_txq_info {u64 dma_headwb_addr;/* deprecated with AVF 1.0 */ }; +VIRTCHNL_CHECK_STRUCT_LEN (24 , virtchnl_txq_info); +/* VIRTCHNL_OP_CONFIG_RX_QUEUE * VF sends this message to set up parameters for one RX queue. * External data buffer contains one instance of virtchnl_rxq_info.
@@ -281,6 +299,8 @@ struct virtchnl_rxq_info {u32 pad2; }; +VIRTCHNL_CHECK_STRUCT_LEN (40 , virtchnl_rxq_info); +/* VIRTCHNL_OP_CONFIG_VSI_QUEUES * VF sends this message to set parameters for all active TX and RX queues * associated with the specified VSI.
@@ -294,6 +314,8 @@ struct virtchnl_queue_pair_info {struct virtchnl_rxq_info rxq; }; +VIRTCHNL_CHECK_STRUCT_LEN (64 , virtchnl_queue_pair_info); +struct virtchnl_vsi_queue_config_info {u16 vsi_id;u16 num_queue_pairs;
@@ -301,6 +323,8 @@ struct virtchnl_vsi_queue_config_info {struct virtchnl_queue_pair_info qpair[1 ]; }; +VIRTCHNL_CHECK_STRUCT_LEN (72 , virtchnl_vsi_queue_config_info); +/* VIRTCHNL_OP_CONFIG_IRQ_MAP * VF uses this message to map vectors to queues. * The rxq_map and txq_map fields are bitmaps used to indicate which queues
@@ -317,11 +341,15 @@ struct virtchnl_vector_map {u16 txitr_idx; }; +VIRTCHNL_CHECK_STRUCT_LEN (12 , virtchnl_vector_map); +struct virtchnl_irq_map_info {u16 num_vectors;struct virtchnl_vector_map vecmap[1 ]; }; +VIRTCHNL_CHECK_STRUCT_LEN (14 , virtchnl_irq_map_info); +/* VIRTCHNL_OP_ENABLE_QUEUES * VIRTCHNL_OP_DISABLE_QUEUES * VF sends these message to enable or disable TX/RX queue pairs.
@@ -337,6 +365,8 @@ struct virtchnl_queue_select {u32 tx_queues; }; +VIRTCHNL_CHECK_STRUCT_LEN (12 , virtchnl_queue_select); +/* VIRTCHNL_OP_ADD_ETH_ADDR * VF sends this message in order to add one or more unicast or multicast * address filters for the specified VSI.
@@ -354,12 +384,16 @@ struct virtchnl_ether_addr {u8 pad[2 ]; }; +VIRTCHNL_CHECK_STRUCT_LEN (8 , virtchnl_ether_addr); +struct virtchnl_ether_addr_list {u16 vsi_id;u16 num_elements;struct virtchnl_ether_addr list[1 ]; }; +VIRTCHNL_CHECK_STRUCT_LEN (12 , virtchnl_ether_addr_list); +/* VIRTCHNL_OP_ADD_VLAN * VF sends this message to add one or more VLAN tag filters for receives. * PF adds the filters and returns status.
@@ -380,6 +414,8 @@ struct virtchnl_vlan_filter_list {u16 vlan_id[1 ]; }; +VIRTCHNL_CHECK_STRUCT_LEN (6 , virtchnl_vlan_filter_list); +/* VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE * VF sends VSI id and flags. * PF returns status code in retval.
@@ -390,6 +426,8 @@ struct virtchnl_promisc_info {u16 flags; }; +VIRTCHNL_CHECK_STRUCT_LEN (4 , virtchnl_promisc_info); +#define FLAG_VF_UNICAST_PROMISC 0x00000001#define FLAG_VF_MULTICAST_PROMISC 0x00000002
@@ -416,12 +454,16 @@ struct virtchnl_rss_key {u8 key[1 ];/* RSS hash key, packed bytes */ }; +VIRTCHNL_CHECK_STRUCT_LEN (6 , virtchnl_rss_key); +struct virtchnl_rss_lut {u16 vsi_id;u16 lut_entries;u8 lut[1 ];/* RSS lookup table*/ }; +VIRTCHNL_CHECK_STRUCT_LEN (6 , virtchnl_rss_lut); +/* VIRTCHNL_OP_GET_RSS_HENA_CAPS * VIRTCHNL_OP_SET_RSS_HENA * VF sends these messages to get and set the hash filter enable bits for RSS.
@@ -433,6 +475,8 @@ struct virtchnl_rss_hena {u64 hena; }; +VIRTCHNL_CHECK_STRUCT_LEN (8 , virtchnl_rss_hena); +/* VIRTCHNL_OP_EVENT * PF sends this message to inform the VF driver of events that may affect it. * No direct response is expected from the VF, though it may generate other
@@ -460,6 +504,8 @@ struct virtchnl_pf_event {int severity; }; +VIRTCHNL_CHECK_STRUCT_LEN (16 , virtchnl_pf_event); +/* VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP * VF uses this message to request PF to map IWARP vectors to IWARP queues. * The request for this originates from the VF IWARP driver through
@@ -479,11 +525,15 @@ struct virtchnl_iwarp_qv_info {u8 itr_idx; }; +VIRTCHNL_CHECK_STRUCT_LEN (12 , virtchnl_iwarp_qv_info); +struct virtchnl_iwarp_qvlist_info {u32 num_vectors;struct virtchnl_iwarp_qv_info qv_info[1 ]; }; +VIRTCHNL_CHECK_STRUCT_LEN (16 , virtchnl_iwarp_qvlist_info); +/* VF reset states - these are written into the RSTAT register: * VFGEN_RSTAT on the VF * When the PF initiates a reset, it writes 0
Signature · 1 line
2.9.3
Bowers
PATCH v3 12/14 virtchnl: Add compile time static asserts to validate structure sizes
Quoted 13 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Jesse Brandeburg
Sent: Thursday, May 11, 2017 11:23 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next v3 12/14] virtchnl: Add compile time static asserts to validate structure sizesFrom: Sridhar Samudrala <[email protected]>
This uses preprocessor tricks to make sure that a divide by zero occurs if a struct changes size outside the expected number of bytes.
Quoted 6 lines
Signed-off-by Sridhar Samudrala <[email protected]>Signed-off-by Jesse Brandeburg <[email protected]>--- include/linux/avf/virtchnl.h | 50 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
PATCH v3 13/14 i40evf: Add support for Adaptive Virtual Function
In reply to Jesse BrandeburgFrom: Preethi Banala <[email protected]>
Add device ID define and mac_type assignment needed for Adaptive Virtual Function (VF Base Mode Support).
Also, update version to v3.0.0 in order to indicate clearly that this is the first driver supporting the AVF device ID.
---
v2: added Kconfig
--- drivers/net/ethernet/intel/Kconfig | 10 ++++++---- drivers/net/ethernet/intel/i40evf/i40e_common.c | 1 + drivers/net/ethernet/intel/i40evf/i40e_devids.h | 1 + drivers/net/ethernet/intel/i40evf/i40evf_main.c | 7 ++++--- 4 files changed, 12 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/Kconfig +6 -4
@@ -236,12 +236,14 @@ config I40E_DCB If unsure, say N. config I40EVF - tristate "Intel(R) XL710 X710 Virtual Function Ethernet support" + tristate "Intel(R) Ethernet Adaptive Virtual Function support" depends on PCI_MSI ---help--- - This driver supports Intel(R) XL710 and X710 virtual functions. - For more information on how to identify your adapter, go to the - Adapter & Driver ID Guide that can be located at: + This driver supports virtual functions for Intel XL710, + X710, X722, and all devices advertising support for Intel + Ethernet Adaptive Virtual Function devices. For more + information on how to identify your adapter, go to the Adapter + & Driver ID Guide that can be located at: <http://support.intel.com>
drivers/net/ethernet/intel/i40evf/i40e_common.c +1 -0
@@ -68,6 +68,7 @@ i40e_status i40e_set_mac_type(struct i40e_hw *hw)break ;case I40E_DEV_ID_VF :case I40E_DEV_ID_VF_HV : +case I40E_DEV_ID_ADAPTIVE_VF : hw->mac.type =I40E_MAC_VF ;break ;default :
drivers/net/ethernet/intel/i40evf/i40e_devids.h +1 -0
@@ -43,6 +43,7 @@#define I40E_DEV_ID_25G_SFP28 0x158B#define I40E_DEV_ID_VF 0x154C#define I40E_DEV_ID_VF_HV 0x1571 +#define I40E_DEV_ID_ADAPTIVE_VF 0x1889#define I40E_DEV_ID_SFP_X722 0x37D0#define I40E_DEV_ID_1G_BASE_T_X722 0x37D1#define I40E_DEV_ID_10G_BASE_T_X722 0x37D2
drivers/net/ethernet/intel/i40evf/i40evf_main.c +4 -3
@@ -44,9 +44,9 @@ static const char i40evf_driver_string[] =#define DRV_KERN "-k" -#define DRV_VERSION_MAJOR 2 -#define DRV_VERSION_MINOR 1 -#define DRV_VERSION_BUILD 14 +#define DRV_VERSION_MAJOR 3 +#define DRV_VERSION_MINOR 0 +#define DRV_VERSION_BUILD 0#define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \ __stringify(DRV_VERSION_MINOR) "." \ __stringify(DRV_VERSION_BUILD) \
@@ -67,6 +67,7 @@ static const struct pci_device_id i40evf_pci_tbl[] = { {PCI_VDEVICE(INTEL, I40E_DEV_ID_VF), 0}, {PCI_VDEVICE(INTEL, I40E_DEV_ID_VF_HV), 0}, {PCI_VDEVICE(INTEL, I40E_DEV_ID_X722_VF), 0}, + {PCI_VDEVICE(INTEL, I40E_DEV_ID_ADAPTIVE_VF), 0},/* required last entry */ {0, } };
Signature · 1 line
2.9.3
Bowers
PATCH v3 13/14 i40evf: Add support for Adaptive Virtual Function
Quoted 19 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Jesse Brandeburg
Sent: Thursday, May 11, 2017 11:23 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next v3 13/14] i40evf: Add support for Adaptive Virtual FunctionFrom: Preethi Banala <[email protected]>
Add device ID define and
mac_typeassignment needed for Adaptive Virtual Function (VF Base Mode Support).Also, update version to v3.0.0 in order to indicate clearly that this is the first driver supporting the AVF device ID.
Signed-off-by Preethi Banala <[email protected]>Signed-off-by Jesse Brandeburg <[email protected]>
Quoted 8 lines
---
v2: addedKconfig--- drivers/net/ethernet/intel/Kconfig | 10 ++++++---- drivers/net/ethernet/intel/i40evf/i40e_common.c | 1 + drivers/net/ethernet/intel/i40evf/i40e_devids.h | 1 + drivers/net/ethernet/intel/i40evf/i40evf_main.c | 7 ++++--- 4 files changed, 12 insertions(+), 7 deletions(-)
PATCH v3 14/14 i40evf: update i40evf.txt with new content
In reply to Jesse BrandeburgThe addition of the AVF and virtchnl code to the i40evf driver means we should update the i40evf.txt file with the most up to date information.
It seems this file hasn't been updated in a while, so the changes cover a little more than just AVF, but it's all only in the i40evf.txt.
--- Documentation/networking/i40evf.txt | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)
Documentation/networking/i40evf.txt +15 -8
@@ -1,8 +1,8 @@ Linux* Base Driver for Intel(R) Network Connection ================================================== -Intel XL710 X710 Virtual Function Linux driver. -Copyright(c) 2013 Intel Corporation. +Intel Ethernet Adaptive Virtual Function Linux driver. +Copyright(c) 2013-2017 Intel Corporation. Contents ========
@@ -11,19 +11,26 @@ Contents - Known Issues/Troubleshooting - Support -This file describes the i40evf Linux* Base Driver for the Intel(R) XL710 -X710 Virtual Function. +This file describes the i40evf Linux* Base Driver. -The i40evf driver supports XL710 and X710 virtual function devices that -can only be activated on kernels with CONFIG_PCI_IOV enabled. +The i40evf driver supports the below mentioned virtual function +devices and can only be activated on kernels running the i40e or +newer Physical Function (PF) driver compiled with CONFIG_PCI_IOV. +The i40evf driver requires CONFIG_PCI_MSI to be enabled. The guest OS loading the i40evf driver must support MSI-X interrupts. +Supported Hardware +================== +Intel XL710 X710 Virtual Function +Intel Ethernet Adaptive Virtual Function +Intel X722 Virtual Function + Identifying Your Adapter ======================== -For more information on how to identify your adapter, go to the Adapter & -Driver ID Guide at: +For more information on how to identify your adapter, go to the +Adapter & Driver ID Guide at: http://support.intel.com/support/go/network/adapter/idguide.htm
Signature · 1 line
2.9.3
Bowers
PATCH v3 14/14 i40evf: update i40evf.txt with new content
Quoted 11 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Jesse Brandeburg
Sent: Thursday, May 11, 2017 11:23 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next v3 14/14] i40evf: update i40evf.txt with new contentThe addition of the AVF and virtchnl code to the i40evf driver means we should update the i40evf.txt file with the most up to date information.
Quoted 7 lines
It seems this file hasn't been updated in a while, so the changes cover a little more than just AVF, but it's all only in the i40evf.txt.
Signed-off-by Jesse Brandeburg <[email protected]>--- Documentation/networking/i40evf.txt | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)
v3 cover i40e/i40evf: AVF series
In reply to Jesse BrandeburgQuoted 3 lines · On Thu, 11 May 2017 11:23:07 -0700 Jesse Brandeburg…
v3: updated patch 4 to remove some unnecessary transforms to client
interface files, also had to update patch 9 to remove unusedI40E_QUEUE_defines
Sorry for having to send a v3, we found a couple more issues with changes that were not necessary related to client interface.