Skip to content

dropwatch ​

dropwatch 组件名称为 dropwatch, 需要开启的内核选项为

ini
# Networking support
# -> Networking options
# -> Network testing
# -> Network packet drop alerting service
CONFIG_NET_DROP_MONITOR=y

检查工具为

bash
#!/opt/sum/bin/bash

source ./kernel_config_utils.sh

dropwatch_check() {
    local is_error

    is_error="false"
    if ! kernel_config_check CONFIG_NET_DROP_MONITOR drop_monitor; then
        is_error="true"
    fi
    if ! kernel_config_check CONFIG_NET_DEVLINK; then
        is_error="true"
    fi
    if [ "$is_error" == "true" ]; then
        return 1
    fi

    return 0
}

NET_DM_CMD_CONFIG 支持的 attr 对应的标识符格式为 NET_DM_ATTR_*, 对应的 C 类型是 include/uapi/linux/net_dropmon.h 文件中的 enum net_dm_attr 类型. 引入的 attr 的版本和提交号如下表所示:

attr版本提交号
NET_DM_ATTR_ALERT_MODEv5.4ca30707dee2bc8bc81cfd8b4277fe90f7ca6df1f
NET_DM_ATTR_QUEUE_LENv5.430328d46af593dcf24582f2a431d84ea0cf4bdef
NET_DM_ATTR_TRUNC_LENv5.457986617a736aec2980c1c78a9dd8dcdf477ee6e

移植问题 ​

  • dwdump 工具在 NET_DM_CMD_CONFIG 不支持下列 attr 时

    会打印以下报错

    bash
    Failed to configure drop monitor kernel module
  • dwdump 工具在 CONFIG_NET_DEVLINK 内核选项未开启时, 但是开启 hardware origin 时, 即以如下格式

    • 未指定 -o 选项.
    • 指定 -o 选项为 -o all.
    • 指定 -o 选项为 -o hw.

    调用时会打印以下报错

    bash
    Failed to start monitoring