Re: [PATCH bpf-next v3 3/5] net/smc: bpf: register smc_ops info struct_ops

D. Wythe
2025-01-03T06:54:18Z

On Thu, Dec 26, 2024 at 08:44:20PM +0100, Zhu Yanjun wrote:
> 在 2024/12/18 3:44, D. Wythe 写道:
> >To implement injection capability for smc via struct_ops, so that
> >user can make their own smc_ops to modify the behavior of smc stack.
> >
> >Currently, user can write their own implememtion to choose whether to
> >use SMC or not before TCP 3rd handshake to be comleted. In the future,
> >users can implement more complex functions on smc by expanding it.
> >
> >Signed-off-by: D. Wythe <alibuda@linux.alibaba.com>
> >---
> > net/smc/af_smc.c | 10 +++++
> > net/smc/smc_ops.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++
> > net/smc/smc_ops.h | 2 +
> > 3 files changed, 111 insertions(+)
> >
> >diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
> >index 9d76e902fd77..6adedae2986d 100644
> >--- a/net/smc/af_smc.c
> >+++ b/net/smc/af_smc.c
> >@@ -55,6 +55,7 @@
> > #include "smc_sysctl.h"
> > #include "smc_loopback.h"
> > #include "smc_inet.h"
> >+static struct bpf_struct_ops bpf_smc_bpf_ops = {
> > #else
> > static inline struct smc_ops *smc_ops_find_by_name(const char *name) { return NULL; }
> >+static inline int smc_bpf_struct_ops_init(void) { return 0; }
>
> Both smc_ops_find_by_name and smc_bpf_struct_ops_init seem to be
> dead codes. Enabling/Disabling CONFIG_SMC_OPS, the above 2 inline
> functions will not be called. The 2 functions should be removed.
>
> Zhu Yanjun
>

Good catch. I will fix this in the next version.

Thanks,
D. Wythe

> > #endif /* CONFIG_SMC_OPS*/
> > #endif /* __SMC_OPS */