aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe
diff options
context:
space:
mode:
authorYi Zou <yi.zou@intel.com>2009-08-31 08:34:28 -0400
committerDavid S. Miller <davem@davemloft.net>2009-09-01 04:24:40 -0400
commit6ee1652051f14d1c110f48a5b3ee037d63d0c2fa (patch)
tree2abd6fcb4eddfb093f5d46a0faa9e601e38f6cb7 /drivers/net/ixgbe
parent579496865cf4ea429146382d62047ffdbaab0dee (diff)
ixgbe: Add support for dcbnl_rtnl_ops.setapp/getapp
Add support for dcbnl_rtnl_ops.setapp/getapp to set or get the current user priority bitmap for the given application protocol. Currently, 82599 only supports setapp/getapp for Fiber Channel over Ethernet (FCoE) protocol. Signed-off-by: Yi Zou <yi.zou@intel.com> Acked-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ixgbe')
-rw-r--r--drivers/net/ixgbe/ixgbe.h4
-rw-r--r--drivers/net/ixgbe/ixgbe_dcb_nl.c60
-rw-r--r--drivers/net/ixgbe/ixgbe_fcoe.c64
-rw-r--r--drivers/net/ixgbe/ixgbe_fcoe.h4
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c2
5 files changed, 134 insertions, 0 deletions
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h
index daed0ac60ec6..dd688d45e9cd 100644
--- a/drivers/net/ixgbe/ixgbe.h
+++ b/drivers/net/ixgbe/ixgbe.h
@@ -452,6 +452,10 @@ extern int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid,
452extern int ixgbe_fcoe_ddp_put(struct net_device *netdev, u16 xid); 452extern int ixgbe_fcoe_ddp_put(struct net_device *netdev, u16 xid);
453extern int ixgbe_fcoe_enable(struct net_device *netdev); 453extern int ixgbe_fcoe_enable(struct net_device *netdev);
454extern int ixgbe_fcoe_disable(struct net_device *netdev); 454extern int ixgbe_fcoe_disable(struct net_device *netdev);
455#ifdef CONFIG_IXGBE_DCB
456extern u8 ixgbe_fcoe_getapp(struct ixgbe_adapter *adapter);
457extern u8 ixgbe_fcoe_setapp(struct ixgbe_adapter *adapter, u8 up);
458#endif /* CONFIG_IXGBE_DCB */
455#endif /* IXGBE_FCOE */ 459#endif /* IXGBE_FCOE */
456 460
457#endif /* _IXGBE_H_ */ 461#endif /* _IXGBE_H_ */
diff --git a/drivers/net/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ixgbe/ixgbe_dcb_nl.c
index e05c62ac56b2..47d9dde82a8a 100644
--- a/drivers/net/ixgbe/ixgbe_dcb_nl.c
+++ b/drivers/net/ixgbe/ixgbe_dcb_nl.c
@@ -480,6 +480,64 @@ static void ixgbe_dcbnl_setpfcstate(struct net_device *netdev, u8 state)
480 return; 480 return;
481} 481}
482 482
483/**
484 * ixgbe_dcbnl_getapp - retrieve the DCBX application user priority
485 * @netdev : the corresponding netdev
486 * @idtype : identifies the id as ether type or TCP/UDP port number
487 * @id: id is either ether type or TCP/UDP port number
488 *
489 * Returns : on success, returns a non-zero 802.1p user priority bitmap
490 * otherwise returns 0 as the invalid user priority bitmap to indicate an
491 * error.
492 */
493static u8 ixgbe_dcbnl_getapp(struct net_device *netdev, u8 idtype, u16 id)
494{
495 u8 rval = 0;
496
497 switch (idtype) {
498 case DCB_APP_IDTYPE_ETHTYPE:
499#ifdef IXGBE_FCOE
500 if (id == ETH_P_FCOE)
501 rval = ixgbe_fcoe_getapp(netdev_priv(netdev));
502#endif
503 break;
504 case DCB_APP_IDTYPE_PORTNUM:
505 break;
506 default:
507 break;
508 }
509 return rval;
510}
511
512/**
513 * ixgbe_dcbnl_setapp - set the DCBX application user priority
514 * @netdev : the corresponding netdev
515 * @idtype : identifies the id as ether type or TCP/UDP port number
516 * @id: id is either ether type or TCP/UDP port number
517 * @up: the 802.1p user priority bitmap
518 *
519 * Returns : 0 on success or 1 on error
520 */
521static u8 ixgbe_dcbnl_setapp(struct net_device *netdev,
522 u8 idtype, u16 id, u8 up)
523{
524 u8 rval = 1;
525
526 switch (idtype) {
527 case DCB_APP_IDTYPE_ETHTYPE:
528#ifdef IXGBE_FCOE
529 if (id == ETH_P_FCOE)
530 rval = ixgbe_fcoe_setapp(netdev_priv(netdev), up);
531#endif
532 break;
533 case DCB_APP_IDTYPE_PORTNUM:
534 break;
535 default:
536 break;
537 }
538 return rval;
539}
540
483struct dcbnl_rtnl_ops dcbnl_ops = { 541struct dcbnl_rtnl_ops dcbnl_ops = {
484 .getstate = ixgbe_dcbnl_get_state, 542 .getstate = ixgbe_dcbnl_get_state,
485 .setstate = ixgbe_dcbnl_set_state, 543 .setstate = ixgbe_dcbnl_set_state,
@@ -500,5 +558,7 @@ struct dcbnl_rtnl_ops dcbnl_ops = {
500 .setnumtcs = ixgbe_dcbnl_setnumtcs, 558 .setnumtcs = ixgbe_dcbnl_setnumtcs,
501 .getpfcstate = ixgbe_dcbnl_getpfcstate, 559 .getpfcstate = ixgbe_dcbnl_getpfcstate,
502 .setpfcstate = ixgbe_dcbnl_setpfcstate, 560 .setpfcstate = ixgbe_dcbnl_setpfcstate,
561 .getapp = ixgbe_dcbnl_getapp,
562 .setapp = ixgbe_dcbnl_setapp,
503}; 563};
504 564
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.c b/drivers/net/ixgbe/ixgbe_fcoe.c
index 26fe46fb13fb..0607cffbb213 100644
--- a/drivers/net/ixgbe/ixgbe_fcoe.c
+++ b/drivers/net/ixgbe/ixgbe_fcoe.c
@@ -27,6 +27,9 @@
27 27
28 28
29#include "ixgbe.h" 29#include "ixgbe.h"
30#ifdef CONFIG_IXGBE_DCB
31#include "ixgbe_dcb_82599.h"
32#endif /* CONFIG_IXGBE_DCB */
30#include <linux/if_ether.h> 33#include <linux/if_ether.h>
31#include <scsi/scsi_cmnd.h> 34#include <scsi/scsi_cmnd.h>
32#include <scsi/scsi_device.h> 35#include <scsi/scsi_device.h>
@@ -648,3 +651,64 @@ int ixgbe_fcoe_disable(struct net_device *netdev)
648out_disable: 651out_disable:
649 return rc; 652 return rc;
650} 653}
654
655#ifdef CONFIG_IXGBE_DCB
656/**
657 * ixgbe_fcoe_getapp - retrieves current user priority bitmap for FCoE
658 * @adapter : ixgbe adapter
659 *
660 * Finds out the corresponding user priority bitmap from the current
661 * traffic class that FCoE belongs to. Returns 0 as the invalid user
662 * priority bitmap to indicate an error.
663 *
664 * Returns : 802.1p user priority bitmap for FCoE
665 */
666u8 ixgbe_fcoe_getapp(struct ixgbe_adapter *adapter)
667{
668 int i;
669 u8 tc;
670 u32 up2tc;
671
672 up2tc = IXGBE_READ_REG(&adapter->hw, IXGBE_RTTUP2TC);
673 for (i = 0; i < MAX_USER_PRIORITY; i++) {
674 tc = (u8)(up2tc >> (i * IXGBE_RTTUP2TC_UP_SHIFT));
675 tc &= (MAX_TRAFFIC_CLASS - 1);
676 if (adapter->fcoe.tc == tc)
677 return 1 << i;
678 }
679
680 return 0;
681}
682
683/**
684 * ixgbe_fcoe_setapp - sets the user priority bitmap for FCoE
685 * @adapter : ixgbe adapter
686 * @up : 802.1p user priority bitmap
687 *
688 * Finds out the traffic class from the input user priority
689 * bitmap for FCoE.
690 *
691 * Returns : 0 on success otherwise returns 1 on error
692 */
693u8 ixgbe_fcoe_setapp(struct ixgbe_adapter *adapter, u8 up)
694{
695 int i;
696 u32 up2tc;
697
698 /* valid user priority bitmap must not be 0 */
699 if (up) {
700 /* from user priority to the corresponding traffic class */
701 up2tc = IXGBE_READ_REG(&adapter->hw, IXGBE_RTTUP2TC);
702 for (i = 0; i < MAX_USER_PRIORITY; i++) {
703 if (up & (1 << i)) {
704 up2tc >>= (i * IXGBE_RTTUP2TC_UP_SHIFT);
705 up2tc &= (MAX_TRAFFIC_CLASS - 1);
706 adapter->fcoe.tc = (u8)up2tc;
707 return 0;
708 }
709 }
710 }
711
712 return 1;
713}
714#endif /* CONFIG_IXGBE_DCB */
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.h b/drivers/net/ixgbe/ixgbe_fcoe.h
index c5b50026a897..b5dee7b3ef1c 100644
--- a/drivers/net/ixgbe/ixgbe_fcoe.h
+++ b/drivers/net/ixgbe/ixgbe_fcoe.h
@@ -46,6 +46,9 @@
46#define IXGBE_FCBUFF_MIN 4096 /* 4KB min */ 46#define IXGBE_FCBUFF_MIN 4096 /* 4KB min */
47#define IXGBE_FCOE_DDP_MAX 512 /* 9 bits xid */ 47#define IXGBE_FCOE_DDP_MAX 512 /* 9 bits xid */
48 48
49/* Default traffic class to use for FCoE */
50#define IXGBE_FCOE_DEFTC 3
51
49/* fcerr */ 52/* fcerr */
50#define IXGBE_FCERR_BADCRC 0x00100000 53#define IXGBE_FCERR_BADCRC 0x00100000
51 54
@@ -59,6 +62,7 @@ struct ixgbe_fcoe_ddp {
59}; 62};
60 63
61struct ixgbe_fcoe { 64struct ixgbe_fcoe {
65 u8 tc;
62 spinlock_t lock; 66 spinlock_t lock;
63 struct pci_pool *pool; 67 struct pci_pool *pool;
64 struct ixgbe_fcoe_ddp ddp[IXGBE_FCOE_DDP_MAX]; 68 struct ixgbe_fcoe_ddp ddp[IXGBE_FCOE_DDP_MAX];
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 30a58fbbeed5..f907836eed22 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -3801,6 +3801,8 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)
3801 adapter->flags |= IXGBE_FLAG_FCOE_CAPABLE; 3801 adapter->flags |= IXGBE_FLAG_FCOE_CAPABLE;
3802 adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED; 3802 adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED;
3803 adapter->ring_feature[RING_F_FCOE].indices = 0; 3803 adapter->ring_feature[RING_F_FCOE].indices = 0;
3804 /* Default traffic class to use for FCoE */
3805 adapter->fcoe.tc = IXGBE_FCOE_DEFTC;
3804#endif /* IXGBE_FCOE */ 3806#endif /* IXGBE_FCOE */
3805 } 3807 }
3806 3808