mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 04:04:43 +01:00
Define a uuid_t GID attribute to identify a dibs device. SMC uses 64 Bit and 128 Bit Global Identifiers (GIDs) per device, that need to be sent via the SMC protocol. Because the smc code uses integers, network endianness and host endianness need to be considered. Avoid this in the dibs layer by using uuid_t byte arrays. Future patches could change SMC to use uuid_t. For now conversion helper functions are introduced. ISM devices provide 64 Bit GIDs. Map them to dibs uuid_t GIDs like this: _________________________________________ | 64 Bit ISM-vPCI GID | 00000000_00000000 | ----------------------------------------- If interpreted as UUID [1], this would be interpreted as the UIID variant, that is reserved for NCS backward compatibility. So it will not collide with UUIDs that were generated according to the standard. smc_loopback already uses version 4 UUIDs as 128 Bit GIDs, move that to dibs loopback. A temporary change to smc_lo_query_rgid() is required, that will be moved to dibs_loopback with a follow-on patch. Provide gid of a dibs device as sysfs read-only attribute. Link: https://datatracker.ietf.org/doc/html/rfc4122 [1] Signed-off-by: Alexandra Winter <wintera@linux.ibm.com> Reviewed-by: Julian Ruess <julianr@linux.ibm.com> Reviewed-by: Mahanta Jambigi <mjambigi@linux.ibm.com> Link: https://patch.msgid.link/20250918110500.1731261-11-wintera@linux.ibm.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
97 lines
2.3 KiB
C
97 lines
2.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Shared Memory Communications over RDMA (SMC-R) and RoCE
|
|
*
|
|
* Definitions for the SMC module (socket related)
|
|
*
|
|
* Copyright IBM Corp. 2016
|
|
*
|
|
* Author(s): Ursula Braun <ubraun@linux.vnet.ibm.com>
|
|
*/
|
|
#ifndef _SMC_H
|
|
#define _SMC_H
|
|
|
|
#include <linux/device.h>
|
|
#include <linux/spinlock.h>
|
|
#include <linux/types.h>
|
|
#include <linux/wait.h>
|
|
#include <linux/dibs.h>
|
|
#include "linux/ism.h"
|
|
|
|
struct sock;
|
|
|
|
#define SMC_MAX_PNETID_LEN 16 /* Max. length of PNET id */
|
|
|
|
struct smc_hashinfo {
|
|
rwlock_t lock;
|
|
struct hlist_head ht;
|
|
};
|
|
|
|
/* SMCD/ISM device driver interface */
|
|
struct smcd_dmb {
|
|
u64 dmb_tok;
|
|
u64 rgid;
|
|
u32 dmb_len;
|
|
u32 sba_idx;
|
|
u32 vlan_valid;
|
|
u32 vlan_id;
|
|
void *cpu_addr;
|
|
dma_addr_t dma_addr;
|
|
};
|
|
|
|
#define ISM_EVENT_DMB 0
|
|
#define ISM_EVENT_GID 1
|
|
#define ISM_EVENT_SWR 2
|
|
|
|
#define ISM_RESERVED_VLANID 0x1FFF
|
|
|
|
struct smcd_dev;
|
|
|
|
struct smcd_gid {
|
|
u64 gid;
|
|
u64 gid_ext;
|
|
};
|
|
|
|
struct smcd_ops {
|
|
int (*query_remote_gid)(struct smcd_dev *dev, struct smcd_gid *rgid,
|
|
u32 vid_valid, u32 vid);
|
|
int (*register_dmb)(struct smcd_dev *dev, struct smcd_dmb *dmb,
|
|
void *client);
|
|
int (*unregister_dmb)(struct smcd_dev *dev, struct smcd_dmb *dmb);
|
|
int (*move_data)(struct smcd_dev *dev, u64 dmb_tok, unsigned int idx,
|
|
bool sf, unsigned int offset, void *data,
|
|
unsigned int size);
|
|
int (*supports_v2)(void);
|
|
|
|
/* optional operations */
|
|
int (*add_vlan_id)(struct smcd_dev *dev, u64 vlan_id);
|
|
int (*del_vlan_id)(struct smcd_dev *dev, u64 vlan_id);
|
|
int (*set_vlan_required)(struct smcd_dev *dev);
|
|
int (*reset_vlan_required)(struct smcd_dev *dev);
|
|
int (*signal_event)(struct smcd_dev *dev, struct smcd_gid *rgid,
|
|
u32 trigger_irq, u32 event_code, u64 info);
|
|
int (*support_dmb_nocopy)(struct smcd_dev *dev);
|
|
int (*attach_dmb)(struct smcd_dev *dev, struct smcd_dmb *dmb);
|
|
int (*detach_dmb)(struct smcd_dev *dev, u64 token);
|
|
};
|
|
|
|
struct smcd_dev {
|
|
const struct smcd_ops *ops;
|
|
void *priv;
|
|
void *client;
|
|
struct dibs_dev *dibs;
|
|
struct list_head list;
|
|
spinlock_t lock;
|
|
struct smc_connection **conn;
|
|
struct list_head vlan;
|
|
struct workqueue_struct *event_wq;
|
|
u8 pnetid[SMC_MAX_PNETID_LEN];
|
|
bool pnetid_by_user;
|
|
struct list_head lgr_list;
|
|
spinlock_t lgr_lock;
|
|
atomic_t lgr_cnt;
|
|
wait_queue_head_t lgrs_deleted;
|
|
u8 going_away : 1;
|
|
};
|
|
|
|
#endif /* _SMC_H */
|