* Stop device: disable rx and tx functions to allow for reconfiguring. */
| 1149 | * Stop device: disable rx and tx functions to allow for reconfiguring. |
| 1150 | */ |
| 1151 | static int |
| 1152 | ngbe_dev_stop(struct rte_eth_dev *dev) |
| 1153 | { |
| 1154 | struct rte_eth_link link; |
| 1155 | struct ngbe_adapter *adapter = ngbe_dev_adapter(dev); |
| 1156 | struct ngbe_hw *hw = ngbe_dev_hw(dev); |
| 1157 | struct ngbe_vf_info *vfinfo = *NGBE_DEV_VFDATA(dev); |
| 1158 | struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); |
| 1159 | struct rte_intr_handle *intr_handle = pci_dev->intr_handle; |
| 1160 | int vf; |
| 1161 | |
| 1162 | if (hw->adapter_stopped) |
| 1163 | goto out; |
| 1164 | |
| 1165 | PMD_INIT_FUNC_TRACE(); |
| 1166 | |
| 1167 | if (hw->gpio_ctl) { |
| 1168 | /* gpio0 is used to power on/off control*/ |
| 1169 | wr32(hw, NGBE_GPIODATA, NGBE_GPIOBIT_0); |
| 1170 | } |
| 1171 | |
| 1172 | /* disable interrupts */ |
| 1173 | ngbe_disable_intr(hw); |
| 1174 | |
| 1175 | /* reset the NIC */ |
| 1176 | ngbe_pf_reset_hw(hw); |
| 1177 | hw->adapter_stopped = 0; |
| 1178 | |
| 1179 | /* stop adapter */ |
| 1180 | ngbe_stop_hw(hw); |
| 1181 | |
| 1182 | for (vf = 0; vfinfo != NULL && vf < pci_dev->max_vfs; vf++) |
| 1183 | vfinfo[vf].clear_to_send = false; |
| 1184 | |
| 1185 | ngbe_dev_clear_queues(dev); |
| 1186 | |
| 1187 | /* Clear stored conf */ |
| 1188 | dev->data->scattered_rx = 0; |
| 1189 | |
| 1190 | /* Clear recorded link status */ |
| 1191 | memset(&link, 0, sizeof(link)); |
| 1192 | rte_eth_linkstatus_set(dev, &link); |
| 1193 | |
| 1194 | if (!rte_intr_allow_others(intr_handle)) |
| 1195 | /* resume to the default handler */ |
| 1196 | rte_intr_callback_register(intr_handle, |
| 1197 | ngbe_dev_interrupt_handler, |
| 1198 | (void *)dev); |
| 1199 | |
| 1200 | /* Clean datapath event and queue/vec mapping */ |
| 1201 | rte_intr_efd_disable(intr_handle); |
| 1202 | rte_intr_vec_list_free(intr_handle); |
| 1203 | |
| 1204 | ngbe_set_pcie_master(hw, true); |
| 1205 | |
| 1206 | adapter->rss_reta_updated = 0; |
| 1207 | |
| 1208 | hw->adapter_stopped = true; |
no test coverage detected