@@ -327,29 +327,10 @@ static int srp_new_ib_cm_id(struct srp_rdma_ch *ch)
327
327
return 0 ;
328
328
}
329
329
330
- static const char * inet_ntop (const void * sa , char * dst , unsigned int size )
331
- {
332
- switch (((struct sockaddr * )sa )-> sa_family ) {
333
- case AF_INET :
334
- snprintf (dst , size , "%pI4" ,
335
- & ((struct sockaddr_in * )sa )-> sin_addr );
336
- break ;
337
- case AF_INET6 :
338
- snprintf (dst , size , "%pI6" ,
339
- & ((struct sockaddr_in6 * )sa )-> sin6_addr );
340
- break ;
341
- default :
342
- snprintf (dst , size , "???" );
343
- break ;
344
- }
345
- return dst ;
346
- }
347
-
348
330
static int srp_new_rdma_cm_id (struct srp_rdma_ch * ch )
349
331
{
350
332
struct srp_target_port * target = ch -> target ;
351
333
struct rdma_cm_id * new_cm_id ;
352
- char src_addr [64 ], dst_addr [64 ];
353
334
int ret ;
354
335
355
336
new_cm_id = rdma_create_id (target -> net , srp_rdma_cm_handler , ch ,
@@ -366,13 +347,8 @@ static int srp_new_rdma_cm_id(struct srp_rdma_ch *ch)
366
347
(struct sockaddr * )& target -> rdma_cm .dst ,
367
348
SRP_PATH_REC_TIMEOUT_MS );
368
349
if (ret ) {
369
- pr_err ("No route available from %s to %s (%d)\n" ,
370
- target -> rdma_cm .src_specified ?
371
- inet_ntop (& target -> rdma_cm .src , src_addr ,
372
- sizeof (src_addr )) : "(any)" ,
373
- inet_ntop (& target -> rdma_cm .dst , dst_addr ,
374
- sizeof (dst_addr )),
375
- ret );
350
+ pr_err ("No route available from %pIS to %pIS (%d)\n" ,
351
+ & target -> rdma_cm .src , & target -> rdma_cm .dst , ret );
376
352
goto out ;
377
353
}
378
354
ret = wait_for_completion_interruptible (& ch -> done );
@@ -381,10 +357,8 @@ static int srp_new_rdma_cm_id(struct srp_rdma_ch *ch)
381
357
382
358
ret = ch -> status ;
383
359
if (ret ) {
384
- pr_err ("Resolving address %s failed (%d)\n" ,
385
- inet_ntop (& target -> rdma_cm .dst , dst_addr ,
386
- sizeof (dst_addr )),
387
- ret );
360
+ pr_err ("Resolving address %pIS failed (%d)\n" ,
361
+ & target -> rdma_cm .dst , ret );
388
362
goto out ;
389
363
}
390
364
@@ -3778,14 +3752,11 @@ static ssize_t srp_create_target(struct device *dev,
3778
3752
3779
3753
if (!srp_conn_unique (target -> srp_host , target )) {
3780
3754
if (target -> using_rdma_cm ) {
3781
- char dst_addr [64 ];
3782
-
3783
3755
shost_printk (KERN_INFO , target -> scsi_host ,
3784
- PFX "Already connected to target port with id_ext=%016llx;ioc_guid=%016llx;dest=%s \n" ,
3756
+ PFX "Already connected to target port with id_ext=%016llx;ioc_guid=%016llx;dest=%pIS \n" ,
3785
3757
be64_to_cpu (target -> id_ext ),
3786
3758
be64_to_cpu (target -> ioc_guid ),
3787
- inet_ntop (& target -> rdma_cm .dst , dst_addr ,
3788
- sizeof (dst_addr )));
3759
+ & target -> rdma_cm .dst );
3789
3760
} else {
3790
3761
shost_printk (KERN_INFO , target -> scsi_host ,
3791
3762
PFX "Already connected to target port with id_ext=%016llx;ioc_guid=%016llx;initiator_ext=%016llx\n" ,
@@ -3894,8 +3865,8 @@ static ssize_t srp_create_target(struct device *dev,
3894
3865
char dst [64 ];
3895
3866
3896
3867
if (target -> using_rdma_cm )
3897
- inet_ntop ( & target -> rdma_cm . dst , dst ,
3898
- sizeof ( dst ) );
3868
+ snprintf ( dst , sizeof ( dst ), "%pIS" ,
3869
+ & target -> rdma_cm . dst );
3899
3870
else
3900
3871
snprintf (dst , sizeof (dst ), "%pI6" ,
3901
3872
target -> ib_cm .orig_dgid .raw );
@@ -3928,14 +3899,11 @@ static ssize_t srp_create_target(struct device *dev,
3928
3899
3929
3900
if (target -> state != SRP_TARGET_REMOVED ) {
3930
3901
if (target -> using_rdma_cm ) {
3931
- char dst [64 ];
3932
-
3933
- inet_ntop (& target -> rdma_cm .dst , dst , sizeof (dst ));
3934
3902
shost_printk (KERN_DEBUG , target -> scsi_host , PFX
3935
- "new target: id_ext %016llx ioc_guid %016llx sgid %pI6 dest %s \n" ,
3903
+ "new target: id_ext %016llx ioc_guid %016llx sgid %pI6 dest %pIS \n" ,
3936
3904
be64_to_cpu (target -> id_ext ),
3937
3905
be64_to_cpu (target -> ioc_guid ),
3938
- target -> sgid .raw , dst );
3906
+ target -> sgid .raw , & target -> rdma_cm . dst );
3939
3907
} else {
3940
3908
shost_printk (KERN_DEBUG , target -> scsi_host , PFX
3941
3909
"new target: id_ext %016llx ioc_guid %016llx pkey %04x service_id %016llx sgid %pI6 dgid %pI6\n" ,
0 commit comments