aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/qlcnic/qlcnic.h
diff options
context:
space:
mode:
authorAnirban Chakraborty <anirban.chakraborty@qlogic.com>2010-06-01 07:28:51 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-02 05:24:03 -0400
commit2e9d722db6617ed10204bfa9cd60552620592a43 (patch)
treeda905f18459e55a8cb534d757f5b14a3e9da73d5 /drivers/net/qlcnic/qlcnic.h
parentdd8f61d7ff92eb8a4626565ca37b209b3a8a9ce2 (diff)
qlcnic: NIC Partitioning - Add basic infrastructure support
Following changes have been added to enable the adapter to work in NIC partitioning mode where multiple PCI functions of an adapter port can be configured to work as NIC functions. The first function that is enumerated on the PCI bus assumes the role of management function which, besides being able to do all the NIC functionality, can configure other NIC partitions. Other NIC functions can be configured as privileged or non privileged functions. Privileged function can not configure other NIC functions but can do all the NIC functionality including any firmware initialization, chip reset etc. Non privileged functions can do only basic IO. For chip reset etc, it depends on the privilege or management function. 1. Added code to determine PCI function number independent of kernel API. 2. Added Driver - FW version 2.0 support. 3. Changed producer and consumer register offset calculation. 4. Added management and privileged operation modes for npar functions. A module parameter has been added to control it. 5. Added support for configuring the eswitch in the adapter. Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlcnic/qlcnic.h')
-rw-r--r--drivers/net/qlcnic/qlcnic.h121
1 files changed, 113 insertions, 8 deletions
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index 896d40df9a13..31a0b430a9d7 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -197,8 +197,7 @@ struct cmd_desc_type0 {
197 197
198 __le64 addr_buffer4; 198 __le64 addr_buffer4;
199 199
200 __le32 reserved2; 200 u8 eth_addr[ETH_ALEN];
201 __le16 reserved;
202 __le16 vlan_TCI; 201 __le16 vlan_TCI;
203 202
204} __attribute__ ((aligned(64))); 203} __attribute__ ((aligned(64)));
@@ -315,6 +314,8 @@ struct uni_data_desc{
315#define QLCNIC_BRDTYPE_P3_10G_XFP 0x0032 314#define QLCNIC_BRDTYPE_P3_10G_XFP 0x0032
316#define QLCNIC_BRDTYPE_P3_10G_TP 0x0080 315#define QLCNIC_BRDTYPE_P3_10G_TP 0x0080
317 316
317#define QLCNIC_MSIX_TABLE_OFFSET 0x44
318
318/* Flash memory map */ 319/* Flash memory map */
319#define QLCNIC_BRDCFG_START 0x4000 /* board config */ 320#define QLCNIC_BRDCFG_START 0x4000 /* board config */
320#define QLCNIC_BOOTLD_START 0x10000 /* bootld */ 321#define QLCNIC_BOOTLD_START 0x10000 /* bootld */
@@ -542,7 +543,17 @@ struct qlcnic_recv_context {
542#define QLCNIC_CDRP_CMD_READ_PEXQ_PARAMETERS 0x0000001c 543#define QLCNIC_CDRP_CMD_READ_PEXQ_PARAMETERS 0x0000001c
543#define QLCNIC_CDRP_CMD_GET_LIC_CAPABILITIES 0x0000001d 544#define QLCNIC_CDRP_CMD_GET_LIC_CAPABILITIES 0x0000001d
544#define QLCNIC_CDRP_CMD_READ_MAX_LRO_PER_BOARD 0x0000001e 545#define QLCNIC_CDRP_CMD_READ_MAX_LRO_PER_BOARD 0x0000001e
545#define QLCNIC_CDRP_CMD_MAX 0x0000001f 546#define QLCNIC_CDRP_CMD_MAC_ADDRESS 0x0000001f
547
548#define QLCNIC_CDRP_CMD_GET_PCI_INFO 0x00000020
549#define QLCNIC_CDRP_CMD_GET_NIC_INFO 0x00000021
550#define QLCNIC_CDRP_CMD_SET_NIC_INFO 0x00000022
551#define QLCNIC_CDRP_CMD_RESET_NPAR 0x00000023
552#define QLCNIC_CDRP_CMD_GET_ESWITCH_CAPABILITY 0x00000024
553#define QLCNIC_CDRP_CMD_TOGGLE_ESWITCH 0x00000025
554#define QLCNIC_CDRP_CMD_GET_ESWITCH_STATUS 0x00000026
555#define QLCNIC_CDRP_CMD_SET_PORTMIRRORING 0x00000027
556#define QLCNIC_CDRP_CMD_CONFIGURE_ESWITCH 0x00000028
546 557
547#define QLCNIC_RCODE_SUCCESS 0 558#define QLCNIC_RCODE_SUCCESS 0
548#define QLCNIC_RCODE_TIMEOUT 17 559#define QLCNIC_RCODE_TIMEOUT 17
@@ -560,7 +571,6 @@ struct qlcnic_recv_context {
560/* 571/*
561 * Context state 572 * Context state
562 */ 573 */
563#define QLCHAL_VERSION 1
564 574
565#define QLCNIC_HOST_CTX_STATE_ACTIVE 2 575#define QLCNIC_HOST_CTX_STATE_ACTIVE 2
566 576
@@ -887,6 +897,7 @@ struct qlcnic_mac_req {
887#define MSIX_ENTRIES_PER_ADAPTER NUM_STS_DESC_RINGS 897#define MSIX_ENTRIES_PER_ADAPTER NUM_STS_DESC_RINGS
888#define QLCNIC_MSIX_TBL_SPACE 8192 898#define QLCNIC_MSIX_TBL_SPACE 8192
889#define QLCNIC_PCI_REG_MSIX_TBL 0x44 899#define QLCNIC_PCI_REG_MSIX_TBL 0x44
900#define QLCNIC_MSIX_TBL_PGSIZE 4096
890 901
891#define QLCNIC_NETDEV_WEIGHT 128 902#define QLCNIC_NETDEV_WEIGHT 128
892#define QLCNIC_ADAPTER_UP_MAGIC 777 903#define QLCNIC_ADAPTER_UP_MAGIC 777
@@ -923,7 +934,6 @@ struct qlcnic_adapter {
923 u8 mc_enabled; 934 u8 mc_enabled;
924 u8 max_mc_count; 935 u8 max_mc_count;
925 u8 rss_supported; 936 u8 rss_supported;
926 u8 rsrvd1;
927 u8 fw_wait_cnt; 937 u8 fw_wait_cnt;
928 u8 fw_fail_cnt; 938 u8 fw_fail_cnt;
929 u8 tx_timeo_cnt; 939 u8 tx_timeo_cnt;
@@ -940,6 +950,15 @@ struct qlcnic_adapter {
940 u16 link_autoneg; 950 u16 link_autoneg;
941 u16 module_type; 951 u16 module_type;
942 952
953 u16 op_mode;
954 u16 switch_mode;
955 u16 max_tx_ques;
956 u16 max_rx_ques;
957 u16 min_tx_bw;
958 u16 max_tx_bw;
959 u16 max_mtu;
960
961 u32 fw_hal_version;
943 u32 capabilities; 962 u32 capabilities;
944 u32 flags; 963 u32 flags;
945 u32 irq; 964 u32 irq;
@@ -948,18 +967,22 @@ struct qlcnic_adapter {
948 u32 int_vec_bit; 967 u32 int_vec_bit;
949 u32 heartbit; 968 u32 heartbit;
950 969
970 u8 max_mac_filters;
951 u8 dev_state; 971 u8 dev_state;
952 u8 diag_test; 972 u8 diag_test;
953 u8 diag_cnt; 973 u8 diag_cnt;
954 u8 reset_ack_timeo; 974 u8 reset_ack_timeo;
955 u8 dev_init_timeo; 975 u8 dev_init_timeo;
956 u8 rsrd1;
957 u16 msg_enable; 976 u16 msg_enable;
958 977
959 u8 mac_addr[ETH_ALEN]; 978 u8 mac_addr[ETH_ALEN];
960 979
961 u64 dev_rst_time; 980 u64 dev_rst_time;
962 981
982 struct qlcnic_pci_info *npars;
983 struct qlcnic_eswitch *eswitch;
984 struct qlcnic_nic_template *nic_ops;
985
963 struct qlcnic_adapter_stats stats; 986 struct qlcnic_adapter_stats stats;
964 987
965 struct qlcnic_recv_context recv_ctx; 988 struct qlcnic_recv_context recv_ctx;
@@ -984,6 +1007,53 @@ struct qlcnic_adapter {
984 const struct firmware *fw; 1007 const struct firmware *fw;
985}; 1008};
986 1009
1010struct qlcnic_info {
1011 __le16 pci_func;
1012 __le16 op_mode; /* 1 = Priv, 2 = NP, 3 = NP passthru */
1013 __le16 phys_port;
1014 __le16 switch_mode; /* 0 = disabled, 1 = int, 2 = ext */
1015
1016 __le32 capabilities;
1017 u8 max_mac_filters;
1018 u8 reserved1;
1019 __le16 max_mtu;
1020
1021 __le16 max_tx_ques;
1022 __le16 max_rx_ques;
1023 __le16 min_tx_bw;
1024 __le16 max_tx_bw;
1025 u8 reserved2[104];
1026};
1027
1028struct qlcnic_pci_info {
1029 __le16 id; /* pci function id */
1030 __le16 active; /* 1 = Enabled */
1031 __le16 type; /* 1 = NIC, 2 = FCoE, 3 = iSCSI */
1032 __le16 default_port; /* default port number */
1033
1034 __le16 tx_min_bw; /* Multiple of 100mbpc */
1035 __le16 tx_max_bw;
1036 __le16 reserved1[2];
1037
1038 u8 mac[ETH_ALEN];
1039 u8 reserved2[106];
1040};
1041
1042struct qlcnic_eswitch {
1043 u8 port;
1044 u8 active_vports;
1045 u8 active_vlans;
1046 u8 active_ucast_filters;
1047 u8 max_ucast_filters;
1048 u8 max_active_vlans;
1049
1050 u32 flags;
1051#define QLCNIC_SWITCH_ENABLE BIT_1
1052#define QLCNIC_SWITCH_VLAN_FILTERING BIT_2
1053#define QLCNIC_SWITCH_PROMISC_MODE BIT_3
1054#define QLCNIC_SWITCH_PORT_MIRRORING BIT_4
1055};
1056
987int qlcnic_fw_cmd_query_phy(struct qlcnic_adapter *adapter, u32 reg, u32 *val); 1057int qlcnic_fw_cmd_query_phy(struct qlcnic_adapter *adapter, u32 reg, u32 *val);
988int qlcnic_fw_cmd_set_phy(struct qlcnic_adapter *adapter, u32 reg, u32 val); 1058int qlcnic_fw_cmd_set_phy(struct qlcnic_adapter *adapter, u32 reg, u32 val);
989 1059
@@ -1070,13 +1140,14 @@ void qlcnic_advert_link_change(struct qlcnic_adapter *adapter, int linkup);
1070int qlcnic_fw_cmd_set_mtu(struct qlcnic_adapter *adapter, int mtu); 1140int qlcnic_fw_cmd_set_mtu(struct qlcnic_adapter *adapter, int mtu);
1071int qlcnic_change_mtu(struct net_device *netdev, int new_mtu); 1141int qlcnic_change_mtu(struct net_device *netdev, int new_mtu);
1072int qlcnic_config_hw_lro(struct qlcnic_adapter *adapter, int enable); 1142int qlcnic_config_hw_lro(struct qlcnic_adapter *adapter, int enable);
1073int qlcnic_config_bridged_mode(struct qlcnic_adapter *adapter, int enable); 1143int qlcnic_config_bridged_mode(struct qlcnic_adapter *adapter, u32 enable);
1074int qlcnic_send_lro_cleanup(struct qlcnic_adapter *adapter); 1144int qlcnic_send_lro_cleanup(struct qlcnic_adapter *adapter);
1075void qlcnic_update_cmd_producer(struct qlcnic_adapter *adapter, 1145void qlcnic_update_cmd_producer(struct qlcnic_adapter *adapter,
1076 struct qlcnic_host_tx_ring *tx_ring); 1146 struct qlcnic_host_tx_ring *tx_ring);
1077int qlcnic_get_mac_addr(struct qlcnic_adapter *adapter, u64 *mac); 1147int qlcnic_get_mac_addr(struct qlcnic_adapter *adapter, u8 *mac);
1078void qlcnic_clear_ilb_mode(struct qlcnic_adapter *adapter); 1148void qlcnic_clear_ilb_mode(struct qlcnic_adapter *adapter);
1079int qlcnic_set_ilb_mode(struct qlcnic_adapter *adapter); 1149int qlcnic_set_ilb_mode(struct qlcnic_adapter *adapter);
1150void qlcnic_fetch_mac(struct qlcnic_adapter *, u32, u32, u8, u8 *);
1080 1151
1081/* Functions from qlcnic_main.c */ 1152/* Functions from qlcnic_main.c */
1082int qlcnic_reset_context(struct qlcnic_adapter *); 1153int qlcnic_reset_context(struct qlcnic_adapter *);
@@ -1088,6 +1159,32 @@ int qlcnic_check_loopback_buff(unsigned char *data);
1088netdev_tx_t qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev); 1159netdev_tx_t qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev);
1089void qlcnic_process_rcv_ring_diag(struct qlcnic_host_sds_ring *sds_ring); 1160void qlcnic_process_rcv_ring_diag(struct qlcnic_host_sds_ring *sds_ring);
1090 1161
1162/* Functions from qlcnic_vf.c */
1163int qlcnicvf_config_bridged_mode(struct qlcnic_adapter *, u32);
1164int qlcnicvf_config_led(struct qlcnic_adapter *, u32, u32);
1165int qlcnicvf_set_ilb_mode(struct qlcnic_adapter *adapter);
1166void qlcnicvf_clear_ilb_mode(struct qlcnic_adapter *adapter);
1167void qlcnicvf_set_port_mode(struct qlcnic_adapter *adapter);
1168
1169/* Management functions */
1170int qlcnic_set_mac_address(struct qlcnic_adapter *, u8*);
1171int qlcnic_get_mac_address(struct qlcnic_adapter *, u8*);
1172int qlcnic_get_nic_info(struct qlcnic_adapter *, u8);
1173int qlcnic_set_nic_info(struct qlcnic_adapter *, struct qlcnic_info *);
1174int qlcnic_get_pci_info(struct qlcnic_adapter *);
1175int qlcnic_reset_partition(struct qlcnic_adapter *, u8);
1176
1177/* eSwitch management functions */
1178int qlcnic_get_eswitch_capabilities(struct qlcnic_adapter *, u8,
1179 struct qlcnic_eswitch *);
1180int qlcnic_get_eswitch_status(struct qlcnic_adapter *, u8,
1181 struct qlcnic_eswitch *);
1182int qlcnic_toggle_eswitch(struct qlcnic_adapter *, u8, u8);
1183int qlcnic_config_switch_port(struct qlcnic_adapter *, u8, int, u8, u8,
1184 u8, u8, u16);
1185int qlcnic_config_port_mirroring(struct qlcnic_adapter *, u8, u8, u8);
1186extern int qlcnic_config_tso;
1187
1091/* 1188/*
1092 * QLOGIC Board information 1189 * QLOGIC Board information
1093 */ 1190 */
@@ -1131,6 +1228,14 @@ static inline u32 qlcnic_tx_avail(struct qlcnic_host_tx_ring *tx_ring)
1131 1228
1132extern const struct ethtool_ops qlcnic_ethtool_ops; 1229extern const struct ethtool_ops qlcnic_ethtool_ops;
1133 1230
1231struct qlcnic_nic_template {
1232 int (*get_mac_addr) (struct qlcnic_adapter *, u8*);
1233 int (*config_bridged_mode) (struct qlcnic_adapter *, u32);
1234 int (*config_led) (struct qlcnic_adapter *, u32, u32);
1235 int (*set_ilb_mode) (struct qlcnic_adapter *);
1236 void (*clear_ilb_mode) (struct qlcnic_adapter *);
1237};
1238
1134#define QLCDB(adapter, lvl, _fmt, _args...) do { \ 1239#define QLCDB(adapter, lvl, _fmt, _args...) do { \
1135 if (NETIF_MSG_##lvl & adapter->msg_enable) \ 1240 if (NETIF_MSG_##lvl & adapter->msg_enable) \
1136 printk(KERN_INFO "%s: %s: " _fmt, \ 1241 printk(KERN_INFO "%s: %s: " _fmt, \