Add SPDB generation id 'sp_genid' variable and key_getspgen() function
to read its value. This variable incremented when security policy
added or deleted from SPDB.
Modify key_insertsp(), key_unlink() and key_spdflush() to modify
generation id.
Change condition in key_unlink(). Now we have many different SP states,
but only SPs with IPSEC_SPSTATE_ALIVE state are linked into the SPDB.
If SP has different state, do not try to unlink it. Also remove SP
from idhash when it becomes unlinked.
Change key_insertsp(), now it should be called with acquired SPTREE_LOCK.
Also add new SP into idhash when it linked into SPDB.
In key_spdflush() remove all flushed SPs from idhash.