diff --git a/home/nipa/nipa_out/921859/ynl/old-code/netdev-user.c b/home/nipa/nipa_out/921859/ynl/new-code/netdev-user.c index 1d3877ce20bb..afcb264b716c 100644 --- a/home/nipa/nipa_out/921859/ynl/old-code/netdev-user.c +++ b/home/nipa/nipa_out/921859/ynl/new-code/netdev-user.c @@ -27,6 +27,7 @@ static const char * const netdev_op_strmap[] = { [NETDEV_CMD_QSTATS_GET] = "qstats-get", [NETDEV_CMD_BIND_RX] = "bind-rx", [NETDEV_CMD_NAPI_SET] = "napi-set", + [NETDEV_CMD_NAPI_SET_THREADED] = "napi-set-threaded", }; const char *netdev_op_str(int op) @@ -196,6 +197,7 @@ const struct ynl_policy_attr netdev_napi_policy[NETDEV_A_NAPI_MAX + 1] = { [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, }, [NETDEV_A_NAPI_IRQ_SUSPEND_TIMEOUT] = { .name = "irq-suspend-timeout", .type = YNL_PT_UINT, }, + [NETDEV_A_NAPI_THREADED] = { .name = "threaded", .type = YNL_PT_U32, }, }; const struct ynl_policy_nest netdev_napi_nest = { @@ -959,6 +961,11 @@ int netdev_napi_get_rsp_parse(const struct nlmsghdr *nlh, return YNL_PARSE_CB_ERROR; dst->_present.irq_suspend_timeout = 1; dst->irq_suspend_timeout = ynl_attr_get_uint(attr); + } else if (type == NETDEV_A_NAPI_THREADED) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.threaded = 1; + dst->threaded = ynl_attr_get_u32(attr); } } @@ -1256,6 +1263,36 @@ int netdev_napi_set(struct ynl_sock *ys, struct netdev_napi_set_req *req) return 0; } +/* ============== NETDEV_CMD_NAPI_SET_THREADED ============== */ +/* NETDEV_CMD_NAPI_SET_THREADED - do */ +void +netdev_napi_set_threaded_req_free(struct netdev_napi_set_threaded_req *req) +{ + free(req); +} + +int netdev_napi_set_threaded(struct ynl_sock *ys, + struct netdev_napi_set_threaded_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_THREADED, 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.threaded) + ynl_attr_put_u32(nlh, NETDEV_A_NAPI_THREADED, req->threaded); + + 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/home/nipa/nipa_out/921859/ynl/old-code/netdev-user.h b/home/nipa/nipa_out/921859/ynl/new-code/netdev-user.h index bc103e532cb3..ba3c44bfd85d 100644 --- a/home/nipa/nipa_out/921859/ynl/old-code/netdev-user.h +++ b/home/nipa/nipa_out/921859/ynl/new-code/netdev-user.h @@ -407,6 +407,7 @@ struct netdev_napi_get_rsp { __u32 defer_hard_irqs:1; __u32 gro_flush_timeout:1; __u32 irq_suspend_timeout:1; + __u32 threaded:1; } _present; __u32 id; @@ -416,6 +417,7 @@ struct netdev_napi_get_rsp { __u32 defer_hard_irqs; __u64 gro_flush_timeout; __u64 irq_suspend_timeout; + __u32 threaded; }; void netdev_napi_get_rsp_free(struct netdev_napi_get_rsp *rsp); @@ -638,4 +640,45 @@ netdev_napi_set_req_set_irq_suspend_timeout(struct netdev_napi_set_req *req, */ int netdev_napi_set(struct ynl_sock *ys, struct netdev_napi_set_req *req); +/* ============== NETDEV_CMD_NAPI_SET_THREADED ============== */ +/* NETDEV_CMD_NAPI_SET_THREADED - do */ +struct netdev_napi_set_threaded_req { + struct { + __u32 id:1; + __u32 threaded:1; + } _present; + + __u32 id; + __u32 threaded; +}; + +static inline struct netdev_napi_set_threaded_req * +netdev_napi_set_threaded_req_alloc(void) +{ + return calloc(1, sizeof(struct netdev_napi_set_threaded_req)); +} +void +netdev_napi_set_threaded_req_free(struct netdev_napi_set_threaded_req *req); + +static inline void +netdev_napi_set_threaded_req_set_id(struct netdev_napi_set_threaded_req *req, + __u32 id) +{ + req->_present.id = 1; + req->id = id; +} +static inline void +netdev_napi_set_threaded_req_set_threaded(struct netdev_napi_set_threaded_req *req, + __u32 threaded) +{ + req->_present.threaded = 1; + req->threaded = threaded; +} + +/* + * Set threaded napi mode on this napi. + */ +int netdev_napi_set_threaded(struct ynl_sock *ys, + struct netdev_napi_set_threaded_req *req); + #endif /* _LINUX_NETDEV_GEN_H */