#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Unbind
{
pub networkPortIdentifier: NetworkPortIdentifier,
pub pciDevice: PciDevice,
dpdkPciDriverToUnbindFrom: PciDriver,
bindBackToOriginal: Option<PciDriver>,
}
impl Unbind
{
pub fn unbindOnTermination(&self, sysPath: &Path)
{
if let Some(ref bindBackToOriginal) = self.bindBackToOriginal
{
if bindBackToOriginal != &self.dpdkPciDriverToUnbindFrom
{
if let Err(error) = self.dpdkPciDriverToUnbindFrom.unbindPciDevice(sysPath, &self.pciDevice.0)
{
warn!("Could not unbind {:?} from DPDK because {:?}", self.pciDevice, error);
}
else
{
if let Err(error) = bindBackToOriginal.bindPciDevice(sysPath, &self.pciDevice.0)
{
warn!("Could not rebind to original {:?} from DPDK because {:?}", self.pciDevice, error);
}
}
}
}
}
}