aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/be2iscsi/be_iscsi.c
diff options
context:
space:
mode:
authorJohn Soni Jose <sony.john-n@emulex.com>2012-08-20 13:30:43 -0400
committerJames Bottomley <JBottomley@Parallels.com>2012-09-14 12:59:27 -0400
commit6f72238e774742f618ba0332b76b1860762a40cb (patch)
treec3f702662a58859b2c357e24593a4517bb019bc1 /drivers/scsi/be2iscsi/be_iscsi.c
parentdf5d0e6ee9d68f874959fa028388efa26f495f63 (diff)
[SCSI] be2iscsi: Add support for configuring the VLAN on the adapter.
Add support for configuring the VLAN parameters on the adapter using the iscsiadm interface. Signed-off-by: John Soni Jose <sony.john-n@emulex.com> Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/be2iscsi/be_iscsi.c')
-rw-r--r--drivers/scsi/be2iscsi/be_iscsi.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index 8efdd8e2d989..ebb6c1fc1607 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -332,6 +332,51 @@ beiscsi_set_static_ip(struct Scsi_Host *shost,
332 return ret; 332 return ret;
333} 333}
334 334
335/**
336 * beiscsi_set_vlan_tag()- Set the VLAN TAG
337 * @shost: Scsi Host for the driver instance
338 * @iface_param: Interface paramters
339 *
340 * Set the VLAN TAG for the adapter or disable
341 * the VLAN config
342 *
343 * returns
344 * Success: 0
345 * Failure: Non-Zero Value
346 **/
347static int
348beiscsi_set_vlan_tag(struct Scsi_Host *shost,
349 struct iscsi_iface_param_info *iface_param)
350{
351 struct beiscsi_hba *phba = iscsi_host_priv(shost);
352 int ret = 0;
353
354 /* Get the Interface Handle */
355 if (mgmt_get_all_if_id(phba)) {
356 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
357 "BS_%d : Getting Interface Handle Failed\n");
358 return -EIO;
359 }
360
361 switch (iface_param->param) {
362 case ISCSI_NET_PARAM_VLAN_ENABLED:
363 if (iface_param->value[0] != ISCSI_VLAN_ENABLE)
364 ret = mgmt_set_vlan(phba, BEISCSI_VLAN_DISABLE);
365 break;
366 case ISCSI_NET_PARAM_VLAN_TAG:
367 ret = mgmt_set_vlan(phba,
368 *((uint16_t *)iface_param->value));
369 break;
370 default:
371 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG,
372 "BS_%d : Unkown Param Type : %d\n",
373 iface_param->param);
374 return -ENOSYS;
375 }
376 return ret;
377}
378
379
335static int 380static int
336beiscsi_set_ipv4(struct Scsi_Host *shost, 381beiscsi_set_ipv4(struct Scsi_Host *shost,
337 struct iscsi_iface_param_info *iface_param, 382 struct iscsi_iface_param_info *iface_param,
@@ -368,6 +413,10 @@ beiscsi_set_ipv4(struct Scsi_Host *shost,
368 ret = beiscsi_set_static_ip(shost, iface_param, 413 ret = beiscsi_set_static_ip(shost, iface_param,
369 data, dt_len); 414 data, dt_len);
370 break; 415 break;
416 case ISCSI_NET_PARAM_VLAN_ENABLED:
417 case ISCSI_NET_PARAM_VLAN_TAG:
418 ret = beiscsi_set_vlan_tag(shost, iface_param);
419 break;
371 default: 420 default:
372 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG, 421 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
373 "BS_%d : Param %d not supported\n", 422 "BS_%d : Param %d not supported\n",
@@ -489,6 +538,27 @@ static int be2iscsi_get_if_param(struct beiscsi_hba *phba,
489 case ISCSI_NET_PARAM_IPV4_SUBNET: 538 case ISCSI_NET_PARAM_IPV4_SUBNET:
490 len = sprintf(buf, "%pI4\n", &if_info.ip_addr.subnet_mask); 539 len = sprintf(buf, "%pI4\n", &if_info.ip_addr.subnet_mask);
491 break; 540 break;
541 case ISCSI_NET_PARAM_VLAN_ENABLED:
542 len = sprintf(buf, "%s\n",
543 (if_info.vlan_priority == BEISCSI_VLAN_DISABLE)
544 ? "Disabled" : "Enabled");
545 break;
546 case ISCSI_NET_PARAM_VLAN_ID:
547 if (if_info.vlan_priority == BEISCSI_VLAN_DISABLE)
548 return -EINVAL;
549 else
550 len = sprintf(buf, "%d\n",
551 (if_info.vlan_priority &
552 ISCSI_MAX_VLAN_ID));
553 break;
554 case ISCSI_NET_PARAM_VLAN_PRIORITY:
555 if (if_info.vlan_priority == BEISCSI_VLAN_DISABLE)
556 return -EINVAL;
557 else
558 len = sprintf(buf, "%d\n",
559 ((if_info.vlan_priority >> 13) &
560 ISCSI_MAX_VLAN_PRIORITY));
561 break;
492 default: 562 default:
493 WARN_ON(1); 563 WARN_ON(1);
494 } 564 }
@@ -510,6 +580,9 @@ int be2iscsi_iface_get_param(struct iscsi_iface *iface,
510 case ISCSI_NET_PARAM_IPV4_SUBNET: 580 case ISCSI_NET_PARAM_IPV4_SUBNET:
511 case ISCSI_NET_PARAM_IPV4_BOOTPROTO: 581 case ISCSI_NET_PARAM_IPV4_BOOTPROTO:
512 case ISCSI_NET_PARAM_IPV6_ADDR: 582 case ISCSI_NET_PARAM_IPV6_ADDR:
583 case ISCSI_NET_PARAM_VLAN_ENABLED:
584 case ISCSI_NET_PARAM_VLAN_ID:
585 case ISCSI_NET_PARAM_VLAN_PRIORITY:
513 len = be2iscsi_get_if_param(phba, iface, param, buf); 586 len = be2iscsi_get_if_param(phba, iface, param, buf);
514 break; 587 break;
515 case ISCSI_NET_PARAM_IFACE_ENABLE: 588 case ISCSI_NET_PARAM_IFACE_ENABLE:
@@ -1233,6 +1306,9 @@ umode_t be2iscsi_attr_is_visible(int param_type, int param)
1233 case ISCSI_NET_PARAM_IPV4_BOOTPROTO: 1306 case ISCSI_NET_PARAM_IPV4_BOOTPROTO:
1234 case ISCSI_NET_PARAM_IPV4_GW: 1307 case ISCSI_NET_PARAM_IPV4_GW:
1235 case ISCSI_NET_PARAM_IPV6_ADDR: 1308 case ISCSI_NET_PARAM_IPV6_ADDR:
1309 case ISCSI_NET_PARAM_VLAN_ID:
1310 case ISCSI_NET_PARAM_VLAN_PRIORITY:
1311 case ISCSI_NET_PARAM_VLAN_ENABLED:
1236 return S_IRUGO; 1312 return S_IRUGO;
1237 default: 1313 default:
1238 return 0; 1314 return 0;