Skip to content

Commit ece60db

Browse files
Wen Gudavem330
authored andcommitted
net/smc: support SMCv2.x supplemental features negotiation
This patch adds SMCv2.x supplemental features negotiation. Supported SMCv2.x supplemental features are represented by feature_mask in FCE field. The negotiation process is as follows. Server Client Proposal(features(c-mask bits)) <----------------------------------------- Accept(features(s-mask bits)) -----------------------------------------> Confirm(features(s&c-mask bits)) <----------------------------------------- Signed-off-by: Wen Gu <[email protected]> Reviewed-and-tested-by: Wenjia Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9505450 commit ece60db

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

net/smc/smc.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ enum smc_state { /* possible states of an SMC socket */
5858
SMC_PROCESSABORT = 27,
5959
};
6060

61+
#define SMC_FEATURE_MASK 0 /* bitmask of
62+
* supported supplemental features
63+
*/
64+
6165
struct smc_link_group;
6266

6367
struct smc_wr_rx_hdr { /* common prefix part of LLC and CDC to demultiplex */

net/smc/smc_clc.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ static int smc_clc_fill_fce_v2x(struct smc_clc_first_contact_ext_v2x *fce_v2x,
438438
fce_v2x->max_conns = ini->max_conns;
439439
fce_v2x->max_links = ini->max_links;
440440
}
441+
fce_v2x->feature_mask = htons(ini->feature_mask);
441442
}
442443

443444
out:
@@ -907,6 +908,7 @@ int smc_clc_send_proposal(struct smc_sock *smc, struct smc_init_info *ini)
907908
pclc_smcd->v2_ext_offset = htons(v2_ext_offset);
908909
plen += sizeof(*v2_ext);
909910

911+
v2_ext->feature_mask = htons(SMC_FEATURE_MASK);
910912
read_lock(&smc_clc_eid_table.lock);
911913
v2_ext->hdr.eid_cnt = smc_clc_eid_table.ueid_cnt;
912914
plen += smc_clc_eid_table.ueid_cnt * SMC_MAX_EID_LEN;
@@ -1208,6 +1210,7 @@ int smc_clc_srv_v2x_features_validate(struct smc_sock *smc,
12081210

12091211
ini->max_conns = SMC_CONN_PER_LGR_MAX;
12101212
ini->max_links = SMC_LINKS_ADD_LNK_MAX;
1213+
ini->feature_mask = SMC_FEATURE_MASK;
12111214

12121215
if ((!(ini->smcd_version & SMC_V2) && !(ini->smcr_version & SMC_V2)) ||
12131216
ini->release_nr < SMC_RELEASE_1)
@@ -1251,6 +1254,8 @@ int smc_clc_clnt_v2x_features_validate(struct smc_clc_first_contact_ext *fce,
12511254
return SMC_CLC_DECL_MAXLINKERR;
12521255
ini->max_links = fce_v2x->max_links;
12531256
}
1257+
/* common supplemental features of server and client */
1258+
ini->feature_mask = ntohs(fce_v2x->feature_mask) & SMC_FEATURE_MASK;
12541259

12551260
return 0;
12561261
}
@@ -1279,6 +1284,8 @@ int smc_clc_v2x_features_confirm_check(struct smc_clc_msg_accept_confirm *cclc,
12791284
if (fce_v2x->max_links != ini->max_links)
12801285
return SMC_CLC_DECL_MAXLINKERR;
12811286
}
1287+
/* common supplemental features returned by client */
1288+
ini->feature_mask = ntohs(fce_v2x->feature_mask);
12821289

12831290
return 0;
12841291
}

net/smc/smc_clc.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ struct smc_clc_v2_extension {
138138
u8 roce[16]; /* RoCEv2 GID */
139139
u8 max_conns;
140140
u8 max_links;
141-
u8 reserved[14];
141+
__be16 feature_mask;
142+
u8 reserved[12];
142143
u8 user_eids[][SMC_MAX_EID_LEN];
143144
};
144145

@@ -240,9 +241,14 @@ struct smc_clc_first_contact_ext {
240241

241242
struct smc_clc_first_contact_ext_v2x {
242243
struct smc_clc_first_contact_ext fce_v2_base;
243-
u8 max_conns; /* for SMC-R only */
244-
u8 max_links; /* for SMC-R only */
245-
u8 reserved3[2];
244+
union {
245+
struct {
246+
u8 max_conns; /* for SMC-R only */
247+
u8 max_links; /* for SMC-R only */
248+
};
249+
u8 reserved3[2]; /* for SMC-D only */
250+
};
251+
__be16 feature_mask;
246252
__be32 vendor_exp_options;
247253
u8 reserved4[8];
248254
} __packed; /* format defined in

net/smc/smc_core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ struct smc_init_info {
401401
u8 max_links;
402402
u8 first_contact_peer;
403403
u8 first_contact_local;
404+
u16 feature_mask;
404405
unsigned short vlan_id;
405406
u32 rc;
406407
u8 negotiated_eid[SMC_MAX_EID_LEN];

0 commit comments

Comments
 (0)