Improve types for channels and lanes
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 重构
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- rust
- 领域
- networking
调研方向
从 asic/src/tofino_common/ports.rs、asic/src/tofino_asic/ports.rs 和 asic/src/tofino_asic/serdes.rs 开始,包括所引用的注释和通道跟踪代码。调查 lanes 和 channels 是否应保持区分,newtype 是否可以强制约束它们的范围,以及 Vec 是否合适。完成的标准是:实现所选表示,并记录其区别、边界和存储方面的理由。
由索引模型根据 Issue 内容生成。
描述
Explanation
Dendrite refers to channels in connector code and lanes in serdes code. I believe the types used for representing these could be improved. Here are some concerns in the current design:
-
Should we actually have a distinction between channel and lane? This comment makes me question if we should. https://github.com/oxidecomputer/dendrite/blob/f6d41dd821f88f09ce7539ec981642efd32797d5/asic/src/tofino_asic/ports.rs#L23-L25
-
There's a matrix of numbers involved. There's the maximum quantity of lanes/channels on a port and the lane/channel indexes. I believe the range of acceptable lane counts is
1..=8, and the range of acceptable channel counts is1..=4. The indexes are then0..8and0..4. Lane count currently usesu32.
https://github.com/oxidecomputer/dendrite/blob/f6d41dd821f88f09ce7539ec981642efd32797d5/asic/src/tofino_common/ports.rs#L19-L25
https://github.com/oxidecomputer/dendrite/blob/f6d41dd821f88f09ce7539ec981642efd32797d5/asic/src/tofino_asic/serdes.rs#L50-L58
- The channels used by a port are stored in a
Vec<u8>. But afaict the SDE usesbase + offsetduring port creation, so we'd never have a port using non-contiguous lanes.
Some non-contiguous tracking is required, but we also have a BTreeSet for available_channels.
A final design will require further investigation, but I feel like we can use a more descriptive type than Vec<u8> for this. And if not, a doc comment is warranted.
Proposal
- Decide whether we should continue differentiating lanes and channels in this code. Changes if warranted.
- Explore if a newtype wrapper makes sense for lanes/channels. If keeping lanes and channels distinct, define and document how exactly they're different and why we're differentiating. Move boundary and range checking into the type(s).
- Determine whether there's any more appropriate way to track channels than a
Vec<u8>. If not, document whyVecis needed here.
- 主要语言
- Rust
- 星标
- 22
- 派生
- 4
- 平均合并
- 4 天 20 小时
- 30 天内合并 PR
- 6
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
oxidecomputer/dendrite 的其他 Issue
-
难度 5/5 一周以上 新手友好度 35/100
oxidecomputer/dendrite#412 ·
维护者通常 2 天内回复
-
难度 3/5 1-2 天 新手友好度 45/100
oxidecomputer/dendrite#402 ·
维护者通常 2 天内回复
-
难度 4/5 3-5 天 新手友好度 35/100
oxidecomputer/dendrite#384 · 1 条评论 ·
维护者通常 2 天内回复
-
难度 3/5 1-2 天 新手友好度 65/100
oxidecomputer/dendrite#375 ·
维护者通常 2 天内回复
-
难度 5/5 一周以上 新手友好度 35/100
oxidecomputer/dendrite#369 · 1 条评论 ·
维护者通常 2 天内回复
查看 oxidecomputer/dendrite 的全部 Issue
相似的 Issue
-
Published SDL drops input-field default values: a non-null field with a default renders as required未关闭
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
色変記事を追加未关闭priority middle
难度 1/5 1 小时以内 新手友好度 62/100
KATO-Hiro/AtCoderClans#12955 ·
维护者通常 1 天内回复
-
auto:doc-drift auto:producer
难度 2/5 1-3 小时 新手友好度 60/100
fritzprix/libr-agent#2458 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
yantrikos/yantrik-os#1048 ·
维护者通常 1 天内回复
-
rust
难度 2/5 1-3 小时 新手友好度 80/100
vllm-project/vllm#64939 ·
维护者通常 1 天内回复