aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c')
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c44
1 files changed, 32 insertions, 12 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 89672551dce9..3ac6a0d2f143 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -1003,11 +1003,19 @@ int i40e_pci_sriov_configure(struct pci_dev *pdev, int num_vfs)
1003static int i40e_vc_send_msg_to_vf(struct i40e_vf *vf, u32 v_opcode, 1003static int i40e_vc_send_msg_to_vf(struct i40e_vf *vf, u32 v_opcode,
1004 u32 v_retval, u8 *msg, u16 msglen) 1004 u32 v_retval, u8 *msg, u16 msglen)
1005{ 1005{
1006 struct i40e_pf *pf = vf->pf; 1006 struct i40e_pf *pf;
1007 struct i40e_hw *hw = &pf->hw; 1007 struct i40e_hw *hw;
1008 int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; 1008 int abs_vf_id;
1009 i40e_status aq_ret; 1009 i40e_status aq_ret;
1010 1010
1011 /* validate the request */
1012 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs)
1013 return -EINVAL;
1014
1015 pf = vf->pf;
1016 hw = &pf->hw;
1017 abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
1018
1011 /* single place to detect unsuccessful return values */ 1019 /* single place to detect unsuccessful return values */
1012 if (v_retval) { 1020 if (v_retval) {
1013 vf->num_invalid_msgs++; 1021 vf->num_invalid_msgs++;
@@ -1928,17 +1936,20 @@ static void i40e_vc_vf_broadcast(struct i40e_pf *pf,
1928{ 1936{
1929 struct i40e_hw *hw = &pf->hw; 1937 struct i40e_hw *hw = &pf->hw;
1930 struct i40e_vf *vf = pf->vf; 1938 struct i40e_vf *vf = pf->vf;
1931 int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
1932 int i; 1939 int i;
1933 1940
1934 for (i = 0; i < pf->num_alloc_vfs; i++) { 1941 for (i = 0; i < pf->num_alloc_vfs; i++, vf++) {
1942 int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
1943 /* Not all vfs are enabled so skip the ones that are not */
1944 if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states) &&
1945 !test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states))
1946 continue;
1947
1935 /* Ignore return value on purpose - a given VF may fail, but 1948 /* Ignore return value on purpose - a given VF may fail, but
1936 * we need to keep going and send to all of them 1949 * we need to keep going and send to all of them
1937 */ 1950 */
1938 i40e_aq_send_msg_to_vf(hw, abs_vf_id, v_opcode, v_retval, 1951 i40e_aq_send_msg_to_vf(hw, abs_vf_id, v_opcode, v_retval,
1939 msg, msglen, NULL); 1952 msg, msglen, NULL);
1940 vf++;
1941 abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
1942 } 1953 }
1943} 1954}
1944 1955
@@ -1954,12 +1965,12 @@ void i40e_vc_notify_link_state(struct i40e_pf *pf)
1954 struct i40e_hw *hw = &pf->hw; 1965 struct i40e_hw *hw = &pf->hw;
1955 struct i40e_vf *vf = pf->vf; 1966 struct i40e_vf *vf = pf->vf;
1956 struct i40e_link_status *ls = &pf->hw.phy.link_info; 1967 struct i40e_link_status *ls = &pf->hw.phy.link_info;
1957 int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
1958 int i; 1968 int i;
1959 1969
1960 pfe.event = I40E_VIRTCHNL_EVENT_LINK_CHANGE; 1970 pfe.event = I40E_VIRTCHNL_EVENT_LINK_CHANGE;
1961 pfe.severity = I40E_PF_EVENT_SEVERITY_INFO; 1971 pfe.severity = I40E_PF_EVENT_SEVERITY_INFO;
1962 for (i = 0; i < pf->num_alloc_vfs; i++) { 1972 for (i = 0; i < pf->num_alloc_vfs; i++, vf++) {
1973 int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
1963 if (vf->link_forced) { 1974 if (vf->link_forced) {
1964 pfe.event_data.link_event.link_status = vf->link_up; 1975 pfe.event_data.link_event.link_status = vf->link_up;
1965 pfe.event_data.link_event.link_speed = 1976 pfe.event_data.link_event.link_speed =
@@ -1972,8 +1983,6 @@ void i40e_vc_notify_link_state(struct i40e_pf *pf)
1972 i40e_aq_send_msg_to_vf(hw, abs_vf_id, I40E_VIRTCHNL_OP_EVENT, 1983 i40e_aq_send_msg_to_vf(hw, abs_vf_id, I40E_VIRTCHNL_OP_EVENT,
1973 0, (u8 *)&pfe, sizeof(pfe), 1984 0, (u8 *)&pfe, sizeof(pfe),
1974 NULL); 1985 NULL);
1975 vf++;
1976 abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
1977 } 1986 }
1978} 1987}
1979 1988
@@ -2002,7 +2011,18 @@ void i40e_vc_notify_reset(struct i40e_pf *pf)
2002void i40e_vc_notify_vf_reset(struct i40e_vf *vf) 2011void i40e_vc_notify_vf_reset(struct i40e_vf *vf)
2003{ 2012{
2004 struct i40e_virtchnl_pf_event pfe; 2013 struct i40e_virtchnl_pf_event pfe;
2005 int abs_vf_id = vf->vf_id + vf->pf->hw.func_caps.vf_base_id; 2014 int abs_vf_id;
2015
2016 /* validate the request */
2017 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs)
2018 return;
2019
2020 /* verify if the VF is in either init or active before proceeding */
2021 if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states) &&
2022 !test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states))
2023 return;
2024
2025 abs_vf_id = vf->vf_id + vf->pf->hw.func_caps.vf_base_id;
2006 2026
2007 pfe.event = I40E_VIRTCHNL_EVENT_RESET_IMPENDING; 2027 pfe.event = I40E_VIRTCHNL_EVENT_RESET_IMPENDING;
2008 pfe.severity = I40E_PF_EVENT_SEVERITY_CERTAIN_DOOM; 2028 pfe.severity = I40E_PF_EVENT_SEVERITY_CERTAIN_DOOM;