diff options
| author | Mitch Williams <mitch.a.williams@intel.com> | 2015-04-07 19:45:33 -0400 |
|---|---|---|
| committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2015-04-14 20:34:59 -0400 |
| commit | 055b295d99adb246b2b9284e1d1e602630c119e3 (patch) | |
| tree | dea06010ea0a22e8aeeebec33df1682ad0d25d06 /drivers/net/ethernet/intel | |
| parent | ed636960c3b5a44e59eccafef94837d14e3bc10f (diff) | |
i40e: notify VFs of link state
Gratuitously notify VFs of link state when they activate their queues.
In general, this is the last thing that a VF driver will do as it opens
its interface, so this is a good time to notify the VF.
Currently, VF devices assume link is up unless told otherwise, which
means that VFs instantiated on a PF with no link will report the wrong
state. This change corrects that issue.
Change-ID: Iea53622904ecc681ac3f8938d81c30033ef9a0a6
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Tested-by: Jim Young <james.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel')
| -rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c index 9b3fc83119fa..8df2b529289b 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | ******************************************************************************/ | 25 | ******************************************************************************/ |
| 26 | 26 | ||
| 27 | #include "i40e.h" | 27 | #include "i40e.h" |
| 28 | static void i40e_vc_notify_vf_link_state(struct i40e_vf *vf); | ||
| 28 | 29 | ||
| 29 | /***********************misc routines*****************************/ | 30 | /***********************misc routines*****************************/ |
| 30 | 31 | ||
| @@ -1767,6 +1768,7 @@ int i40e_vc_process_vf_msg(struct i40e_pf *pf, u16 vf_id, u32 v_opcode, | |||
| 1767 | break; | 1768 | break; |
| 1768 | case I40E_VIRTCHNL_OP_ENABLE_QUEUES: | 1769 | case I40E_VIRTCHNL_OP_ENABLE_QUEUES: |
| 1769 | ret = i40e_vc_enable_queues_msg(vf, msg, msglen); | 1770 | ret = i40e_vc_enable_queues_msg(vf, msg, msglen); |
| 1771 | i40e_vc_notify_vf_link_state(vf); | ||
| 1770 | break; | 1772 | break; |
| 1771 | case I40E_VIRTCHNL_OP_DISABLE_QUEUES: | 1773 | case I40E_VIRTCHNL_OP_DISABLE_QUEUES: |
| 1772 | ret = i40e_vc_disable_queues_msg(vf, msg, msglen); | 1774 | ret = i40e_vc_disable_queues_msg(vf, msg, msglen); |
| @@ -1875,35 +1877,45 @@ static void i40e_vc_vf_broadcast(struct i40e_pf *pf, | |||
| 1875 | 1877 | ||
| 1876 | /** | 1878 | /** |
| 1877 | * i40e_vc_notify_link_state | 1879 | * i40e_vc_notify_link_state |
| 1878 | * @pf: pointer to the PF structure | 1880 | * @vf: pointer to the VF structure |
| 1879 | * | 1881 | * |
| 1880 | * send a link status message to all VFs on a given PF | 1882 | * send a link status message to a single VF |
| 1881 | **/ | 1883 | **/ |
| 1882 | void i40e_vc_notify_link_state(struct i40e_pf *pf) | 1884 | static void i40e_vc_notify_vf_link_state(struct i40e_vf *vf) |
| 1883 | { | 1885 | { |
| 1884 | struct i40e_virtchnl_pf_event pfe; | 1886 | struct i40e_virtchnl_pf_event pfe; |
| 1887 | struct i40e_pf *pf = vf->pf; | ||
| 1885 | struct i40e_hw *hw = &pf->hw; | 1888 | struct i40e_hw *hw = &pf->hw; |
| 1886 | struct i40e_vf *vf = pf->vf; | ||
| 1887 | struct i40e_link_status *ls = &pf->hw.phy.link_info; | 1889 | struct i40e_link_status *ls = &pf->hw.phy.link_info; |
| 1888 | int i; | 1890 | int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; |
| 1889 | 1891 | ||
| 1890 | pfe.event = I40E_VIRTCHNL_EVENT_LINK_CHANGE; | 1892 | pfe.event = I40E_VIRTCHNL_EVENT_LINK_CHANGE; |
| 1891 | pfe.severity = I40E_PF_EVENT_SEVERITY_INFO; | 1893 | pfe.severity = I40E_PF_EVENT_SEVERITY_INFO; |
| 1892 | for (i = 0; i < pf->num_alloc_vfs; i++, vf++) { | 1894 | if (vf->link_forced) { |
| 1893 | int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; | 1895 | pfe.event_data.link_event.link_status = vf->link_up; |
| 1894 | if (vf->link_forced) { | 1896 | pfe.event_data.link_event.link_speed = |
| 1895 | pfe.event_data.link_event.link_status = vf->link_up; | 1897 | (vf->link_up ? I40E_LINK_SPEED_40GB : 0); |
| 1896 | pfe.event_data.link_event.link_speed = | 1898 | } else { |
| 1897 | (vf->link_up ? I40E_LINK_SPEED_40GB : 0); | 1899 | pfe.event_data.link_event.link_status = |
| 1898 | } else { | 1900 | ls->link_info & I40E_AQ_LINK_UP; |
| 1899 | pfe.event_data.link_event.link_status = | 1901 | pfe.event_data.link_event.link_speed = ls->link_speed; |
| 1900 | ls->link_info & I40E_AQ_LINK_UP; | ||
| 1901 | pfe.event_data.link_event.link_speed = ls->link_speed; | ||
| 1902 | } | ||
| 1903 | i40e_aq_send_msg_to_vf(hw, abs_vf_id, I40E_VIRTCHNL_OP_EVENT, | ||
| 1904 | 0, (u8 *)&pfe, sizeof(pfe), | ||
| 1905 | NULL); | ||
| 1906 | } | 1902 | } |
| 1903 | i40e_aq_send_msg_to_vf(hw, abs_vf_id, I40E_VIRTCHNL_OP_EVENT, | ||
| 1904 | 0, (u8 *)&pfe, sizeof(pfe), NULL); | ||
| 1905 | } | ||
| 1906 | |||
| 1907 | /** | ||
| 1908 | * i40e_vc_notify_link_state | ||
| 1909 | * @pf: pointer to the PF structure | ||
| 1910 | * | ||
| 1911 | * send a link status message to all VFs on a given PF | ||
| 1912 | **/ | ||
| 1913 | void i40e_vc_notify_link_state(struct i40e_pf *pf) | ||
| 1914 | { | ||
| 1915 | int i; | ||
| 1916 | |||
| 1917 | for (i = 0; i < pf->num_alloc_vfs; i++) | ||
| 1918 | i40e_vc_notify_vf_link_state(&pf->vf[i]); | ||
| 1907 | } | 1919 | } |
| 1908 | 1920 | ||
| 1909 | /** | 1921 | /** |
