diff options
author | Mitch Williams <mitch.a.williams@intel.com> | 2015-04-07 19:45:34 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2015-04-14 20:49:51 -0400 |
commit | 532b045588f5a0f65df90e5d3de1afe89926449e (patch) | |
tree | 2536dc0e940e24e747922c3f4319833aa3f90072 /drivers/net | |
parent | 055b295d99adb246b2b9284e1d1e602630c119e3 (diff) |
i40e: move VF notification routines up
Move the VF notification functions to the top of the file. This
eliminates an unnecessary declaration.
Change-ID: I036171f14180ee9f0ce4e0a21334d6a217d06c94
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')
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 246 |
1 files changed, 123 insertions, 123 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c index 8df2b529289b..98e09219ffb7 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | |||
@@ -25,8 +25,130 @@ | |||
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); | ||
29 | 28 | ||
29 | /*********************notification routines***********************/ | ||
30 | |||
31 | /** | ||
32 | * i40e_vc_vf_broadcast | ||
33 | * @pf: pointer to the PF structure | ||
34 | * @opcode: operation code | ||
35 | * @retval: return value | ||
36 | * @msg: pointer to the msg buffer | ||
37 | * @msglen: msg length | ||
38 | * | ||
39 | * send a message to all VFs on a given PF | ||
40 | **/ | ||
41 | static void i40e_vc_vf_broadcast(struct i40e_pf *pf, | ||
42 | enum i40e_virtchnl_ops v_opcode, | ||
43 | i40e_status v_retval, u8 *msg, | ||
44 | u16 msglen) | ||
45 | { | ||
46 | struct i40e_hw *hw = &pf->hw; | ||
47 | struct i40e_vf *vf = pf->vf; | ||
48 | int i; | ||
49 | |||
50 | for (i = 0; i < pf->num_alloc_vfs; i++, vf++) { | ||
51 | int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; | ||
52 | /* Not all vfs are enabled so skip the ones that are not */ | ||
53 | if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states) && | ||
54 | !test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states)) | ||
55 | continue; | ||
56 | |||
57 | /* Ignore return value on purpose - a given VF may fail, but | ||
58 | * we need to keep going and send to all of them | ||
59 | */ | ||
60 | i40e_aq_send_msg_to_vf(hw, abs_vf_id, v_opcode, v_retval, | ||
61 | msg, msglen, NULL); | ||
62 | } | ||
63 | } | ||
64 | |||
65 | /** | ||
66 | * i40e_vc_notify_link_state | ||
67 | * @vf: pointer to the VF structure | ||
68 | * | ||
69 | * send a link status message to a single VF | ||
70 | **/ | ||
71 | static void i40e_vc_notify_vf_link_state(struct i40e_vf *vf) | ||
72 | { | ||
73 | struct i40e_virtchnl_pf_event pfe; | ||
74 | struct i40e_pf *pf = vf->pf; | ||
75 | struct i40e_hw *hw = &pf->hw; | ||
76 | struct i40e_link_status *ls = &pf->hw.phy.link_info; | ||
77 | int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; | ||
78 | |||
79 | pfe.event = I40E_VIRTCHNL_EVENT_LINK_CHANGE; | ||
80 | pfe.severity = I40E_PF_EVENT_SEVERITY_INFO; | ||
81 | if (vf->link_forced) { | ||
82 | pfe.event_data.link_event.link_status = vf->link_up; | ||
83 | pfe.event_data.link_event.link_speed = | ||
84 | (vf->link_up ? I40E_LINK_SPEED_40GB : 0); | ||
85 | } else { | ||
86 | pfe.event_data.link_event.link_status = | ||
87 | ls->link_info & I40E_AQ_LINK_UP; | ||
88 | pfe.event_data.link_event.link_speed = ls->link_speed; | ||
89 | } | ||
90 | i40e_aq_send_msg_to_vf(hw, abs_vf_id, I40E_VIRTCHNL_OP_EVENT, | ||
91 | 0, (u8 *)&pfe, sizeof(pfe), NULL); | ||
92 | } | ||
93 | |||
94 | /** | ||
95 | * i40e_vc_notify_link_state | ||
96 | * @pf: pointer to the PF structure | ||
97 | * | ||
98 | * send a link status message to all VFs on a given PF | ||
99 | **/ | ||
100 | void i40e_vc_notify_link_state(struct i40e_pf *pf) | ||
101 | { | ||
102 | int i; | ||
103 | |||
104 | for (i = 0; i < pf->num_alloc_vfs; i++) | ||
105 | i40e_vc_notify_vf_link_state(&pf->vf[i]); | ||
106 | } | ||
107 | |||
108 | /** | ||
109 | * i40e_vc_notify_reset | ||
110 | * @pf: pointer to the PF structure | ||
111 | * | ||
112 | * indicate a pending reset to all VFs on a given PF | ||
113 | **/ | ||
114 | void i40e_vc_notify_reset(struct i40e_pf *pf) | ||
115 | { | ||
116 | struct i40e_virtchnl_pf_event pfe; | ||
117 | |||
118 | pfe.event = I40E_VIRTCHNL_EVENT_RESET_IMPENDING; | ||
119 | pfe.severity = I40E_PF_EVENT_SEVERITY_CERTAIN_DOOM; | ||
120 | i40e_vc_vf_broadcast(pf, I40E_VIRTCHNL_OP_EVENT, 0, | ||
121 | (u8 *)&pfe, sizeof(struct i40e_virtchnl_pf_event)); | ||
122 | } | ||
123 | |||
124 | /** | ||
125 | * i40e_vc_notify_vf_reset | ||
126 | * @vf: pointer to the VF structure | ||
127 | * | ||
128 | * indicate a pending reset to the given VF | ||
129 | **/ | ||
130 | void i40e_vc_notify_vf_reset(struct i40e_vf *vf) | ||
131 | { | ||
132 | struct i40e_virtchnl_pf_event pfe; | ||
133 | int abs_vf_id; | ||
134 | |||
135 | /* validate the request */ | ||
136 | if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs) | ||
137 | return; | ||
138 | |||
139 | /* verify if the VF is in either init or active before proceeding */ | ||
140 | if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states) && | ||
141 | !test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states)) | ||
142 | return; | ||
143 | |||
144 | abs_vf_id = vf->vf_id + vf->pf->hw.func_caps.vf_base_id; | ||
145 | |||
146 | pfe.event = I40E_VIRTCHNL_EVENT_RESET_IMPENDING; | ||
147 | pfe.severity = I40E_PF_EVENT_SEVERITY_CERTAIN_DOOM; | ||
148 | i40e_aq_send_msg_to_vf(&vf->pf->hw, abs_vf_id, I40E_VIRTCHNL_OP_EVENT, | ||
149 | 0, (u8 *)&pfe, | ||
150 | sizeof(struct i40e_virtchnl_pf_event), NULL); | ||
151 | } | ||
30 | /***********************misc routines*****************************/ | 152 | /***********************misc routines*****************************/ |
31 | 153 | ||
32 | /** | 154 | /** |
@@ -1842,128 +1964,6 @@ int i40e_vc_process_vflr_event(struct i40e_pf *pf) | |||
1842 | } | 1964 | } |
1843 | 1965 | ||
1844 | /** | 1966 | /** |
1845 | * i40e_vc_vf_broadcast | ||
1846 | * @pf: pointer to the PF structure | ||
1847 | * @opcode: operation code | ||
1848 | * @retval: return value | ||
1849 | * @msg: pointer to the msg buffer | ||
1850 | * @msglen: msg length | ||
1851 | * | ||
1852 | * send a message to all VFs on a given PF | ||
1853 | **/ | ||
1854 | static void i40e_vc_vf_broadcast(struct i40e_pf *pf, | ||
1855 | enum i40e_virtchnl_ops v_opcode, | ||
1856 | i40e_status v_retval, u8 *msg, | ||
1857 | u16 msglen) | ||
1858 | { | ||
1859 | struct i40e_hw *hw = &pf->hw; | ||
1860 | struct i40e_vf *vf = pf->vf; | ||
1861 | int i; | ||
1862 | |||
1863 | for (i = 0; i < pf->num_alloc_vfs; i++, vf++) { | ||
1864 | int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; | ||
1865 | /* Not all VFs are enabled so skip the ones that are not */ | ||
1866 | if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states) && | ||
1867 | !test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states)) | ||
1868 | continue; | ||
1869 | |||
1870 | /* Ignore return value on purpose - a given VF may fail, but | ||
1871 | * we need to keep going and send to all of them | ||
1872 | */ | ||
1873 | i40e_aq_send_msg_to_vf(hw, abs_vf_id, v_opcode, v_retval, | ||
1874 | msg, msglen, NULL); | ||
1875 | } | ||
1876 | } | ||
1877 | |||
1878 | /** | ||
1879 | * i40e_vc_notify_link_state | ||
1880 | * @vf: pointer to the VF structure | ||
1881 | * | ||
1882 | * send a link status message to a single VF | ||
1883 | **/ | ||
1884 | static void i40e_vc_notify_vf_link_state(struct i40e_vf *vf) | ||
1885 | { | ||
1886 | struct i40e_virtchnl_pf_event pfe; | ||
1887 | struct i40e_pf *pf = vf->pf; | ||
1888 | struct i40e_hw *hw = &pf->hw; | ||
1889 | struct i40e_link_status *ls = &pf->hw.phy.link_info; | ||
1890 | int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; | ||
1891 | |||
1892 | pfe.event = I40E_VIRTCHNL_EVENT_LINK_CHANGE; | ||
1893 | pfe.severity = I40E_PF_EVENT_SEVERITY_INFO; | ||
1894 | if (vf->link_forced) { | ||
1895 | pfe.event_data.link_event.link_status = vf->link_up; | ||
1896 | pfe.event_data.link_event.link_speed = | ||
1897 | (vf->link_up ? I40E_LINK_SPEED_40GB : 0); | ||
1898 | } else { | ||
1899 | pfe.event_data.link_event.link_status = | ||
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), 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]); | ||
1919 | } | ||
1920 | |||
1921 | /** | ||
1922 | * i40e_vc_notify_reset | ||
1923 | * @pf: pointer to the PF structure | ||
1924 | * | ||
1925 | * indicate a pending reset to all VFs on a given PF | ||
1926 | **/ | ||
1927 | void i40e_vc_notify_reset(struct i40e_pf *pf) | ||
1928 | { | ||
1929 | struct i40e_virtchnl_pf_event pfe; | ||
1930 | |||
1931 | pfe.event = I40E_VIRTCHNL_EVENT_RESET_IMPENDING; | ||
1932 | pfe.severity = I40E_PF_EVENT_SEVERITY_CERTAIN_DOOM; | ||
1933 | i40e_vc_vf_broadcast(pf, I40E_VIRTCHNL_OP_EVENT, I40E_SUCCESS, | ||
1934 | (u8 *)&pfe, sizeof(struct i40e_virtchnl_pf_event)); | ||
1935 | } | ||
1936 | |||
1937 | /** | ||
1938 | * i40e_vc_notify_vf_reset | ||
1939 | * @vf: pointer to the VF structure | ||
1940 | * | ||
1941 | * indicate a pending reset to the given VF | ||
1942 | **/ | ||
1943 | void i40e_vc_notify_vf_reset(struct i40e_vf *vf) | ||
1944 | { | ||
1945 | struct i40e_virtchnl_pf_event pfe; | ||
1946 | int abs_vf_id; | ||
1947 | |||
1948 | /* validate the request */ | ||
1949 | if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs) | ||
1950 | return; | ||
1951 | |||
1952 | /* verify if the VF is in either init or active before proceeding */ | ||
1953 | if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states) && | ||
1954 | !test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states)) | ||
1955 | return; | ||
1956 | |||
1957 | abs_vf_id = vf->vf_id + vf->pf->hw.func_caps.vf_base_id; | ||
1958 | |||
1959 | pfe.event = I40E_VIRTCHNL_EVENT_RESET_IMPENDING; | ||
1960 | pfe.severity = I40E_PF_EVENT_SEVERITY_CERTAIN_DOOM; | ||
1961 | i40e_aq_send_msg_to_vf(&vf->pf->hw, abs_vf_id, I40E_VIRTCHNL_OP_EVENT, | ||
1962 | I40E_SUCCESS, (u8 *)&pfe, | ||
1963 | sizeof(struct i40e_virtchnl_pf_event), NULL); | ||
1964 | } | ||
1965 | |||
1966 | /** | ||
1967 | * i40e_ndo_set_vf_mac | 1967 | * i40e_ndo_set_vf_mac |
1968 | * @netdev: network interface device structure | 1968 | * @netdev: network interface device structure |
1969 | * @vf_id: VF identifier | 1969 | * @vf_id: VF identifier |