Skip to content

Commit

Permalink
sync to upstream cf6d9fe09185 (tc: fix typo probabilty in tc.yaml doc…
Browse files Browse the repository at this point in the history
…, 2024-11-08)

Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
kuba-moo committed Nov 9, 2024
1 parent 034218a commit 4b04836
Show file tree
Hide file tree
Showing 9 changed files with 459 additions and 15 deletions.
19 changes: 19 additions & 0 deletions generated/dpll-user.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,24 @@ const char *dpll_lock_status_error_str(enum dpll_lock_status_error value)
return dpll_lock_status_error_strmap[value];
}

static const char * const dpll_clock_quality_level_strmap[] = {
[1] = "itu-opt1-prc",
[2] = "itu-opt1-ssu-a",
[3] = "itu-opt1-ssu-b",
[4] = "itu-opt1-eec1",
[5] = "itu-opt1-prtc",
[6] = "itu-opt1-eprtc",
[7] = "itu-opt1-eeec",
[8] = "itu-opt1-eprc",
};

const char *dpll_clock_quality_level_str(enum dpll_clock_quality_level value)
{
if (value < 0 || value >= (int)YNL_ARRAY_SIZE(dpll_clock_quality_level_strmap))
return NULL;
return dpll_clock_quality_level_strmap[value];
}

static const char * const dpll_type_strmap[] = {
[1] = "pps",
[2] = "eec",
Expand Down Expand Up @@ -185,6 +203,7 @@ const struct ynl_policy_attr dpll_policy[DPLL_A_MAX + 1] = {
[DPLL_A_TEMP] = { .name = "temp", .type = YNL_PT_U32, },
[DPLL_A_TYPE] = { .name = "type", .type = YNL_PT_U32, },
[DPLL_A_LOCK_STATUS_ERROR] = { .name = "lock-status-error", .type = YNL_PT_U32, },
[DPLL_A_CLOCK_QUALITY_LEVEL] = { .name = "clock-quality-level", .type = YNL_PT_U32, },
};

const struct ynl_policy_nest dpll_nest = {
Expand Down
46 changes: 46 additions & 0 deletions generated/ethtool-user.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ static const char * const ethtool_op_strmap[] = {
[43] = "mm-ntf",
[44] = "module-fw-flash-ntf",
[ETHTOOL_MSG_PHY_GET] = "phy-get",
[46] = "phy-ntf",
};

const char *ethtool_op_str(int op)
Expand Down Expand Up @@ -341,6 +342,8 @@ const struct ynl_policy_attr ethtool_bitset_policy[ETHTOOL_A_BITSET_MAX + 1] = {
[ETHTOOL_A_BITSET_NOMASK] = { .name = "nomask", .type = YNL_PT_FLAG, },
[ETHTOOL_A_BITSET_SIZE] = { .name = "size", .type = YNL_PT_U32, },
[ETHTOOL_A_BITSET_BITS] = { .name = "bits", .type = YNL_PT_NEST, .nest = &ethtool_bitset_bits_nest, },
[ETHTOOL_A_BITSET_VALUE] = { .name = "value", .type = YNL_PT_BINARY,},
[ETHTOOL_A_BITSET_MASK] = { .name = "mask", .type = YNL_PT_BINARY,},
};

const struct ynl_policy_nest ethtool_bitset_nest = {
Expand Down Expand Up @@ -1598,6 +1601,8 @@ int ethtool_strings_parse(struct ynl_parse_arg *yarg,
void ethtool_bitset_free(struct ethtool_bitset *obj)
{
ethtool_bitset_bits_free(&obj->bits);
free(obj->value);
free(obj->mask);
}

int ethtool_bitset_put(struct nlmsghdr *nlh, unsigned int attr_type,
Expand All @@ -1612,6 +1617,10 @@ int ethtool_bitset_put(struct nlmsghdr *nlh, unsigned int attr_type,
ynl_attr_put_u32(nlh, ETHTOOL_A_BITSET_SIZE, obj->size);
if (obj->_present.bits)
ethtool_bitset_bits_put(nlh, ETHTOOL_A_BITSET_BITS, &obj->bits);
if (obj->_present.value_len)
ynl_attr_put(nlh, ETHTOOL_A_BITSET_VALUE, obj->value, obj->_present.value_len);
if (obj->_present.mask_len)
ynl_attr_put(nlh, ETHTOOL_A_BITSET_MASK, obj->mask, obj->_present.mask_len);
ynl_attr_nest_end(nlh, nest);

return 0;
Expand Down Expand Up @@ -1647,6 +1656,26 @@ int ethtool_bitset_parse(struct ynl_parse_arg *yarg,
parg.data = &dst->bits;
if (ethtool_bitset_bits_parse(&parg, attr))
return YNL_PARSE_CB_ERROR;
} else if (type == ETHTOOL_A_BITSET_VALUE) {
unsigned int len;

if (ynl_attr_validate(yarg, attr))
return YNL_PARSE_CB_ERROR;

len = ynl_attr_data_len(attr);
dst->_present.value_len = len;
dst->value = malloc(len);
memcpy(dst->value, ynl_attr_data(attr), len);
} else if (type == ETHTOOL_A_BITSET_MASK) {
unsigned int len;

if (ynl_attr_validate(yarg, attr))
return YNL_PARSE_CB_ERROR;

len = ynl_attr_data_len(attr);
dst->_present.mask_len = len;
dst->mask = malloc(len);
memcpy(dst->mask, ynl_attr_data(attr), len);
}
}

Expand Down Expand Up @@ -7038,6 +7067,17 @@ ethtool_phy_get_dump(struct ynl_sock *ys, struct ethtool_phy_get_req_dump *req)
return NULL;
}

/* ETHTOOL_MSG_PHY_GET - notify */
void ethtool_phy_get_ntf_free(struct ethtool_phy_get_ntf *rsp)
{
ethtool_header_free(&rsp->obj.header);
free(rsp->obj.drvname);
free(rsp->obj.name);
free(rsp->obj.upstream_sfp_name);
free(rsp->obj.downstream_sfp_name);
free(rsp);
}

/* ETHTOOL_MSG_CABLE_TEST_NTF - event */
int ethtool_cable_test_ntf_rsp_parse(const struct nlmsghdr *nlh,
struct ynl_parse_arg *yarg)
Expand Down Expand Up @@ -7299,6 +7339,12 @@ static const struct ynl_ntf_info ethtool_ntf_info[] = {
.policy = &ethtool_module_fw_flash_nest,
.free = (void *)ethtool_module_fw_flash_ntf_free,
},
[ETHTOOL_MSG_PHY_NTF] = {
.alloc_sz = sizeof(struct ethtool_phy_get_ntf),
.cb = ethtool_phy_get_rsp_parse,
.policy = &ethtool_phy_nest,
.free = (void *)ethtool_phy_get_ntf_free,
},
};

const struct ynl_family ynl_ethtool_family = {
Expand Down
43 changes: 43 additions & 0 deletions generated/netdev-user.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ static const char * const netdev_op_strmap[] = {
[NETDEV_CMD_NAPI_GET] = "napi-get",
[NETDEV_CMD_QSTATS_GET] = "qstats-get",
[NETDEV_CMD_BIND_RX] = "bind-rx",
[NETDEV_CMD_NAPI_SET] = "napi-set",
};

const char *netdev_op_str(int op)
Expand Down Expand Up @@ -192,6 +193,8 @@ const struct ynl_policy_attr netdev_napi_policy[NETDEV_A_NAPI_MAX + 1] = {
[NETDEV_A_NAPI_ID] = { .name = "id", .type = YNL_PT_U32, },
[NETDEV_A_NAPI_IRQ] = { .name = "irq", .type = YNL_PT_U32, },
[NETDEV_A_NAPI_PID] = { .name = "pid", .type = YNL_PT_U32, },
[NETDEV_A_NAPI_DEFER_HARD_IRQS] = { .name = "defer-hard-irqs", .type = YNL_PT_U32, },
[NETDEV_A_NAPI_GRO_FLUSH_TIMEOUT] = { .name = "gro-flush-timeout", .type = YNL_PT_UINT, },
};

const struct ynl_policy_nest netdev_napi_nest = {
Expand Down Expand Up @@ -940,6 +943,16 @@ int netdev_napi_get_rsp_parse(const struct nlmsghdr *nlh,
return YNL_PARSE_CB_ERROR;
dst->_present.pid = 1;
dst->pid = ynl_attr_get_u32(attr);
} else if (type == NETDEV_A_NAPI_DEFER_HARD_IRQS) {
if (ynl_attr_validate(yarg, attr))
return YNL_PARSE_CB_ERROR;
dst->_present.defer_hard_irqs = 1;
dst->defer_hard_irqs = ynl_attr_get_u32(attr);
} else if (type == NETDEV_A_NAPI_GRO_FLUSH_TIMEOUT) {
if (ynl_attr_validate(yarg, attr))
return YNL_PARSE_CB_ERROR;
dst->_present.gro_flush_timeout = 1;
dst->gro_flush_timeout = ynl_attr_get_uint(attr);
}
}

Expand Down Expand Up @@ -1205,6 +1218,36 @@ netdev_bind_rx(struct ynl_sock *ys, struct netdev_bind_rx_req *req)
return NULL;
}

/* ============== NETDEV_CMD_NAPI_SET ============== */
/* NETDEV_CMD_NAPI_SET - do */
void netdev_napi_set_req_free(struct netdev_napi_set_req *req)
{
free(req);
}

int netdev_napi_set(struct ynl_sock *ys, struct netdev_napi_set_req *req)
{
struct ynl_req_state yrs = { .yarg = { .ys = ys, }, };
struct nlmsghdr *nlh;
int err;

nlh = ynl_gemsg_start_req(ys, ys->family_id, NETDEV_CMD_NAPI_SET, 1);
ys->req_policy = &netdev_napi_nest;

if (req->_present.id)
ynl_attr_put_u32(nlh, NETDEV_A_NAPI_ID, req->id);
if (req->_present.defer_hard_irqs)
ynl_attr_put_u32(nlh, NETDEV_A_NAPI_DEFER_HARD_IRQS, req->defer_hard_irqs);
if (req->_present.gro_flush_timeout)
ynl_attr_put_uint(nlh, NETDEV_A_NAPI_GRO_FLUSH_TIMEOUT, req->gro_flush_timeout);

err = ynl_exec(ys, nlh, &yrs);
if (err < 0)
return -1;

return 0;
}

static const struct ynl_ntf_info netdev_ntf_info[] = {
[NETDEV_CMD_DEV_ADD_NTF] = {
.alloc_sz = sizeof(struct netdev_dev_get_ntf),
Expand Down
24 changes: 24 additions & 0 deletions include/linux/dpll.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,29 @@ enum dpll_lock_status_error {
DPLL_LOCK_STATUS_ERROR_MAX = (__DPLL_LOCK_STATUS_ERROR_MAX - 1)
};

/*
* level of quality of a clock device. This mainly applies when the dpll
* lock-status is DPLL_LOCK_STATUS_HOLDOVER. The current list is defined
* according to the table 11-7 contained in ITU-T G.8264/Y.1364 document. One
* may extend this list freely by other ITU-T defined clock qualities, or
* different ones defined by another standardization body (for those, please
* use different prefix).
*/
enum dpll_clock_quality_level {
DPLL_CLOCK_QUALITY_LEVEL_ITU_OPT1_PRC = 1,
DPLL_CLOCK_QUALITY_LEVEL_ITU_OPT1_SSU_A,
DPLL_CLOCK_QUALITY_LEVEL_ITU_OPT1_SSU_B,
DPLL_CLOCK_QUALITY_LEVEL_ITU_OPT1_EEC1,
DPLL_CLOCK_QUALITY_LEVEL_ITU_OPT1_PRTC,
DPLL_CLOCK_QUALITY_LEVEL_ITU_OPT1_EPRTC,
DPLL_CLOCK_QUALITY_LEVEL_ITU_OPT1_EEEC,
DPLL_CLOCK_QUALITY_LEVEL_ITU_OPT1_EPRC,

/* private: */
__DPLL_CLOCK_QUALITY_LEVEL_MAX,
DPLL_CLOCK_QUALITY_LEVEL_MAX = (__DPLL_CLOCK_QUALITY_LEVEL_MAX - 1)
};

#define DPLL_TEMP_DIVIDER 1000

/**
Expand Down Expand Up @@ -180,6 +203,7 @@ enum dpll_a {
DPLL_A_TEMP,
DPLL_A_TYPE,
DPLL_A_LOCK_STATUS_ERROR,
DPLL_A_CLOCK_QUALITY_LEVEL,

__DPLL_A_MAX,
DPLL_A_MAX = (__DPLL_A_MAX - 1)
Expand Down
33 changes: 18 additions & 15 deletions include/linux/ethtool.h
Original file line number Diff line number Diff line change
Expand Up @@ -2511,21 +2511,24 @@ enum ethtool_reset_flags {
* autonegotiation; 0 if unknown or not applicable. Read-only.
*/
struct ethtool_link_settings {
__u32 cmd;
__u32 speed;
__u8 duplex;
__u8 port;
__u8 phy_address;
__u8 autoneg;
__u8 mdio_support;
__u8 eth_tp_mdix;
__u8 eth_tp_mdix_ctrl;
__s8 link_mode_masks_nwords;
__u8 transceiver;
__u8 master_slave_cfg;
__u8 master_slave_state;
__u8 rate_matching;
__u32 reserved[7];
/* New members MUST be added within the __struct_group() macro below. */
__struct_group(ethtool_link_settings_hdr, hdr, /* no attrs */,
__u32 cmd;
__u32 speed;
__u8 duplex;
__u8 port;
__u8 phy_address;
__u8 autoneg;
__u8 mdio_support;
__u8 eth_tp_mdix;
__u8 eth_tp_mdix_ctrl;
__s8 link_mode_masks_nwords;
__u8 transceiver;
__u8 master_slave_cfg;
__u8 master_slave_state;
__u8 rate_matching;
__u32 reserved[7];
);
__u32 link_mode_masks[];
/* layout of link_mode_masks fields:
* __u32 map_supported[link_mode_masks_nwords];
Expand Down
3 changes: 3 additions & 0 deletions include/linux/netdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ enum {
NETDEV_A_NAPI_ID,
NETDEV_A_NAPI_IRQ,
NETDEV_A_NAPI_PID,
NETDEV_A_NAPI_DEFER_HARD_IRQS,
NETDEV_A_NAPI_GRO_FLUSH_TIMEOUT,

__NETDEV_A_NAPI_MAX,
NETDEV_A_NAPI_MAX = (__NETDEV_A_NAPI_MAX - 1)
Expand Down Expand Up @@ -199,6 +201,7 @@ enum {
NETDEV_CMD_NAPI_GET,
NETDEV_CMD_QSTATS_GET,
NETDEV_CMD_BIND_RX,
NETDEV_CMD_NAPI_SET,

__NETDEV_CMD_MAX,
NETDEV_CMD_MAX = (__NETDEV_CMD_MAX - 1)
Expand Down
1 change: 1 addition & 0 deletions include/ynl-c/dpll.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const char *dpll_op_str(int op);
const char *dpll_mode_str(enum dpll_mode value);
const char *dpll_lock_status_str(enum dpll_lock_status value);
const char *dpll_lock_status_error_str(enum dpll_lock_status_error value);
const char *dpll_clock_quality_level_str(enum dpll_clock_quality_level value);
const char *dpll_type_str(enum dpll_type value);
const char *dpll_pin_type_str(enum dpll_pin_type value);
const char *dpll_pin_direction_str(enum dpll_pin_direction value);
Expand Down
Loading

0 comments on commit 4b04836

Please sign in to comment.