AltraMayor / AltraMayor/gatekeeper

Is there a clever way to combine integer divisions?

Đang mở
#243 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement good first issue question
Ngôn ngữ chính
C
Star
1.6k
Fork
252
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

`get_responsible_gk_mailbox()` in file `gk/main.c` takes the reminder `rss_hash_val % gk_conf->rss_conf_front.reta_size` to calculate `rss_hash_val` and `rss_hash_val` is only used on a integer division and reminder on the following lines:
```
idx = rss_hash_val / RTE_RETA_GROUP_SIZE;
shift = rss_hash_val % RTE_RETA_GROUP_SIZE;
```

If `gk_conf->rss_conf_front.reta_size` can only be a power of 2 greater than or equal to `RTE_RETA_GROUP_SIZE`, which is 64, the operation `rss_hash_val % gk_conf->rss_conf_front.reta_size` is not need at all. It suggests that the code of `get_responsible_gk_mailbox()` may be simplifyable. The following questions are key to know how to simplify the code:
1. Can `gk_conf->rss_conf_front.reta_size` take a value that is not a power of 2?
2. Can `gk_conf->rss_conf_front.reta_size` be less than `RTE_RETA_GROUP_SIZE`?

Besides the answers above, the code simplification may require combining properties of integer divisions and reminders and employing new functions (e.g. `div(3)`).

Pull request #242 and its related issue #149 motivated this new issue, so reviewing them might be helpful.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.