/** * Set receive filters * * @v nii NII NIC * @ret rc Return status code */ static int nii_set_rx_filters ( struct nii_nic *nii ) { uint32_t implementation = nii->undi->Implementation; unsigned int flags; unsigned int op; int stat; int rc; /* Construct receive filter set */ flags = ( PXE_OPFLAGS_RECEIVE_FILTER_ENABLE | PXE_OPFLAGS_RECEIVE_FILTER_UNICAST ); if ( implementation & PXE_ROMID_IMP_BROADCAST_RX_SUPPORTED ) flags |= PXE_OPFLAGS_RECEIVE_FILTER_BROADCAST; if ( implementation & PXE_ROMID_IMP_PROMISCUOUS_RX_SUPPORTED ) flags |= PXE_OPFLAGS_RECEIVE_FILTER_PROMISCUOUS; if ( implementation & PXE_ROMID_IMP_PROMISCUOUS_MULTICAST_RX_SUPPORTED ) flags |= PXE_OPFLAGS_RECEIVE_FILTER_ALL_MULTICAST; /* Issue command */ op = NII_OP ( PXE_OPCODE_RECEIVE_FILTERS, flags ); if ( ( stat = nii_issue ( nii, op ) ) < 0 ) { rc = -EIO_STAT ( stat ); DBGC ( nii, "NII %s could not set receive filters %#04x: %s\n", nii->dev.name, flags, strerror ( rc ) ); return rc; } return 0; }
/** * Stop UNDI * * @v nii NII NIC */ static void nii_stop_undi ( struct nii_nic *nii ) { int stat; int rc; /* Issue command */ if ( ( stat = nii_issue ( nii, PXE_OPCODE_STOP ) ) < 0 ) { rc = -EIO_STAT ( stat ); DBGC ( nii, "NII %s could not stop: %s\n", nii->dev.name, strerror ( rc ) ); /* Nothing we can do about it */ return; } }
/** * Shut down UNDI * * @v nii NII NIC */ static void nii_shutdown ( struct nii_nic *nii ) { int stat; int rc; /* Issue command */ if ( ( stat = nii_issue ( nii, PXE_OPCODE_SHUTDOWN ) ) < 0 ) { rc = -EIO_STAT ( stat ); DBGC ( nii, "NII %s could not shut down: %s\n", nii->dev.name, strerror ( rc ) ); /* Leak memory to avoid corruption */ return; } /* Free buffer */ ufree ( nii->buffer ); }
/** * Set receive filters * * @v nii NII NIC * @ret rc Return status code */ static int nii_set_rx_filters ( struct nii_nic *nii ) { unsigned int op; int stat; int rc; /* Issue command */ op = NII_OP ( PXE_OPCODE_RECEIVE_FILTERS, ( PXE_OPFLAGS_RECEIVE_FILTER_ENABLE | PXE_OPFLAGS_RECEIVE_FILTER_UNICAST | PXE_OPFLAGS_RECEIVE_FILTER_BROADCAST | PXE_OPFLAGS_RECEIVE_FILTER_PROMISCUOUS | PXE_OPFLAGS_RECEIVE_FILTER_ALL_MULTICAST ) ); if ( ( stat = nii_issue ( nii, op ) ) < 0 ) { rc = -EIO_STAT ( stat ); DBGC ( nii, "NII %s could not set receive filters: %s\n", nii->dev.name, strerror ( rc ) ); return rc; } return 0; }