On 24/09/2023 17:16, Wen Gu wrote:
This patch reserve CHID range from 0xFF00 to 0xFFFF for SMC-D virtual
The current state is that 0xFF00 - 0xFFFF is the range of all virtual
SMC-D devices. This range devides into:
- 0xFF00 - 0xFFFE is for virto-ism
- 0xFFFF is for loopback
device and introduces helpers to identify them.
Signed-off-by: Wen Gu <guwen@xxxxxxxxxxxxxxxxx>
---
net/smc/smc_ism.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/net/smc/smc_ism.h b/net/smc/smc_ism.h
index 14d2e77..2ecc8de 100644
--- a/net/smc/smc_ism.h
+++ b/net/smc/smc_ism.h
@@ -15,6 +15,9 @@
#include "smc.h"
+#define SMC_VIRT_ISM_CHID_MAX 0xFFFF
SMC_VIRT_ISM_MAX is 0xFFFE. Or do you mean virtual devices as the whole
group. If yes i think that this naming will be very confusing in a few
months/years.
Maybe something like SMC_VIRTUAL_DEV_CHID_{MIN|MAX}?
+#define SMC_VIRT_ISM_CHID_MIN 0xFF00
+
struct smcd_dev_list { /* List of SMCD devices */
struct list_head list;
struct mutex mutex; /* Protects list of devices */
@@ -57,4 +60,16 @@ static inline int smc_ism_write(struct smcd_dev *smcd, u64 dmb_tok,
return rc < 0 ? rc : 0;
}
+static inline bool __smc_ism_is_virtdev(u16 chid)
+{
+ return (chid >= SMC_VIRT_ISM_CHID_MIN && chid <= SMC_VIRT_ISM_CHID_MAX);
+}
+
+static inline bool smc_ism_is_virtdev(struct smcd_dev *smcd)
+{
+ u16 chid = smcd->ops->get_chid(smcd);
+
+ return __smc_ism_is_virtdev(chid);
+}
+
#endif