tcp: improve inp locking in setsockopt
Ensure that the inp is not dropped when starting a stack switch.
While there, clean-up the code by using INP_WLOCK_RECHECK, which
also re-assigns tp.
Reviewed by: glebius
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D45241
(cherry picked from commit fe136aecc2a0ae9d9cc5f78b2d1430cd33b6b7c4)