Skip to content

Commit f947568

Browse files
Stefan Raspldavem330
authored andcommitted
net/smc: Introduce explicit check for v2 support
Previously, v2 support was derived from a very specific format of the SEID as part of the SMC-D codebase. Make this part of the SMC-D device API, so implementers do not need to adhere to a specific SEID format. Signed-off-by: Stefan Raspl <[email protected]> Reviewed-and-tested-by: Jan Karcher <[email protected]> Reviewed-by: Wenjia Zhang <[email protected]> Signed-off-by: Wenjia Zhang <[email protected]> Reviewed-by: Tony Lu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 45ef71d commit f947568

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

drivers/s390/net/ism_drv.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,12 @@ static int smcd_move(struct smcd_dev *smcd, u64 dmb_tok, unsigned int idx,
842842
return ism_move(smcd->priv, dmb_tok, idx, sf, offset, data, size);
843843
}
844844

845+
static int smcd_supports_v2(void)
846+
{
847+
return SYSTEM_EID.serial_number[0] != '0' ||
848+
SYSTEM_EID.type[0] != '0';
849+
}
850+
845851
static u64 smcd_get_local_gid(struct smcd_dev *smcd)
846852
{
847853
return ism_get_local_gid(smcd->priv);
@@ -869,6 +875,7 @@ static const struct smcd_ops ism_ops = {
869875
.reset_vlan_required = smcd_reset_vlan_required,
870876
.signal_event = smcd_signal_ieq,
871877
.move_data = smcd_move,
878+
.supports_v2 = smcd_supports_v2,
872879
.get_system_eid = ism_get_seid,
873880
.get_local_gid = smcd_get_local_gid,
874881
.get_chid = smcd_get_chid,

include/net/smc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ struct smcd_ops {
6767
int (*move_data)(struct smcd_dev *dev, u64 dmb_tok, unsigned int idx,
6868
bool sf, unsigned int offset, void *data,
6969
unsigned int size);
70+
int (*supports_v2)(void);
7071
u8* (*get_system_eid)(void);
7172
u64 (*get_local_gid)(struct smcd_dev *dev);
7273
u16 (*get_chid)(struct smcd_dev *dev);

net/smc/smc_ism.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ static void smcd_register_dev(struct ism_dev *ism)
429429
u8 *system_eid = NULL;
430430

431431
system_eid = smcd->ops->get_system_eid();
432-
if (system_eid[24] != '0' || system_eid[28] != '0') {
432+
if (smcd->ops->supports_v2()) {
433433
smc_ism_v2_capable = true;
434434
memcpy(smc_ism_v2_system_eid, system_eid,
435435
SMC_MAX_EID_LEN);

0 commit comments

Comments
 (0)