Page MenuHomeFreeBSD

Factor out vnet ready check
Needs ReviewPublic

Authored by hselasky on Apr 25 2019, 10:59 AM.

Details

Reviewers
bz
Summary

Factor out vnet running check into own function.

MFC after: 1 week
Sponsored by: Mellanox Technologies

Diff Detail

Repository
rS FreeBSD src repository
Lint
Lint Skipped
Unit
Unit Tests Skipped
Build Status
Buildable 24188

Event Timeline

hselasky created this revision.Apr 25 2019, 10:59 AM
hselasky updated this revision to Diff 56637.Apr 25 2019, 11:00 AM

Fix comment.

bz added a comment.May 8 2019, 5:34 PM

I kept thinking which states we can really observe and when:

  1. during alloc: vnet_state is 0
  2. during startup: it's anything from SI_SUB_VNET up to VNET_DONE
  3. while up and running in a stable state: it's VNET_DONE
  4. during shutdown: it's down from VNET_DONE towards SI_SUB_VNET
  5. when shutdown: it's the last VNET_SYSUNINT state

States (1) and (5) should not really observable. So Maybe the original states were too precise as we really only are interested "are we in an up/running/stable" state? What if we'd simply call the function "running" or "up" or "stable"? Not sure which one.. ready always makes me think of "READY? " asking for input.

bool
vnet_is_up_running_and_stable(struct vnet *vnet)
{

        return (vnet->vnet_state == SI_SUB_VNET_DONE);
}

I cannot remember why I ended up with the more precise checks initially. Sadly history was in p4 which is gone.

sys/net/vnet.c
236

No matter that the outcome of the naming/state discussion will be, can this please be moved under vnet_sysinit_done() before the comment for vnet_data_alloc()?

hselasky updated this revision to Diff 57254.May 10 2019, 9:09 AM
hselasky marked an inline comment as done.

Update patch as per @bz's suggestions.

hselasky edited the summary of this revision. (Show Details)May 10 2019, 9:10 AM
bz accepted this revision.May 10 2019, 9:47 AM

LGTM

This revision is now accepted and ready to land.May 10 2019, 9:47 AM
hselasky updated this revision to Diff 57256.May 10 2019, 11:09 AM

Make sure vnet0 gets its vnet_state set aswell and add a KASSERT() for valid vnet_state.

This revision now requires review to proceed.May 10 2019, 11:09 AM
hselasky updated this revision to Diff 57257.May 10 2019, 11:16 AM

Fix style issue.