]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/net/qlcnic/qlcnic.h
qlcnic: restore NPAR config data after recovery
[net-next-2.6.git] / drivers / net / qlcnic / qlcnic.h
index 9970cff598d1cf4c4b5f600addeeb079a63ac8f2..e1894775e5aa21f26e5255917849b2394524e423 100644 (file)
@@ -51,8 +51,8 @@
 
 #define _QLCNIC_LINUX_MAJOR 5
 #define _QLCNIC_LINUX_MINOR 0
-#define _QLCNIC_LINUX_SUBVERSION 5
-#define QLCNIC_LINUX_VERSIONID  "5.0.5"
+#define _QLCNIC_LINUX_SUBVERSION 7
+#define QLCNIC_LINUX_VERSIONID  "5.0.7"
 #define QLCNIC_DRV_IDC_VER  0x01
 
 #define QLCNIC_VERSION_CODE(a, b, c)   (((a) << 24) + ((b) << 16) + (c))
 #define TX_UDPV6_PKT   0x0c
 
 /* Tx defines */
-#define MAX_BUFFERS_PER_CMD    32
-#define TX_STOP_THRESH         ((MAX_SKB_FRAGS >> 2) + 4)
+#define MAX_TSO_HEADER_DESC    2
+#define MGMT_CMD_DESC_RESV     4
+#define TX_STOP_THRESH         ((MAX_SKB_FRAGS >> 2) + MAX_TSO_HEADER_DESC \
+                                                       + MGMT_CMD_DESC_RESV)
 #define QLCNIC_MAX_TX_TIMEOUTS 2
 
 /*
@@ -369,7 +371,7 @@ struct qlcnic_recv_crb {
  */
 struct qlcnic_cmd_buffer {
        struct sk_buff *skb;
-       struct qlcnic_skb_frag frag_array[MAX_BUFFERS_PER_CMD + 1];
+       struct qlcnic_skb_frag frag_array[MAX_SKB_FRAGS + 1];
        u32 frag_count;
 };
 
@@ -379,7 +381,6 @@ struct qlcnic_rx_buffer {
        struct sk_buff *skb;
        u64 dma;
        u16 ref_handle;
-       u16 state;
 };
 
 /* Board types */
@@ -421,7 +422,6 @@ struct qlcnic_adapter_stats {
        u64  xmit_on;
        u64  xmit_off;
        u64  skb_alloc_failure;
-       u64  null_skb;
        u64  null_rxbuf;
        u64  rx_dma_map_error;
        u64  tx_dma_map_error;
@@ -573,7 +573,7 @@ struct qlcnic_recv_context {
 /*
  * Context state
  */
-
+#define QLCNIC_HOST_CTX_STATE_FREED    0
 #define QLCNIC_HOST_CTX_STATE_ACTIVE   2
 
 /*
@@ -821,9 +821,10 @@ struct qlcnic_nic_intr_coalesce {
 #define QLCNIC_LRO_REQUEST_CLEANUP     4
 
 /* Capabilites received */
-#define QLCNIC_FW_CAPABILITY_BDG               (1 << 8)
-#define QLCNIC_FW_CAPABILITY_FVLANTX           (1 << 9)
-#define QLCNIC_FW_CAPABILITY_HW_LRO            (1 << 10)
+#define QLCNIC_FW_CAPABILITY_TSO               BIT_1
+#define QLCNIC_FW_CAPABILITY_BDG               BIT_8
+#define QLCNIC_FW_CAPABILITY_FVLANTX           BIT_9
+#define QLCNIC_FW_CAPABILITY_HW_LRO            BIT_10
 
 /* module types */
 #define LINKEVENT_MODULE_NOT_PRESENT                   1
@@ -910,6 +911,7 @@ struct qlcnic_mac_req {
 #define __QLCNIC_DEV_UP                1
 #define __QLCNIC_RESETTING             2
 #define __QLCNIC_START_FW              4
+#define __QLCNIC_AER                   5
 
 #define QLCNIC_INTERRUPT_TEST          1
 #define QLCNIC_LOOPBACK_TEST           2
@@ -934,6 +936,7 @@ struct qlcnic_adapter {
        u8 rx_csum;
        u8 portnum;
        u8 physical_port;
+       u8 reset_context;
 
        u8 mc_enabled;
        u8 max_mc_count;
@@ -946,7 +949,6 @@ struct qlcnic_adapter {
        u8 has_link_events;
        u8 fw_type;
        u16 tx_context_id;
-       u16 mtu;
        u16 is_up;
 
        u16 link_speed;
@@ -958,8 +960,6 @@ struct qlcnic_adapter {
        u16 switch_mode;
        u16 max_tx_ques;
        u16 max_rx_ques;
-       u16 min_tx_bw;
-       u16 max_tx_bw;
        u16 max_mtu;
 
        u32 fw_hal_version;
@@ -983,7 +983,7 @@ struct qlcnic_adapter {
 
        u64 dev_rst_time;
 
-       struct qlcnic_pci_info *npars;
+       struct qlcnic_npar_info *npars;
        struct qlcnic_eswitch *eswitch;
        struct qlcnic_nic_template *nic_ops;
 
@@ -1001,8 +1001,6 @@ struct qlcnic_adapter {
 
        struct delayed_work fw_work;
 
-       struct work_struct  tx_timeout_task;
-
        struct qlcnic_nic_intr_coalesce coal;
 
        unsigned long state;
@@ -1043,6 +1041,20 @@ struct qlcnic_pci_info {
        u8      reserved2[106];
 };
 
+struct qlcnic_npar_info {
+       u16     vlan_id;
+       u16     min_bw;
+       u16     max_bw;
+       u8      phy_port;
+       u8      type;
+       u8      active;
+       u8      enable_pm;
+       u8      dest_npar;
+       u8      host_vlan_tag;
+       u8      promisc_mode;
+       u8      discard_tagged;
+       u8      mac_learning;
+};
 struct qlcnic_eswitch {
        u8      port;
        u8      active_vports;
@@ -1058,6 +1070,63 @@ struct qlcnic_eswitch {
 #define QLCNIC_SWITCH_PORT_MIRRORING   BIT_4
 };
 
+
+/* Return codes for Error handling */
+#define QL_STATUS_INVALID_PARAM        -1
+
+#define MAX_BW                 10000
+#define MIN_BW                 100
+#define MAX_VLAN_ID            4095
+#define MIN_VLAN_ID            2
+#define MAX_TX_QUEUES          1
+#define MAX_RX_QUEUES          4
+#define DEFAULT_MAC_LEARN      1
+
+#define IS_VALID_VLAN(vlan)    (vlan >= MIN_VLAN_ID && vlan <= MAX_VLAN_ID)
+#define IS_VALID_BW(bw)                (bw >= MIN_BW && bw <= MAX_BW \
+                                                       && (bw % 100) == 0)
+#define IS_VALID_TX_QUEUES(que)        (que > 0 && que <= MAX_TX_QUEUES)
+#define IS_VALID_RX_QUEUES(que)        (que > 0 && que <= MAX_RX_QUEUES)
+#define IS_VALID_MODE(mode)    (mode == 0 || mode == 1)
+
+struct qlcnic_pci_func_cfg {
+       u16     func_type;
+       u16     min_bw;
+       u16     max_bw;
+       u16     port_num;
+       u8      pci_func;
+       u8      func_state;
+       u8      def_mac_addr[6];
+};
+
+struct qlcnic_npar_func_cfg {
+       u32     fw_capab;
+       u16     port_num;
+       u16     min_bw;
+       u16     max_bw;
+       u16     max_tx_queues;
+       u16     max_rx_queues;
+       u8      pci_func;
+       u8      op_mode;
+};
+
+struct qlcnic_pm_func_cfg {
+       u8      pci_func;
+       u8      action;
+       u8      dest_npar;
+       u8      reserved[5];
+};
+
+struct qlcnic_esw_func_cfg {
+       u16     vlan_id;
+       u8      pci_func;
+       u8      host_vlan_tag;
+       u8      promisc_mode;
+       u8      discard_tagged;
+       u8      mac_learning;
+       u8      reserved;
+};
+
 int qlcnic_fw_cmd_query_phy(struct qlcnic_adapter *adapter, u32 reg, u32 *val);
 int qlcnic_fw_cmd_set_phy(struct qlcnic_adapter *adapter, u32 reg, u32 val);
 
@@ -1105,7 +1174,6 @@ int qlcnic_wol_supported(struct qlcnic_adapter *adapter);
 int qlcnic_config_led(struct qlcnic_adapter *adapter, u32 state, u32 rate);
 
 /* Functions from qlcnic_init.c */
-int qlcnic_phantom_init(struct qlcnic_adapter *adapter);
 int qlcnic_load_firmware(struct qlcnic_adapter *adapter);
 int qlcnic_need_fw_reset(struct qlcnic_adapter *adapter);
 void qlcnic_request_firmware(struct qlcnic_adapter *adapter);
@@ -1125,6 +1193,10 @@ void __iomem *qlcnic_get_ioaddr(struct qlcnic_adapter *, u32);
 int qlcnic_alloc_hw_resources(struct qlcnic_adapter *adapter);
 void qlcnic_free_hw_resources(struct qlcnic_adapter *adapter);
 
+int qlcnic_fw_create_ctx(struct qlcnic_adapter *adapter);
+void qlcnic_fw_destroy_ctx(struct qlcnic_adapter *adapter);
+
+void qlcnic_reset_rx_buffers_list(struct qlcnic_adapter *adapter);
 void qlcnic_release_rx_buffers(struct qlcnic_adapter *adapter);
 void qlcnic_release_tx_buffers(struct qlcnic_adapter *adapter);
 
@@ -1167,9 +1239,9 @@ void qlcnic_process_rcv_ring_diag(struct qlcnic_host_sds_ring *sds_ring);
 /* Management functions */
 int qlcnic_set_mac_address(struct qlcnic_adapter *, u8*);
 int qlcnic_get_mac_address(struct qlcnic_adapter *, u8*);
-int qlcnic_get_nic_info(struct qlcnic_adapter *, u8);
+int qlcnic_get_nic_info(struct qlcnic_adapter *, struct qlcnic_info *, u8);
 int qlcnic_set_nic_info(struct qlcnic_adapter *, struct qlcnic_info *);
-int qlcnic_get_pci_info(struct qlcnic_adapter *);
+int qlcnic_get_pci_info(struct qlcnic_adapter *, struct qlcnic_pci_info*);
 int qlcnic_reset_partition(struct qlcnic_adapter *, u8);
 
 /*  eSwitch management functions */