mirror of
https://github.com/torvalds/linux.git
synced 2026-05-05 23:05:25 -04:00
The introduction of IPPROTO_SMC enables eBPF programs to determine whether to use SMC based on the context of socket creation, such as network namespaces, PID and comm name, etc. As a subsequent enhancement, to introduce a new generic hook that allows decisions on whether to use SMC or not at runtime, including but not limited to local/remote IP address or ports. User can write their own implememtion via bpf_struct_ops now to choose whether to use SMC or not before TCP 3rd handshake to be comleted. Signed-off-by: D. Wythe <alibuda@linux.alibaba.com> Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org> Reviewed-by: Dust Li <dust.li@linux.alibaba.com> Link: https://patch.msgid.link/20251107035632.115950-3-alibuda@linux.alibaba.com
32 lines
819 B
C
32 lines
819 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Shared Memory Communications over RDMA (SMC-R) and RoCE
|
|
*
|
|
* Generic hook for SMC handshake flow.
|
|
*
|
|
* Copyright IBM Corp. 2016
|
|
* Copyright (c) 2025, Alibaba Inc.
|
|
*
|
|
* Author: D. Wythe <alibuda@linux.alibaba.com>
|
|
*/
|
|
|
|
#ifndef __SMC_HS_CTRL
|
|
#define __SMC_HS_CTRL
|
|
|
|
#include <net/smc.h>
|
|
|
|
/* Find hs_ctrl by the target name, which required to be a c-string.
|
|
* Return NULL if no such ctrl was found,otherwise, return a valid ctrl.
|
|
*
|
|
* Note: Caller MUST ensure it's was invoked under rcu_read_lock.
|
|
*/
|
|
struct smc_hs_ctrl *smc_hs_ctrl_find_by_name(const char *name);
|
|
|
|
#if IS_ENABLED(CONFIG_SMC_HS_CTRL_BPF)
|
|
int bpf_smc_hs_ctrl_init(void);
|
|
#else
|
|
static inline int bpf_smc_hs_ctrl_init(void) { return 0; }
|
|
#endif /* CONFIG_SMC_HS_CTRL_BPF */
|
|
|
|
#endif /* __SMC_HS_CTRL */
|