/* MTU range: (ETH_MIN_MTU(kernel default) - 9706) */
netdev->max_mtu = HNS3_MAX_MTU - (ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN);
+ set_bit(HNS3_NIC_STATE_INITED, &priv->state);
+
return ret;
out_reg_netdev_fail:
if (netdev->reg_state != NETREG_UNINITIALIZED)
unregister_netdev(netdev);
+ if (!test_and_clear_bit(HNS3_NIC_STATE_INITED, &priv->state)) {
+ netdev_warn(netdev, "already uninitialized\n");
+ goto out_netdev_free;
+ }
+
hns3_del_all_fd_rules(netdev, true);
hns3_force_clear_all_rx_ring(handle);
priv->ring_data = NULL;
+out_netdev_free:
free_netdev(netdev);
}
priv->ring_data = NULL;
}
+ set_bit(HNS3_NIC_STATE_INITED, &priv->state);
+
return ret;
}
struct hns3_nic_priv *priv = netdev_priv(netdev);
int ret;
+ if (!test_bit(HNS3_NIC_STATE_INITED, &priv->state)) {
+ netdev_warn(netdev, "already uninitialized\n");
+ return 0;
+ }
+
hns3_force_clear_all_rx_ring(handle);
ret = hns3_nic_uninit_vector_data(priv);
hns3_del_all_fd_rules(netdev, false);
}
+ clear_bit(HNS3_NIC_STATE_INITED, &priv->state);
+
return ret;
}