Skip to content

Conversation

@opsiff
Copy link
Member

@opsiff opsiff commented Dec 16, 2025

deepin inclusion
category: kabi

No functioncal change.

Log: fix kabi white list symbol in skbuff.c:
slab_build_skb
build_skb
__alloc_skb
__netdev_alloc_skb
__napi_alloc_skb
...

Fixes: dae142e ("net: allow small head cache usage with large MAX_SKB_FRAGS values")

Summary by Sourcery

Enhancements:

  • Guard the inclusion of <net/gro.h> with CONFIG_DEEPIN_KABI_RESERVE and define a local GRO_MAX_HEAD constant to avoid skbuff KABI breakage without changing runtime behavior.

@sourcery-ai
Copy link

sourcery-ai bot commented Dec 16, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR conditionally excludes inclusion of <net/gro.h> under Deepin’s KABI-reserve configuration by defining a local GRO_MAX_HEAD macro instead, avoiding KABI changes to skbuff-related symbols without altering runtime behavior.

Flow diagram for conditional GRO_MAX_HEAD definition based on CONFIG_DEEPIN_KABI_RESERVE

flowchart TD
    A[skbuff.c compile time] --> B{CONFIG_DEEPIN_KABI_RESERVE enabled?}

    B -- no --> C[Include net/gro.h]
    C --> D[Use GRO_MAX_HEAD from net/gro.h]

    B -- yes --> E[Do not include net/gro.h]
    E --> F[Define GRO_MAX_HEAD as MAX_HEADER + 128]
    F --> G[Use local GRO_MAX_HEAD without changing KABI]
Loading

File-Level Changes

Change Details Files
Guard inclusion of <net/gro.h> with a Deepin KABI config and provide a local GRO_MAX_HEAD definition when GRO is not included to avoid skbuff KABI breakage.
  • Wrap the existing #include <net/gro.h> in a #ifndef CONFIG_DEEPIN_KABI_RESERVE conditional.
  • Under CONFIG_DEEPIN_KABI_RESERVE, skip including <net/gro.h> and instead define GRO_MAX_HEAD as (MAX_HEADER + 128).
  • Add a comment noting GRO_MAX_HEAD must be increased if a protocol with a larger head is introduced.
net/core/skbuff.c

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Member

@Cryolitia Cryolitia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Cryolitia
Once this PR has been reviewed and has the lgtm label, please ask for approval from opsiff. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and found some issues that need to be addressed.

  • The preprocessor branch uses #elif /* !CONFIG_DEEPIN_KABI_RESERVE */ without a condition, which is invalid; this should be #else (with the comment kept if desired) to compile correctly.
  • Defining GRO_MAX_HEAD locally risks divergence from the value in net/gro.h; consider centralizing this definition or referencing a shared header to avoid future inconsistencies when protocols with larger headers are added.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The preprocessor branch uses `#elif  /* !CONFIG_DEEPIN_KABI_RESERVE */` without a condition, which is invalid; this should be `#else` (with the comment kept if desired) to compile correctly.
- Defining `GRO_MAX_HEAD` locally risks divergence from the value in `net/gro.h`; consider centralizing this definition or referencing a shared header to avoid future inconsistencies when protocols with larger headers are added.

## Individual Comments

### Comment 1
<location> `net/core/skbuff.c:72` </location>
<code_context>
 #include <net/checksum.h>
+#ifndef CONFIG_DEEPIN_KABI_RESERVE
 #include <net/gro.h>
+#elif  /* !CONFIG_DEEPIN_KABI_RESERVE */
+/* This should be increased if a protocol with a bigger head is added. */
+#define GRO_MAX_HEAD (MAX_HEADER + 128)
</code_context>

<issue_to_address>
**issue (bug_risk):** Preprocessor `#elif` is missing a condition and should likely be `#else`.

`#elif` without an expression is invalid preprocessor syntax and will fail to compile. Based on the surrounding `#ifndef CONFIG_DEEPIN_KABI_RESERVE` and closing `#endif`, this branch should be the `#else` case. Please change this line to `#else  /* CONFIG_DEEPIN_KABI_RESERVE */` (or equivalent).
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

deepin inclusion
category: kabi

No functioncal change.

Log: fix kabi white list symbol in skbuff.c:
slab_build_skb
build_skb
__alloc_skb
__netdev_alloc_skb
__napi_alloc_skb
...

Fixes: dae142e ("net: allow small head cache usage with large MAX_SKB_FRAGS values")
Signed-off-by: Wentao Guan <[email protected]>
@opsiff opsiff force-pushed the linux-6.6.y-2025-12-16-kabi-2 branch from 7cb4c9e to d72aa28 Compare December 16, 2025 09:31
@deepin-ci-robot
Copy link

deepin pr auto review

我来对这个 diff 进行审查:

  1. 语法逻辑:
  • 代码语法正确,使用了标准的 C 预处理器指令
  • 条件编译块的格式规范,包含了对应的注释
  • 宏定义 GRO_MAX_HEAD 的命名符合规范
  1. 代码质量:
  • 优点:
    • 保持了向后兼容性
    • 添加了清晰的注释说明宏的用途
    • 使用了有意义的宏名称
  • 可改进:
    • 注释可以更详细一些,说明为什么需要这个宏定义
    • 可以考虑添加一个 TODO 注释,提醒在添加新协议时需要更新这个值
  1. 代码性能:
  • 这个改动主要是为了兼容性,对性能影响很小
  • 使用宏定义而不是变量,避免了运行时计算
  1. 代码安全:
  • 使用了 MAX_HEADER 作为基准值,保证了基本的安全性
  • 128 字节的缓冲区看起来是合理的,但建议:
    • 在注释中说明为什么选择 128 字节这个具体值
    • 可以考虑添加编译时检查,确保这个值不会太小
    • 建议添加一个 static_assert 来验证 GRO_MAX_HEAD 的大小是否合理

改进建议:

#ifndef CONFIG_DEEPIN_KABI_RESERVE
#include <net/gro.h>
#else  /* CONFIG_DEEPIN_KABI_RESERVE */
/*
 * GRO_MAX_HEAD defines the maximum header space needed for GRO (Generic Receive Offload)
 * operations. This includes MAX_HEADER plus additional space for protocol headers.
 * The current value of 128 bytes should be sufficient for most common protocols,
 * but may need to be increased when adding support for new protocols with larger headers.
 * TODO: Review this value when adding new protocol support.
 */
#define GRO_MAX_HEAD (MAX_HEADER + 128)

/* Compile-time check to ensure minimum header size */
static_assert(GRO_MAX_HEAD >= MAX_HEADER, "GRO_MAX_HEAD must be at least MAX_HEADER");
#endif /* CONFIG_DEEPIN_KABI_RESERVE */

这些改进将:

  1. 提供更详细的文档说明
  2. 添加编译时安全检查
  3. 包含维护提醒
  4. 保持代码的可读性和可维护性

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a Kernel ABI (KABI) compatibility issue in the Deepin kernel by conditionally excluding the <net/gro.h> header when CONFIG_DEEPIN_KABI_RESERVE is defined. The change prevents ABI breakage for exported symbols in skbuff.c without affecting functionality.

Key Changes:

  • Conditionally excludes <net/gro.h> inclusion when CONFIG_DEEPIN_KABI_RESERVE is enabled
  • Defines GRO_MAX_HEAD locally when the header is excluded to maintain the same constant value
  • Preserves runtime behavior while protecting KABI compatibility

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

#include <net/checksum.h>
#ifndef CONFIG_DEEPIN_KABI_RESERVE
#include <net/gro.h>
#else /* !CONFIG_DEEPIN_KABI_RESERVE */
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment on this line is incorrect. It says "!CONFIG_DEEPIN_KABI_RESERVE" but should say "CONFIG_DEEPIN_KABI_RESERVE" since this is the else branch that executes when CONFIG_DEEPIN_KABI_RESERVE is defined. The exclamation mark should be removed.

Suggested change
#else /* !CONFIG_DEEPIN_KABI_RESERVE */
#else /* CONFIG_DEEPIN_KABI_RESERVE */

Copilot uses AI. Check for mistakes.
@opsiff opsiff merged commit ebe57af into deepin-community:linux-6.6.y Dec 17, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants