Commit ff3f4cc2 authored by Jesse Brandeburg's avatar Jesse Brandeburg Committed by Jeff Kirsher

virtchnl: finish conversion to virtchnl interface

This 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.
Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent f0adc6e8
...@@ -77,7 +77,7 @@ static void i40e_vc_notify_vf_link_state(struct i40e_vf *vf) ...@@ -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; int abs_vf_id = vf->vf_id + (int)hw->func_caps.vf_base_id;
pfe.event = VIRTCHNL_EVENT_LINK_CHANGE; pfe.event = VIRTCHNL_EVENT_LINK_CHANGE;
pfe.severity = I40E_PF_EVENT_SEVERITY_INFO; pfe.severity = PF_EVENT_SEVERITY_INFO;
if (vf->link_forced) { if (vf->link_forced) {
pfe.event_data.link_event.link_status = vf->link_up; pfe.event_data.link_event.link_status = vf->link_up;
pfe.event_data.link_event.link_speed = pfe.event_data.link_event.link_speed =
...@@ -85,7 +85,8 @@ static void i40e_vc_notify_vf_link_state(struct i40e_vf *vf) ...@@ -85,7 +85,8 @@ static void i40e_vc_notify_vf_link_state(struct i40e_vf *vf)
} else { } else {
pfe.event_data.link_event.link_status = pfe.event_data.link_event.link_status =
ls->link_info & I40E_AQ_LINK_UP; 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, i40e_aq_send_msg_to_vf(hw, abs_vf_id, VIRTCHNL_OP_EVENT,
0, (u8 *)&pfe, sizeof(pfe), NULL); 0, (u8 *)&pfe, sizeof(pfe), NULL);
...@@ -116,7 +117,7 @@ void i40e_vc_notify_reset(struct i40e_pf *pf) ...@@ -116,7 +117,7 @@ void i40e_vc_notify_reset(struct i40e_pf *pf)
struct virtchnl_pf_event pfe; struct virtchnl_pf_event pfe;
pfe.event = VIRTCHNL_EVENT_RESET_IMPENDING; 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, i40e_vc_vf_broadcast(pf, VIRTCHNL_OP_EVENT, 0,
(u8 *)&pfe, sizeof(struct virtchnl_pf_event)); (u8 *)&pfe, sizeof(struct virtchnl_pf_event));
} }
...@@ -144,7 +145,7 @@ void i40e_vc_notify_vf_reset(struct i40e_vf *vf) ...@@ -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; abs_vf_id = vf->vf_id + (int)vf->pf->hw.func_caps.vf_base_id;
pfe.event = VIRTCHNL_EVENT_RESET_IMPENDING; 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, i40e_aq_send_msg_to_vf(&vf->pf->hw, abs_vf_id, VIRTCHNL_OP_EVENT,
0, (u8 *)&pfe, 0, (u8 *)&pfe,
sizeof(struct virtchnl_pf_event), NULL); sizeof(struct virtchnl_pf_event), NULL);
...@@ -1586,7 +1587,7 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg) ...@@ -1586,7 +1587,7 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
if (vf->lan_vsi_idx) { if (vf->lan_vsi_idx) {
vfres->vsi_res[0].vsi_id = vf->lan_vsi_id; 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; vfres->vsi_res[0].num_queue_pairs = vsi->alloc_queue_pairs;
/* VFs only use TC 0 */ /* VFs only use TC 0 */
vfres->vsi_res[0].qset_handle vfres->vsi_res[0].qset_handle
...@@ -1680,7 +1681,7 @@ static int i40e_vc_config_promiscuous_mode_msg(struct i40e_vf *vf, ...@@ -1680,7 +1681,7 @@ static int i40e_vc_config_promiscuous_mode_msg(struct i40e_vf *vf,
goto error_param; goto error_param;
} }
/* Multicast promiscuous handling*/ /* Multicast promiscuous handling*/
if (info->flags & I40E_FLAG_VF_MULTICAST_PROMISC) if (info->flags & FLAG_VF_MULTICAST_PROMISC)
allmulti = true; allmulti = true;
if (vf->port_vlan_id) { if (vf->port_vlan_id) {
...@@ -1731,7 +1732,7 @@ static int i40e_vc_config_promiscuous_mode_msg(struct i40e_vf *vf, ...@@ -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); 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; alluni = true;
if (vf->port_vlan_id) { if (vf->port_vlan_id) {
aq_ret = i40e_aq_set_vsi_uc_promisc_on_vlan(hw, vsi->seid, 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) ...@@ -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; abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
pfe.event = VIRTCHNL_EVENT_LINK_CHANGE; pfe.event = VIRTCHNL_EVENT_LINK_CHANGE;
pfe.severity = I40E_PF_EVENT_SEVERITY_INFO; pfe.severity = PF_EVENT_SEVERITY_INFO;
switch (link) { switch (link) {
case IFLA_VF_LINK_STATE_AUTO: 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) ...@@ -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 = pfe.event_data.link_event.link_status =
pf->hw.phy.link_info.link_info & I40E_AQ_LINK_UP; pf->hw.phy.link_info.link_info & I40E_AQ_LINK_UP;
pfe.event_data.link_event.link_speed = pfe.event_data.link_event.link_speed =
(enum virtchnl_link_speed)
pf->hw.phy.link_info.link_speed; pf->hw.phy.link_info.link_speed;
break; break;
case IFLA_VF_LINK_STATE_ENABLE: case IFLA_VF_LINK_STATE_ENABLE:
......
...@@ -1107,7 +1107,7 @@ void i40e_vf_parse_hw_config(struct i40e_hw *hw, ...@@ -1107,7 +1107,7 @@ void i40e_vf_parse_hw_config(struct i40e_hw *hw,
VIRTCHNL_VF_OFFLOAD_L2; VIRTCHNL_VF_OFFLOAD_L2;
hw->dev_caps.fcoe = 0; hw->dev_caps.fcoe = 0;
for (i = 0; i < msg->num_vsis; i++) { 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, ether_addr_copy(hw->mac.perm_addr,
vsi_res->default_mac_addr); vsi_res->default_mac_addr);
ether_addr_copy(hw->mac.addr, ether_addr_copy(hw->mac.addr,
......
...@@ -263,7 +263,7 @@ struct i40evf_adapter { ...@@ -263,7 +263,7 @@ struct i40evf_adapter {
struct work_struct watchdog_task; struct work_struct watchdog_task;
bool netdev_registered; bool netdev_registered;
bool link_up; bool link_up;
enum i40e_aq_link_speed link_speed; enum virtchnl_link_speed link_speed;
enum virtchnl_ops current_op; enum virtchnl_ops current_op;
#define CLIENT_ALLOWED(_a) ((_a)->vf_res ? \ #define CLIENT_ALLOWED(_a) ((_a)->vf_res ? \
(_a)->vf_res->vf_offload_flags & \ (_a)->vf_res->vf_offload_flags & \
......
...@@ -1707,13 +1707,13 @@ static void i40evf_watchdog_task(struct work_struct *work) ...@@ -1707,13 +1707,13 @@ static void i40evf_watchdog_task(struct work_struct *work)
} }
if (adapter->aq_required & I40EVF_FLAG_AQ_REQUEST_PROMISC) { if (adapter->aq_required & I40EVF_FLAG_AQ_REQUEST_PROMISC) {
i40evf_set_promiscuous(adapter, I40E_FLAG_VF_UNICAST_PROMISC | i40evf_set_promiscuous(adapter, FLAG_VF_UNICAST_PROMISC |
I40E_FLAG_VF_MULTICAST_PROMISC); FLAG_VF_MULTICAST_PROMISC);
goto watchdog_done; goto watchdog_done;
} }
if (adapter->aq_required & I40EVF_FLAG_AQ_REQUEST_ALLMULTI) { 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; goto watchdog_done;
} }
...@@ -1969,7 +1969,8 @@ static void i40evf_adminq_task(struct work_struct *work) ...@@ -1969,7 +1969,8 @@ static void i40evf_adminq_task(struct work_struct *work)
break; /* No event to process or error cleaning ARQ */ break; /* No event to process or error cleaning ARQ */
i40evf_virtchnl_completion(adapter, v_msg->v_opcode, 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); event.msg_len);
if (pending != 0) if (pending != 0)
memset(event.msg_buf, 0, I40EVF_MAX_AQ_BUF_SIZE); memset(event.msg_buf, 0, I40EVF_MAX_AQ_BUF_SIZE);
...@@ -2410,7 +2411,7 @@ int i40evf_process_config(struct i40evf_adapter *adapter) ...@@ -2410,7 +2411,7 @@ int i40evf_process_config(struct i40evf_adapter *adapter)
/* got VF config message back from PF, now we can parse it */ /* got VF config message back from PF, now we can parse it */
for (i = 0; i < vfres->num_vsis; i++) { 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]; adapter->vsi_res = &vfres->vsi_res[i];
} }
if (!adapter->vsi_res) { if (!adapter->vsi_res) {
......
...@@ -662,15 +662,15 @@ void i40evf_set_promiscuous(struct i40evf_adapter *adapter, int flags) ...@@ -662,15 +662,15 @@ void i40evf_set_promiscuous(struct i40evf_adapter *adapter, int flags)
return; return;
} }
promisc_all = I40E_FLAG_VF_UNICAST_PROMISC | promisc_all = FLAG_VF_UNICAST_PROMISC |
I40E_FLAG_VF_MULTICAST_PROMISC; FLAG_VF_MULTICAST_PROMISC;
if ((flags & promisc_all) == promisc_all) { if ((flags & promisc_all) == promisc_all) {
adapter->flags |= I40EVF_FLAG_PROMISC_ON; adapter->flags |= I40EVF_FLAG_PROMISC_ON;
adapter->aq_required &= ~I40EVF_FLAG_AQ_REQUEST_PROMISC; adapter->aq_required &= ~I40EVF_FLAG_AQ_REQUEST_PROMISC;
dev_info(&adapter->pdev->dev, "Entering promiscuous mode\n"); 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->flags |= I40EVF_FLAG_ALLMULTI_ON;
adapter->aq_required &= ~I40EVF_FLAG_AQ_REQUEST_ALLMULTI; adapter->aq_required &= ~I40EVF_FLAG_AQ_REQUEST_ALLMULTI;
dev_info(&adapter->pdev->dev, "Entering multicast promiscuous mode\n"); dev_info(&adapter->pdev->dev, "Entering multicast promiscuous mode\n");
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment