Repository navigation
PR: HeaderAction::Modify should not panic on missing metadata #241 - #242
Conversation
|
Once #246 lands I'll rebase this and the checks should pass again. |
dfb6144 to
8b42d0a
Compare
|
Still need to go through some TODOs. |
d906c9d to
85e70ef
Compare
|
I verified this patch prevents the panic described in #231 by creating an instance with no external IP and trying to ping the address |
bnaecker
left a comment
There was a problem hiding this comment.
Looks like a lot of great cleanup: the kstats, locking simplification, and the check for the missing ULP. Thanks!
|
Okay @bnaecker, I think I addressed all your concerns. When you get a chance give it a look and see if I missed anything. |
bnaecker
left a comment
There was a problem hiding this comment.
Nice, this looks good to me. Thanks for going through all that, the comments especially were very helpful.
The main thrust of this commit is to fix #241 by allowing a `HeaderAction` to return an error result. Some other stuff came along for the ride. - add some basic kstats support (#23) With yet another possible runtime error I thought it was high time we had some kstats support. There is already good SDT support in OPTE, but if you're not running DTrace when an error occurs, you're not going to know it happened. Having kstats allows us to track historical failures/errors and provide a clue as to where to look when debugging live. While trying to implement kstats I realized that I need to change the locking scheme in OPTE. OPTE was my first real Rust project; a packet transformation engine running Rust in the illumos kernel -- it was a lot to take on for a first Rust project. I brought a lot of my previous knowledge to bear from working on the illumos networking stack, particularly the mac module. From this past knowledge my initial architecture relied on a lot of Arc + fine-grained locks inside of the engine, as this is the structure I was used to seeing inside illumos. When trying to implement kstats I realized that I would have to wrap a mutex around a group of named kstats...and that just felt weird compared to how we do it in most illumos network drivers. Furthermore, the fine-grained locking I had in place wasn't actually completely correct, and relied on some hard-to-understand comments and non-idiomatic Rust code. Then I had the thought that I should really be treating an individual Port more like a Tx/Rx ring that you would find in a network driver, where the entire ring is locked during processing. In this sense the entire Port should be wrapped in a mutex, knowing that any state changed inside that Port is atomic in respect to a given packet (or chain of packets). If and when this proves to be a limiting factor, you can then start breaking things out at a higher level, like having each Port broken out into concurrent streams for different protocol types: like TCP, UDP, and Other. If that becomes a bottleneck you could then possibly break each protocol out further into rings, assuming you could find a way to consistently hash flows to their appropriate ring. Furthermore, the happy path for an active flow is always hitting the UFT. There may be ways to structure the UFT such that it can be queried without a mutex, perhaps with some type of scheme that uses asynchronous updates of a persistent (read functional) data structure plus atomic pointer swaps. The point being, there are higher-level ways to reduce contention than the fine grained locking scheme I had used up to this point. - Renamed `ModActionArg` to `ModifyActionArg`, because I kept confusing `Mod` with "module" in my head, and I wrote this damn code! - Renamed `HT` to `HdrTransform` to make it a bit more obvious what it refers to.
f416a5a to
971340d
Compare
Uh oh!
There was an error while loading. Please reload this page.