summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/if_oce.c75
-rw-r--r--sys/dev/pci/if_ocevar.h23
2 files changed, 34 insertions, 64 deletions
diff --git a/sys/dev/pci/if_oce.c b/sys/dev/pci/if_oce.c
index 9aaf03e711d..4300b3b087b 100644
--- a/sys/dev/pci/if_oce.c
+++ b/sys/dev/pci/if_oce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_oce.c,v 1.49 2012/11/08 19:48:37 mikeb Exp $ */
+/* $OpenBSD: if_oce.c,v 1.50 2012/11/09 18:40:12 mikeb Exp $ */
/*
* Copyright (c) 2012 Mike Belopuhov
@@ -213,8 +213,8 @@ void oce_first_mcc(struct oce_softc *sc);
int oce_get_fw_config(struct oce_softc *sc);
int oce_check_native_mode(struct oce_softc *sc);
int oce_create_iface(struct oce_softc *sc, uint8_t *macaddr);
-int oce_config_vlan(struct oce_softc *sc, uint32_t if_id,
- struct normal_vlan *vtag_arr, int vtag_cnt, int untagged, int promisc);
+int oce_config_vlan(struct oce_softc *sc, struct normal_vlan *vtags,
+ int nvtags, int untagged, int promisc);
int oce_set_flow_control(struct oce_softc *sc, uint32_t flow_control);
int oce_config_rss(struct oce_softc *sc, uint32_t if_id, int enable);
int oce_update_mcast(struct oce_softc *sc,
@@ -1560,6 +1560,13 @@ oce_init(void *arg)
oce_iff(sc);
+ /* Enable VLAN promiscuous mode */
+ if (oce_config_vlan(sc, NULL, 0, 1, 1))
+ goto error;
+
+ if (oce_set_flow_control(sc, sc->flow_control))
+ goto error;
+
for_all_rq_queues(sc, rq, i) {
rq->mtu = ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN +
ETHER_VLAN_ENCAP_LEN;
@@ -2703,34 +2710,32 @@ int
oce_create_iface(struct oce_softc *sc, uint8_t *macaddr)
{
struct mbx_create_common_iface cmd;
- uint32_t capab_flags, capab_en_flags;
+ uint32_t caps, caps_en;
int err = 0;
/* interface capabilities to give device when creating interface */
- capab_flags = OCE_CAPAB_FLAGS;
+ caps = MBX_RX_IFACE_FLAGS_BROADCAST | MBX_RX_IFACE_FLAGS_UNTAGGED |
+ MBX_RX_IFACE_FLAGS_PROMISC | MBX_RX_IFACE_FLAGS_MCAST_PROMISC |
+ MBX_RX_IFACE_FLAGS_RSS;
/* capabilities to enable by default (others set dynamically) */
- capab_en_flags = OCE_CAPAB_ENABLE;
+ caps_en = MBX_RX_IFACE_FLAGS_BROADCAST | MBX_RX_IFACE_FLAGS_UNTAGGED;
- if (IS_XE201(sc)) {
+ if (!IS_XE201(sc)) {
/* LANCER A0 workaround */
- capab_en_flags &= ~MBX_RX_IFACE_FLAGS_PASS_L3L4_ERR;
- capab_flags &= ~MBX_RX_IFACE_FLAGS_PASS_L3L4_ERR;
+ caps |= MBX_RX_IFACE_FLAGS_PASS_L3L4_ERR;
+ caps_en |= MBX_RX_IFACE_FLAGS_PASS_L3L4_ERR;
}
/* enable capabilities controlled via driver startup parameters */
if (sc->rss_enable)
- capab_en_flags |= MBX_RX_IFACE_FLAGS_RSS;
- else {
- capab_en_flags &= ~MBX_RX_IFACE_FLAGS_RSS;
- capab_flags &= ~MBX_RX_IFACE_FLAGS_RSS;
- }
+ caps_en |= MBX_RX_IFACE_FLAGS_RSS;
bzero(&cmd, sizeof(cmd));
cmd.params.req.version = 0;
- cmd.params.req.cap_flags = htole32(capab_flags);
- cmd.params.req.enable_flags = htole32(capab_en_flags);
+ cmd.params.req.cap_flags = htole32(caps);
+ cmd.params.req.enable_flags = htole32(caps_en);
if (macaddr != NULL) {
bcopy(macaddr, &cmd.params.req.mac_addr[0], ETHER_ADDR_LEN);
cmd.params.req.mac_invalid = 0;
@@ -2747,49 +2752,34 @@ oce_create_iface(struct oce_softc *sc, uint8_t *macaddr)
if (macaddr != NULL)
sc->pmac_id = letoh32(cmd.params.rsp.pmac_id);
- sc->nifs++;
-
- sc->if_cap_flags = capab_en_flags;
-
- /* Enable VLAN Promisc on HW */
- err = oce_config_vlan(sc, (uint8_t)sc->if_id, NULL, 0, 1, 1);
- if (err)
- return (err);
-
- /* set default flow control */
- err = oce_set_flow_control(sc, sc->flow_control);
- if (err)
- return (err);
-
return (0);
}
/**
* @brief Function to send the mbx command to configure vlan
* @param sc software handle to the device
- * @param if_id interface identifier index
- * @param vtag_arr array of vlan tags
- * @param vtag_cnt number of elements in array
+ * @param vtags array of vlan tags
+ * @param nvtags number of elements in array
* @param untagged boolean TRUE/FLASE
* @param promisc flag to enable/disable VLAN promiscuous mode
* @returns 0 on success, EIO on failure
*/
int
-oce_config_vlan(struct oce_softc *sc, uint32_t if_id,
- struct normal_vlan *vtag_arr, int vtag_cnt, int untagged, int promisc)
+oce_config_vlan(struct oce_softc *sc, struct normal_vlan *vtags, int nvtags,
+ int untagged, int promisc)
{
struct mbx_common_config_vlan cmd;
bzero(&cmd, sizeof(cmd));
- cmd.params.req.if_id = if_id;
+ cmd.params.req.if_id = sc->if_id;
cmd.params.req.promisc = promisc;
cmd.params.req.untagged = untagged;
- cmd.params.req.num_vlans = vtag_cnt;
+ cmd.params.req.num_vlans = nvtags;
if (!promisc)
- bcopy(vtag_arr, cmd.params.req.tags.normal_vlans,
- vtag_cnt * sizeof(struct normal_vlan));
+ bcopy(vtags, cmd.params.req.tags.normal_vlans,
+ nvtags * sizeof(struct normal_vlan));
return (oce_cmd(sc, SUBSYS_COMMON, OPCODE_COMMON_CONFIG_IFACE_VLAN,
OCE_MBX_VER_V0, &cmd, sizeof(cmd)));
@@ -2908,10 +2898,11 @@ oce_set_promisc(struct oce_softc *sc, int enable)
req = &cmd.params.req;
req->if_id = sc->if_id;
- req->iface_flags_mask = MBX_RX_IFACE_FLAGS_PROMISC |
- MBX_RX_IFACE_FLAGS_VLAN_PROMISC;
+
if (enable)
- req->iface_flags = req->iface_flags_mask;
+ req->iface_flags = req->iface_flags_mask =
+ MBX_RX_IFACE_FLAGS_PROMISC |
+ MBX_RX_IFACE_FLAGS_VLAN_PROMISC;
return (oce_cmd(sc, SUBSYS_COMMON, OPCODE_COMMON_SET_IFACE_RX_FILTER,
OCE_MBX_VER_V0, &cmd, sizeof(cmd)));
diff --git a/sys/dev/pci/if_ocevar.h b/sys/dev/pci/if_ocevar.h
index 2115ccfe2c3..b228a4c6a3f 100644
--- a/sys/dev/pci/if_ocevar.h
+++ b/sys/dev/pci/if_ocevar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ocevar.h,v 1.8 2012/11/08 19:48:37 mikeb Exp $ */
+/* $OpenBSD: if_ocevar.h,v 1.9 2012/11/09 18:40:13 mikeb Exp $ */
/*-
* Copyright (C) 2012 Emulex
@@ -38,9 +38,6 @@
* Costa Mesa, CA 92626
*/
-/* OCE device driver module component revision informaiton */
-#define COMPONENT_REVISION "4.2.127.0"
-
/* This should be powers of 2. Like 2,4,8 & 16 */
#define OCE_MAX_RSS 4 /* TODO: 8 */
#define OCE_LEGACY_MODE_RSS 4 /* For BE3 Legacy mode */
@@ -76,20 +73,6 @@
#define OCE_FC_TX 0x00000001
#define OCE_FC_RX 0x00000002
-/* Interface capabilities to give device when creating interface */
-#define OCE_CAPAB_FLAGS (MBX_RX_IFACE_FLAGS_BROADCAST | \
- MBX_RX_IFACE_FLAGS_UNTAGGED | \
- MBX_RX_IFACE_FLAGS_PROMISC | \
- MBX_RX_IFACE_FLAGS_MCAST_PROMISC)
- /* MBX_RX_IFACE_FLAGS_RSS | \ */
- /* MBX_RX_IFACE_FLAGS_PASS_L3L4_ERR) */
-
-/* Interface capabilities to enable by default (others set dynamically) */
-#define OCE_CAPAB_ENABLE (MBX_RX_IFACE_FLAGS_BROADCAST | \
- MBX_RX_IFACE_FLAGS_UNTAGGED)
- /* MBX_RX_IFACE_FLAGS_RSS | \ */
- /* MBX_RX_IFACE_FLAGS_PASS_L3L4_ERR) */
-
#define BSWAP_8(x) ((x) & 0xff)
#define BSWAP_16(x) ((BSWAP_8(x) << 8) | BSWAP_8((x) >> 8))
#define BSWAP_32(x) ((BSWAP_16(x) << 16) | BSWAP_16((x) >> 16))
@@ -311,13 +294,9 @@ struct oce_softc {
ushort rss_enable;
uint32_t if_id; /* interface ID */
- uint32_t nifs; /* number of adapter interfaces, 0 or 1 */
uint32_t pmac_id; /* PMAC id */
-
char macaddr[ETHER_ADDR_LEN];
- uint32_t if_cap_flags;
-
uint32_t flow_control;
uint32_t pvid;