- CWARN("%simport %p (%s%s%s): changing flavor "
- "(%s, %s/%s) -> (%s, %s/%s)\n",
- svc_ctx ? "reverse " : "",
- imp, imp->imp_obd->obd_name,
- svc_ctx == NULL ? "->" : "<-",
- obd_uuid2str(&conn->c_remote_uuid),
- sptlrpc_rpcflavor2name(sec->ps_flvr.sf_rpc),
- sptlrpc_get_hash_name(sec->ps_flvr.sf_bulk_hash),
- sptlrpc_get_ciph_name(sec->ps_flvr.sf_bulk_ciph),
- sptlrpc_rpcflavor2name(sf.sf_rpc),
- sptlrpc_get_hash_name(sf.sf_bulk_hash),
- sptlrpc_get_ciph_name(sf.sf_bulk_ciph));
- } else {
- CWARN("%simport %p (%s%s%s) netid %x: "
- "select initial flavor (%s, %s/%s)\n",
- svc_ctx == NULL ? "" : "reverse ",
- imp, imp->imp_obd->obd_name,
- svc_ctx == NULL ? "->" : "<-",
- obd_uuid2str(&conn->c_remote_uuid),
- LNET_NIDNET(conn->c_self),
- sptlrpc_rpcflavor2name(sf.sf_rpc),
- sptlrpc_get_hash_name(sf.sf_bulk_hash),
- sptlrpc_get_ciph_name(sf.sf_bulk_ciph));
+ if (flavor_equal(&sf, &sec->ps_flvr))
+ GOTO(out, rc);
+
+ CDEBUG(D_SEC, "import %s->%s: changing flavor %s -> %s\n",
+ imp->imp_obd->obd_name,
+ obd_uuid2str(&conn->c_remote_uuid),
+ sptlrpc_flavor2name(&sec->ps_flvr, str, sizeof(str)),
+ sptlrpc_flavor2name(&sf, str2, sizeof(str2)));
+
+ if (SPTLRPC_FLVR_POLICY(sf.sf_rpc) ==
+ SPTLRPC_FLVR_POLICY(sec->ps_flvr.sf_rpc) &&
+ SPTLRPC_FLVR_MECH(sf.sf_rpc) ==
+ SPTLRPC_FLVR_MECH(sec->ps_flvr.sf_rpc)) {
+ sptlrpc_import_sec_adapt_inplace(imp, sec, &sf);
+ GOTO(out, rc);
+ }
+ } else if (SPTLRPC_FLVR_BASE(sf.sf_rpc) !=
+ SPTLRPC_FLVR_BASE(SPTLRPC_FLVR_NULL)) {
+ CDEBUG(D_SEC, "import %s->%s netid %x: select flavor %s\n",
+ imp->imp_obd->obd_name,
+ obd_uuid2str(&conn->c_remote_uuid),
+ LNET_NIDNET(conn->c_self),
+ sptlrpc_flavor2name(&sf, str, sizeof(str)));