diff --git a/generated/dpll-user.c b/generated/dpll-user.c index 89d239c..cdc58aa 100644 --- a/generated/dpll-user.c +++ b/generated/dpll-user.c @@ -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", @@ -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 = { diff --git a/generated/ethtool-user.c b/generated/ethtool-user.c index 9007305..92fe355 100644 --- a/generated/ethtool-user.c +++ b/generated/ethtool-user.c @@ -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) @@ -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 = ðtool_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 = { @@ -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, @@ -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; @@ -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); } } @@ -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) @@ -7299,6 +7339,12 @@ static const struct ynl_ntf_info ethtool_ntf_info[] = { .policy = ðtool_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 = ðtool_phy_nest, + .free = (void *)ethtool_phy_get_ntf_free, + }, }; const struct ynl_family ynl_ethtool_family = { diff --git a/generated/netdev-user.c b/generated/netdev-user.c index eb5aa32..81af84a 100644 --- a/generated/netdev-user.c +++ b/generated/netdev-user.c @@ -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) @@ -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 = { @@ -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); } } @@ -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), diff --git a/include/linux/dpll.h b/include/linux/dpll.h index b0654ad..bf97d4b 100644 --- a/include/linux/dpll.h +++ b/include/linux/dpll.h @@ -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 /** @@ -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) diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index c405ed6..fc1f54b 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -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]; diff --git a/include/linux/netdev.h b/include/linux/netdev.h index 7c308f0..e3ebb49 100644 --- a/include/linux/netdev.h +++ b/include/linux/netdev.h @@ -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) @@ -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) diff --git a/include/ynl-c/dpll.h b/include/ynl-c/dpll.h index 4dd7ba9..e94cc10 100644 --- a/include/ynl-c/dpll.h +++ b/include/ynl-c/dpll.h @@ -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); diff --git a/include/ynl-c/ethtool.h b/include/ynl-c/ethtool.h index 8cdc5a3..bde5d77 100644 --- a/include/ynl-c/ethtool.h +++ b/include/ynl-c/ethtool.h @@ -214,10 +214,14 @@ struct ethtool_bitset { __u32 nomask:1; __u32 size:1; __u32 bits:1; + __u32 value_len; + __u32 mask_len; } _present; __u32 size; struct ethtool_bitset_bits bits; + void *value; + void *mask; }; struct ethtool_stringset_ { @@ -950,6 +954,26 @@ __ethtool_linkmodes_set_req_set_ours_bits_bit(struct ethtool_linkmodes_set_req * req->ours.bits.n_bit = n_bit; } static inline void +ethtool_linkmodes_set_req_set_ours_value(struct ethtool_linkmodes_set_req *req, + const void *value, size_t len) +{ + req->_present.ours = 1; + free(req->ours.value); + req->ours._present.value_len = len; + req->ours.value = malloc(req->ours._present.value_len); + memcpy(req->ours.value, value, req->ours._present.value_len); +} +static inline void +ethtool_linkmodes_set_req_set_ours_mask(struct ethtool_linkmodes_set_req *req, + const void *mask, size_t len) +{ + req->_present.ours = 1; + free(req->ours.mask); + req->ours._present.mask_len = len; + req->ours.mask = malloc(req->ours._present.mask_len); + memcpy(req->ours.mask, mask, req->ours._present.mask_len); +} +static inline void ethtool_linkmodes_set_req_set_peer_nomask(struct ethtool_linkmodes_set_req *req) { req->_present.peer = 1; @@ -975,6 +999,26 @@ __ethtool_linkmodes_set_req_set_peer_bits_bit(struct ethtool_linkmodes_set_req * req->peer.bits.n_bit = n_bit; } static inline void +ethtool_linkmodes_set_req_set_peer_value(struct ethtool_linkmodes_set_req *req, + const void *value, size_t len) +{ + req->_present.peer = 1; + free(req->peer.value); + req->peer._present.value_len = len; + req->peer.value = malloc(req->peer._present.value_len); + memcpy(req->peer.value, value, req->peer._present.value_len); +} +static inline void +ethtool_linkmodes_set_req_set_peer_mask(struct ethtool_linkmodes_set_req *req, + const void *mask, size_t len) +{ + req->_present.peer = 1; + free(req->peer.mask); + req->peer._present.mask_len = len; + req->peer.mask = malloc(req->peer._present.mask_len); + memcpy(req->peer.mask, mask, req->peer._present.mask_len); +} +static inline void ethtool_linkmodes_set_req_set_speed(struct ethtool_linkmodes_set_req *req, __u32 speed) { @@ -1391,6 +1435,26 @@ __ethtool_debug_set_req_set_msgmask_bits_bit(struct ethtool_debug_set_req *req, req->msgmask.bits.bit = bit; req->msgmask.bits.n_bit = n_bit; } +static inline void +ethtool_debug_set_req_set_msgmask_value(struct ethtool_debug_set_req *req, + const void *value, size_t len) +{ + req->_present.msgmask = 1; + free(req->msgmask.value); + req->msgmask._present.value_len = len; + req->msgmask.value = malloc(req->msgmask._present.value_len); + memcpy(req->msgmask.value, value, req->msgmask._present.value_len); +} +static inline void +ethtool_debug_set_req_set_msgmask_mask(struct ethtool_debug_set_req *req, + const void *mask, size_t len) +{ + req->_present.msgmask = 1; + free(req->msgmask.mask); + req->msgmask._present.mask_len = len; + req->msgmask.mask = malloc(req->msgmask._present.mask_len); + memcpy(req->msgmask.mask, mask, req->msgmask._present.mask_len); +} /* * Set debug message mask. @@ -1622,6 +1686,26 @@ __ethtool_wol_set_req_set_modes_bits_bit(struct ethtool_wol_set_req *req, req->modes.bits.n_bit = n_bit; } static inline void +ethtool_wol_set_req_set_modes_value(struct ethtool_wol_set_req *req, + const void *value, size_t len) +{ + req->_present.modes = 1; + free(req->modes.value); + req->modes._present.value_len = len; + req->modes.value = malloc(req->modes._present.value_len); + memcpy(req->modes.value, value, req->modes._present.value_len); +} +static inline void +ethtool_wol_set_req_set_modes_mask(struct ethtool_wol_set_req *req, + const void *mask, size_t len) +{ + req->_present.modes = 1; + free(req->modes.mask); + req->modes._present.mask_len = len; + req->modes.mask = malloc(req->modes._present.mask_len); + memcpy(req->modes.mask, mask, req->modes._present.mask_len); +} +static inline void ethtool_wol_set_req_set_sopass(struct ethtool_wol_set_req *req, const void *sopass, size_t len) { @@ -1874,6 +1958,26 @@ __ethtool_features_set_req_set_hw_bits_bit(struct ethtool_features_set_req *req, req->hw.bits.n_bit = n_bit; } static inline void +ethtool_features_set_req_set_hw_value(struct ethtool_features_set_req *req, + const void *value, size_t len) +{ + req->_present.hw = 1; + free(req->hw.value); + req->hw._present.value_len = len; + req->hw.value = malloc(req->hw._present.value_len); + memcpy(req->hw.value, value, req->hw._present.value_len); +} +static inline void +ethtool_features_set_req_set_hw_mask(struct ethtool_features_set_req *req, + const void *mask, size_t len) +{ + req->_present.hw = 1; + free(req->hw.mask); + req->hw._present.mask_len = len; + req->hw.mask = malloc(req->hw._present.mask_len); + memcpy(req->hw.mask, mask, req->hw._present.mask_len); +} +static inline void ethtool_features_set_req_set_wanted_nomask(struct ethtool_features_set_req *req) { req->_present.wanted = 1; @@ -1899,6 +2003,26 @@ __ethtool_features_set_req_set_wanted_bits_bit(struct ethtool_features_set_req * req->wanted.bits.n_bit = n_bit; } static inline void +ethtool_features_set_req_set_wanted_value(struct ethtool_features_set_req *req, + const void *value, size_t len) +{ + req->_present.wanted = 1; + free(req->wanted.value); + req->wanted._present.value_len = len; + req->wanted.value = malloc(req->wanted._present.value_len); + memcpy(req->wanted.value, value, req->wanted._present.value_len); +} +static inline void +ethtool_features_set_req_set_wanted_mask(struct ethtool_features_set_req *req, + const void *mask, size_t len) +{ + req->_present.wanted = 1; + free(req->wanted.mask); + req->wanted._present.mask_len = len; + req->wanted.mask = malloc(req->wanted._present.mask_len); + memcpy(req->wanted.mask, mask, req->wanted._present.mask_len); +} +static inline void ethtool_features_set_req_set_active_nomask(struct ethtool_features_set_req *req) { req->_present.active = 1; @@ -1924,6 +2048,26 @@ __ethtool_features_set_req_set_active_bits_bit(struct ethtool_features_set_req * req->active.bits.n_bit = n_bit; } static inline void +ethtool_features_set_req_set_active_value(struct ethtool_features_set_req *req, + const void *value, size_t len) +{ + req->_present.active = 1; + free(req->active.value); + req->active._present.value_len = len; + req->active.value = malloc(req->active._present.value_len); + memcpy(req->active.value, value, req->active._present.value_len); +} +static inline void +ethtool_features_set_req_set_active_mask(struct ethtool_features_set_req *req, + const void *mask, size_t len) +{ + req->_present.active = 1; + free(req->active.mask); + req->active._present.mask_len = len; + req->active.mask = malloc(req->active._present.mask_len); + memcpy(req->active.mask, mask, req->active._present.mask_len); +} +static inline void ethtool_features_set_req_set_nochange_nomask(struct ethtool_features_set_req *req) { req->_present.nochange = 1; @@ -1948,6 +2092,26 @@ __ethtool_features_set_req_set_nochange_bits_bit(struct ethtool_features_set_req req->nochange.bits.bit = bit; req->nochange.bits.n_bit = n_bit; } +static inline void +ethtool_features_set_req_set_nochange_value(struct ethtool_features_set_req *req, + const void *value, size_t len) +{ + req->_present.nochange = 1; + free(req->nochange.value); + req->nochange._present.value_len = len; + req->nochange.value = malloc(req->nochange._present.value_len); + memcpy(req->nochange.value, value, req->nochange._present.value_len); +} +static inline void +ethtool_features_set_req_set_nochange_mask(struct ethtool_features_set_req *req, + const void *mask, size_t len) +{ + req->_present.nochange = 1; + free(req->nochange.mask); + req->nochange._present.mask_len = len; + req->nochange.mask = malloc(req->nochange._present.mask_len); + memcpy(req->nochange.mask, mask, req->nochange._present.mask_len); +} struct ethtool_features_set_rsp { struct { @@ -2199,6 +2363,26 @@ __ethtool_privflags_set_req_set_flags_bits_bit(struct ethtool_privflags_set_req req->flags.bits.bit = bit; req->flags.bits.n_bit = n_bit; } +static inline void +ethtool_privflags_set_req_set_flags_value(struct ethtool_privflags_set_req *req, + const void *value, size_t len) +{ + req->_present.flags = 1; + free(req->flags.value); + req->flags._present.value_len = len; + req->flags.value = malloc(req->flags._present.value_len); + memcpy(req->flags.value, value, req->flags._present.value_len); +} +static inline void +ethtool_privflags_set_req_set_flags_mask(struct ethtool_privflags_set_req *req, + const void *mask, size_t len) +{ + req->_present.flags = 1; + free(req->flags.mask); + req->flags._present.mask_len = len; + req->flags.mask = malloc(req->flags._present.mask_len); + memcpy(req->flags.mask, mask, req->flags._present.mask_len); +} /* * Set device private flags. @@ -3890,6 +4074,26 @@ __ethtool_eee_set_req_set_modes_ours_bits_bit(struct ethtool_eee_set_req *req, req->modes_ours.bits.n_bit = n_bit; } static inline void +ethtool_eee_set_req_set_modes_ours_value(struct ethtool_eee_set_req *req, + const void *value, size_t len) +{ + req->_present.modes_ours = 1; + free(req->modes_ours.value); + req->modes_ours._present.value_len = len; + req->modes_ours.value = malloc(req->modes_ours._present.value_len); + memcpy(req->modes_ours.value, value, req->modes_ours._present.value_len); +} +static inline void +ethtool_eee_set_req_set_modes_ours_mask(struct ethtool_eee_set_req *req, + const void *mask, size_t len) +{ + req->_present.modes_ours = 1; + free(req->modes_ours.mask); + req->modes_ours._present.mask_len = len; + req->modes_ours.mask = malloc(req->modes_ours._present.mask_len); + memcpy(req->modes_ours.mask, mask, req->modes_ours._present.mask_len); +} +static inline void ethtool_eee_set_req_set_modes_peer_nomask(struct ethtool_eee_set_req *req) { req->_present.modes_peer = 1; @@ -3915,6 +4119,26 @@ __ethtool_eee_set_req_set_modes_peer_bits_bit(struct ethtool_eee_set_req *req, req->modes_peer.bits.n_bit = n_bit; } static inline void +ethtool_eee_set_req_set_modes_peer_value(struct ethtool_eee_set_req *req, + const void *value, size_t len) +{ + req->_present.modes_peer = 1; + free(req->modes_peer.value); + req->modes_peer._present.value_len = len; + req->modes_peer.value = malloc(req->modes_peer._present.value_len); + memcpy(req->modes_peer.value, value, req->modes_peer._present.value_len); +} +static inline void +ethtool_eee_set_req_set_modes_peer_mask(struct ethtool_eee_set_req *req, + const void *mask, size_t len) +{ + req->_present.modes_peer = 1; + free(req->modes_peer.mask); + req->modes_peer._present.mask_len = len; + req->modes_peer.mask = malloc(req->modes_peer._present.mask_len); + memcpy(req->modes_peer.mask, mask, req->modes_peer._present.mask_len); +} +static inline void ethtool_eee_set_req_set_active(struct ethtool_eee_set_req *req, __u8 active) { req->_present.active = 1; @@ -4576,6 +4800,26 @@ __ethtool_fec_set_req_set_modes_bits_bit(struct ethtool_fec_set_req *req, req->modes.bits.n_bit = n_bit; } static inline void +ethtool_fec_set_req_set_modes_value(struct ethtool_fec_set_req *req, + const void *value, size_t len) +{ + req->_present.modes = 1; + free(req->modes.value); + req->modes._present.value_len = len; + req->modes.value = malloc(req->modes._present.value_len); + memcpy(req->modes.value, value, req->modes._present.value_len); +} +static inline void +ethtool_fec_set_req_set_modes_mask(struct ethtool_fec_set_req *req, + const void *mask, size_t len) +{ + req->_present.modes = 1; + free(req->modes.mask); + req->modes._present.mask_len = len; + req->modes.mask = malloc(req->modes._present.mask_len); + memcpy(req->modes.mask, mask, req->modes._present.mask_len); +} +static inline void ethtool_fec_set_req_set_auto_(struct ethtool_fec_set_req *req, __u8 auto_) { req->_present.auto_ = 1; @@ -6453,6 +6697,17 @@ void ethtool_phy_get_list_free(struct ethtool_phy_get_list *rsp); struct ethtool_phy_get_list * ethtool_phy_get_dump(struct ynl_sock *ys, struct ethtool_phy_get_req_dump *req); +/* ETHTOOL_MSG_PHY_GET - notify */ +struct ethtool_phy_get_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct ethtool_phy_get_ntf *ntf); + struct ethtool_phy_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_phy_get_ntf_free(struct ethtool_phy_get_ntf *rsp); + /* ETHTOOL_MSG_CABLE_TEST_NTF - event */ struct ethtool_cable_test_ntf_rsp { struct { diff --git a/include/ynl-c/netdev.h b/include/ynl-c/netdev.h index a407e22..747b774 100644 --- a/include/ynl-c/netdev.h +++ b/include/ynl-c/netdev.h @@ -404,12 +404,16 @@ struct netdev_napi_get_rsp { __u32 ifindex:1; __u32 irq:1; __u32 pid:1; + __u32 defer_hard_irqs:1; + __u32 gro_flush_timeout:1; } _present; __u32 id; __u32 ifindex; __u32 irq; __u32 pid; + __u32 defer_hard_irqs; + __u64 gro_flush_timeout; }; void netdev_napi_get_rsp_free(struct netdev_napi_get_rsp *rsp); @@ -577,4 +581,50 @@ void netdev_bind_rx_rsp_free(struct netdev_bind_rx_rsp *rsp); struct netdev_bind_rx_rsp * netdev_bind_rx(struct ynl_sock *ys, struct netdev_bind_rx_req *req); +/* ============== NETDEV_CMD_NAPI_SET ============== */ +/* NETDEV_CMD_NAPI_SET - do */ +struct netdev_napi_set_req { + struct { + __u32 id:1; + __u32 defer_hard_irqs:1; + __u32 gro_flush_timeout:1; + } _present; + + __u32 id; + __u32 defer_hard_irqs; + __u64 gro_flush_timeout; +}; + +static inline struct netdev_napi_set_req *netdev_napi_set_req_alloc(void) +{ + return calloc(1, sizeof(struct netdev_napi_set_req)); +} +void netdev_napi_set_req_free(struct netdev_napi_set_req *req); + +static inline void +netdev_napi_set_req_set_id(struct netdev_napi_set_req *req, __u32 id) +{ + req->_present.id = 1; + req->id = id; +} +static inline void +netdev_napi_set_req_set_defer_hard_irqs(struct netdev_napi_set_req *req, + __u32 defer_hard_irqs) +{ + req->_present.defer_hard_irqs = 1; + req->defer_hard_irqs = defer_hard_irqs; +} +static inline void +netdev_napi_set_req_set_gro_flush_timeout(struct netdev_napi_set_req *req, + __u64 gro_flush_timeout) +{ + req->_present.gro_flush_timeout = 1; + req->gro_flush_timeout = gro_flush_timeout; +} + +/* + * Set configurable NAPI instance settings. + */ +int netdev_napi_set(struct ynl_sock *ys, struct netdev_napi_set_req *req); + #endif /* _LINUX_NETDEV_GEN_H */