@@ -2279,18 +2279,41 @@ ff_layout_encode_netaddr(struct xdr_stream *xdr, struct nfs4_pnfs_ds_addr *da)
if (ff_layout_ntop4(sap, addrbuf, sizeof(addrbuf)) == 0)
return;
port = ntohs(((struct sockaddr_in *)sap)->sin_port);
- netid = "tcp";
- netid_len = 3;
+ switch (da->da_transport) {
+ case XPRT_TRANSPORT_TCP:
+ netid = "tcp";
+ break;
+ case XPRT_TRANSPORT_RDMA:
+ netid = "rdma";
+ break;
+ case XPRT_TRANSPORT_UDP:
+ netid = "udp";
+ break;
+ default:
+ WARN_ON_ONCE(1);
+ return;
+ }
break;
case AF_INET6:
if (ff_layout_ntop6_noscopeid(sap, addrbuf, sizeof(addrbuf)) == 0)
return;
port = ntohs(((struct sockaddr_in6 *)sap)->sin6_port);
- netid = "tcp6";
- netid_len = 4;
+ switch (da->da_transport) {
+ case XPRT_TRANSPORT_TCP:
+ netid = "tcp6";
+ break;
+ case XPRT_TRANSPORT_RDMA:
+ netid = "rdma6";
+ break;
+ case XPRT_TRANSPORT_UDP:
+ netid = "udp6";
+ break;
+ default:
+ WARN_ON_ONCE(1);
+ return;
+ }
break;
default:
- /* we only support tcp and tcp6 */
WARN_ON_ONCE(1);
return;
}
@@ -2298,6 +2321,7 @@ ff_layout_encode_netaddr(struct xdr_stream *xdr, struct nfs4_pnfs_ds_addr *da)
snprintf(portbuf, sizeof(portbuf), ".%u.%u", port >> 8, port & 0xff);
len = strlcat(addrbuf, portbuf, sizeof(addrbuf));
+ netid_len = strlen(netid);
p = xdr_reserve_space(xdr, 4 + netid_len);
xdr_encode_opaque(p, netid, netid_len);