1/*-
2 * Copyright (C) 2012 Emulex
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
--- 22 unchanged lines hidden (view full) ---
31 * Contact Information:
32 * freebsd-drivers@emulex.com
33 *
34 * Emulex
35 * 3333 Susan Street
36 * Costa Mesa, CA 92626
37 */
38
39
40/* $FreeBSD: head/sys/dev/oce/oce_if.h 247880 2013-03-06 09:53:38Z delphij $ */
41
42#include <sys/param.h>
43#include <sys/endian.h>
44#include <sys/module.h>
45#include <sys/kernel.h>
46#include <sys/bus.h>
47#include <sys/mbuf.h>
48#include <sys/rman.h>
49#include <sys/socket.h>
--- 33 unchanged lines hidden (view full) ---
83#include <netinet/tcp.h>
84#include <netinet/sctp.h>
85#include <netinet/tcp_lro.h>
86
87#include <machine/bus.h>
88
89#include "oce_hw.h"
90
91#define COMPONENT_REVISION "4.6.95.0"
92
93/* OCE devices supported by this driver */
94#define PCI_VENDOR_EMULEX 0x10df /* Emulex */
95#define PCI_VENDOR_SERVERENGINES 0x19a2 /* ServerEngines (BE) */
96#define PCI_PRODUCT_BE2 0x0700 /* BE2 network adapter */
97#define PCI_PRODUCT_BE3 0x0710 /* BE3 network adapter */
98#define PCI_PRODUCT_XE201 0xe220 /* XE201 network adapter */
99#define PCI_PRODUCT_XE201_VF 0xe228 /* XE201 with VF in Lancer */
100
--- 25 unchanged lines hidden (view full) ---
126#define OCE_MAX_CQ OCE_MAX_RQ + OCE_MAX_WQ + 1 /* one MCC queue */
127#define OCE_MAX_CQ_EQ 8 /* Max CQ that can attached to an EQ */
128
129#define OCE_DEFAULT_WQ_EQD 16
130#define OCE_MAX_PACKET_Q 16
131#define OCE_RQ_BUF_SIZE 2048
132#define OCE_LSO_MAX_SIZE (64 * 1024)
133#define LONG_TIMEOUT 30
134#define OCE_MAX_JUMBO_FRAME_SIZE 9018
135#define OCE_MAX_MTU (OCE_MAX_JUMBO_FRAME_SIZE - \
136 ETHER_VLAN_ENCAP_LEN - \
137 ETHER_HDR_LEN)
138
139#define OCE_MAX_TX_ELEMENTS 29
140#define OCE_MAX_TX_DESC 1024
141#define OCE_MAX_TX_SIZE 65535
142#define OCE_MAX_RX_SIZE 4096
--- 332 unchanged lines hidden (view full) ---
475 struct oce_rx_stats rx;
476 struct oce_tx_stats tx;
477 union {
478 struct oce_be_stats be;
479 struct oce_xe201_stats xe201;
480 } u0;
481};
482
483#define INTR_RATE_HWM 15000
484#define INTR_RATE_LWM 10000
485
486#define OCE_MAX_EQD 128u
487#define OCE_MIN_EQD 50u
488
489struct oce_set_eqd {
490 uint32_t eq_id;
491 uint32_t phase;
492 uint32_t delay_multiplier;
493};
494
495struct oce_aic_obj { /* Adaptive interrupt coalescing (AIC) info */
496 boolean_t enable;
497 uint32_t min_eqd; /* in usecs */
498 uint32_t max_eqd; /* in usecs */
499 uint32_t cur_eqd; /* in usecs */
500 uint32_t et_eqd; /* configured value when aic is off */
501 uint64_t ticks;
502 uint64_t intr_prev;
503};
504
505#define MAX_LOCK_DESC_LEN 32
506struct oce_lock {
507 struct mtx mutex;
508 char name[MAX_LOCK_DESC_LEN+1];
509};
510#define OCE_LOCK struct oce_lock
511
512#define LOCK_CREATE(lock, desc) { \
--- 66 unchanged lines hidden (view full) ---
579 void *cb_context;
580 oce_ring_buffer_t *ring;
581 uint32_t ref_count;
582 qstate_t qstate;
583 struct oce_cq *cq[OCE_MAX_CQ_EQ];
584 int cq_valid;
585 struct eq_config eq_cfg;
586 int vector;
587 uint64_t intr;
588};
589
590enum cq_len {
591 CQ_LEN_256 = 256,
592 CQ_LEN_512 = 512,
593 CQ_LEN_1024 = 1024
594};
595
--- 246 unchanged lines hidden (view full) ---
842 uint32_t if_id; /* interface ID */
843 uint32_t nifs; /* number of adapter interfaces, 0 or 1 */
844 uint32_t pmac_id; /* PMAC id */
845
846 uint32_t if_cap_flags;
847
848 uint32_t flow_control;
849 uint32_t promisc;
850
851 struct oce_aic_obj aic_obj[OCE_MAX_EQ];
852
853 /*Vlan Filtering related */
854 eventhandler_tag vlan_attach;
855 eventhandler_tag vlan_detach;
856 uint16_t vlans_added;
857 uint8_t vlan_tag[MAX_VLANS];
858 /*stats */
859 OCE_DMA_MEM stats_mem;
860 struct oce_drv_stats oce_stats_info;
861 struct callout timer;
862 int8_t be3_native;
863 uint16_t qnq_debug_event;
864 uint16_t qnqid;
865 uint16_t pvid;
866
867} OCE_SOFTC, *POCE_SOFTC;
868
869
870
871/**************************************************
872 * BUS memory read/write macros
873 * BE3: accesses three BAR spaces (CFG, CSR, DB)
--- 142 unchanged lines hidden (view full) ---
1016int oce_mbox_get_flashrom_crc(POCE_SOFTC sc, uint8_t *flash_crc,
1017 uint32_t offset, uint32_t optype);
1018int oce_mbox_get_phy_info(POCE_SOFTC sc, struct oce_phy_info *phy_info);
1019int oce_mbox_create_rq(struct oce_rq *rq);
1020int oce_mbox_create_wq(struct oce_wq *wq);
1021int oce_mbox_create_eq(struct oce_eq *eq);
1022int oce_mbox_cq_create(struct oce_cq *cq, uint32_t ncoalesce,
1023 uint32_t is_eventable);
1024int oce_mbox_read_transrecv_data(POCE_SOFTC sc, uint32_t page_num);
1025void oce_mbox_eqd_modify_periodic(POCE_SOFTC sc, struct oce_set_eqd *set_eqd,
1026 int num);
1027void mbx_common_req_hdr_init(struct mbx_hdr *hdr,
1028 uint8_t dom,
1029 uint8_t port,
1030 uint8_t subsys,
1031 uint8_t opcode,
1032 uint32_t timeout, uint32_t pyld_len,
1033 uint8_t version);
1034
--- 64 unchanged lines hidden (view full) ---
1099 }
1100
1101 if (c == 1)
1102 return b;
1103
1104 return 0;
1105}
1106
1107#define TRANSCEIVER_DATA_NUM_ELE 64
1108#define TRANSCEIVER_DATA_SIZE 256
1109#define TRANSCEIVER_A0_SIZE 128
1110#define TRANSCEIVER_A2_SIZE 128
1111#define PAGE_NUM_A0 0xa0
1112#define PAGE_NUM_A2 0xa2
1113#define IS_QNQ_OR_UMC(sc) ((sc->pvid && (sc->function_mode & FNM_UMC_MODE ))\
1114 || (sc->qnqid && (sc->function_mode & FNM_FLEX10_MODE)))
1115
2 * Copyright (C) 2012 Emulex
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
--- 22 unchanged lines hidden (view full) ---
31 * Contact Information:
32 * freebsd-drivers@emulex.com
33 *
34 * Emulex
35 * 3333 Susan Street
36 * Costa Mesa, CA 92626
37 */
38
39
40/* $FreeBSD: head/sys/dev/oce/oce_if.h 247880 2013-03-06 09:53:38Z delphij $ */
41
42#include <sys/param.h>
43#include <sys/endian.h>
44#include <sys/module.h>
45#include <sys/kernel.h>
46#include <sys/bus.h>
47#include <sys/mbuf.h>
48#include <sys/rman.h>
49#include <sys/socket.h>
--- 33 unchanged lines hidden (view full) ---
83#include <netinet/tcp.h>
84#include <netinet/sctp.h>
85#include <netinet/tcp_lro.h>
86
87#include <machine/bus.h>
88
89#include "oce_hw.h"
90
91#define COMPONENT_REVISION "4.6.95.0"
92
93/* OCE devices supported by this driver */
94#define PCI_VENDOR_EMULEX 0x10df /* Emulex */
95#define PCI_VENDOR_SERVERENGINES 0x19a2 /* ServerEngines (BE) */
96#define PCI_PRODUCT_BE2 0x0700 /* BE2 network adapter */
97#define PCI_PRODUCT_BE3 0x0710 /* BE3 network adapter */
98#define PCI_PRODUCT_XE201 0xe220 /* XE201 network adapter */
99#define PCI_PRODUCT_XE201_VF 0xe228 /* XE201 with VF in Lancer */
100
--- 25 unchanged lines hidden (view full) ---
126#define OCE_MAX_CQ OCE_MAX_RQ + OCE_MAX_WQ + 1 /* one MCC queue */
127#define OCE_MAX_CQ_EQ 8 /* Max CQ that can attached to an EQ */
128
129#define OCE_DEFAULT_WQ_EQD 16
130#define OCE_MAX_PACKET_Q 16
131#define OCE_RQ_BUF_SIZE 2048
132#define OCE_LSO_MAX_SIZE (64 * 1024)
133#define LONG_TIMEOUT 30
134#define OCE_MAX_JUMBO_FRAME_SIZE 9018
135#define OCE_MAX_MTU (OCE_MAX_JUMBO_FRAME_SIZE - \
136 ETHER_VLAN_ENCAP_LEN - \
137 ETHER_HDR_LEN)
138
139#define OCE_MAX_TX_ELEMENTS 29
140#define OCE_MAX_TX_DESC 1024
141#define OCE_MAX_TX_SIZE 65535
142#define OCE_MAX_RX_SIZE 4096
--- 332 unchanged lines hidden (view full) ---
475 struct oce_rx_stats rx;
476 struct oce_tx_stats tx;
477 union {
478 struct oce_be_stats be;
479 struct oce_xe201_stats xe201;
480 } u0;
481};
482
483#define INTR_RATE_HWM 15000
484#define INTR_RATE_LWM 10000
485
486#define OCE_MAX_EQD 128u
487#define OCE_MIN_EQD 50u
488
489struct oce_set_eqd {
490 uint32_t eq_id;
491 uint32_t phase;
492 uint32_t delay_multiplier;
493};
494
495struct oce_aic_obj { /* Adaptive interrupt coalescing (AIC) info */
496 boolean_t enable;
497 uint32_t min_eqd; /* in usecs */
498 uint32_t max_eqd; /* in usecs */
499 uint32_t cur_eqd; /* in usecs */
500 uint32_t et_eqd; /* configured value when aic is off */
501 uint64_t ticks;
502 uint64_t intr_prev;
503};
504
505#define MAX_LOCK_DESC_LEN 32
506struct oce_lock {
507 struct mtx mutex;
508 char name[MAX_LOCK_DESC_LEN+1];
509};
510#define OCE_LOCK struct oce_lock
511
512#define LOCK_CREATE(lock, desc) { \
--- 66 unchanged lines hidden (view full) ---
579 void *cb_context;
580 oce_ring_buffer_t *ring;
581 uint32_t ref_count;
582 qstate_t qstate;
583 struct oce_cq *cq[OCE_MAX_CQ_EQ];
584 int cq_valid;
585 struct eq_config eq_cfg;
586 int vector;
587 uint64_t intr;
588};
589
590enum cq_len {
591 CQ_LEN_256 = 256,
592 CQ_LEN_512 = 512,
593 CQ_LEN_1024 = 1024
594};
595
--- 246 unchanged lines hidden (view full) ---
842 uint32_t if_id; /* interface ID */
843 uint32_t nifs; /* number of adapter interfaces, 0 or 1 */
844 uint32_t pmac_id; /* PMAC id */
845
846 uint32_t if_cap_flags;
847
848 uint32_t flow_control;
849 uint32_t promisc;
850
851 struct oce_aic_obj aic_obj[OCE_MAX_EQ];
852
853 /*Vlan Filtering related */
854 eventhandler_tag vlan_attach;
855 eventhandler_tag vlan_detach;
856 uint16_t vlans_added;
857 uint8_t vlan_tag[MAX_VLANS];
858 /*stats */
859 OCE_DMA_MEM stats_mem;
860 struct oce_drv_stats oce_stats_info;
861 struct callout timer;
862 int8_t be3_native;
863 uint16_t qnq_debug_event;
864 uint16_t qnqid;
865 uint16_t pvid;
866
867} OCE_SOFTC, *POCE_SOFTC;
868
869
870
871/**************************************************
872 * BUS memory read/write macros
873 * BE3: accesses three BAR spaces (CFG, CSR, DB)
--- 142 unchanged lines hidden (view full) ---
1016int oce_mbox_get_flashrom_crc(POCE_SOFTC sc, uint8_t *flash_crc,
1017 uint32_t offset, uint32_t optype);
1018int oce_mbox_get_phy_info(POCE_SOFTC sc, struct oce_phy_info *phy_info);
1019int oce_mbox_create_rq(struct oce_rq *rq);
1020int oce_mbox_create_wq(struct oce_wq *wq);
1021int oce_mbox_create_eq(struct oce_eq *eq);
1022int oce_mbox_cq_create(struct oce_cq *cq, uint32_t ncoalesce,
1023 uint32_t is_eventable);
1024int oce_mbox_read_transrecv_data(POCE_SOFTC sc, uint32_t page_num);
1025void oce_mbox_eqd_modify_periodic(POCE_SOFTC sc, struct oce_set_eqd *set_eqd,
1026 int num);
1027void mbx_common_req_hdr_init(struct mbx_hdr *hdr,
1028 uint8_t dom,
1029 uint8_t port,
1030 uint8_t subsys,
1031 uint8_t opcode,
1032 uint32_t timeout, uint32_t pyld_len,
1033 uint8_t version);
1034
--- 64 unchanged lines hidden (view full) ---
1099 }
1100
1101 if (c == 1)
1102 return b;
1103
1104 return 0;
1105}
1106
1107#define TRANSCEIVER_DATA_NUM_ELE 64
1108#define TRANSCEIVER_DATA_SIZE 256
1109#define TRANSCEIVER_A0_SIZE 128
1110#define TRANSCEIVER_A2_SIZE 128
1111#define PAGE_NUM_A0 0xa0
1112#define PAGE_NUM_A2 0xa2
1113#define IS_QNQ_OR_UMC(sc) ((sc->pvid && (sc->function_mode & FNM_UMC_MODE ))\
1114 || (sc->qnqid && (sc->function_mode & FNM_FLEX10_MODE)))
1115