oce_gld.c revision 1878b97151eb2746480d8b2139fa08a2e8f14df3
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Emulex. All rights reserved.
* Use is subject to license terms.
*/
/*
* Source file containing the implementation of the driver entry points
* and related helper functions
*/
#include <oce_impl.h>
#include <oce_ioctl.h>
/* array of properties supported by this driver */
char *oce_priv_props[] = {
"_tx_ring_size",
"_tx_bcopy_limit",
"_rx_ring_size",
"_rx_bcopy_limit",
};
/* ---[ static function declarations ]----------------------------------- */
static int oce_power10(int power);
/* ---[ GLD entry points ]----------------------------------------------- */
int
oce_m_start(void *arg)
{
int ret;
return (0);
}
return (EIO);
}
return (EIO);
}
return (EIO);
}
return (EIO);
}
if (ret != DDI_SUCCESS) {
return (EIO);
}
return (DDI_SUCCESS);
}
int
{
int qidx = 0;
int ret;
if (ret != DDI_SUCCESS)
goto start_fail;
if (ret != DDI_SUCCESS) {
"Interrupt handler setup failed with %d", ret);
(void) oce_teardown_intr(dev);
goto start_fail;
}
/* get link status */
} else {
"(f,s,d,pp)=(0x%x, 0x%x, 0x%x, 0x%x)",
}
/* enable interrupts */
/* arm the eqs */
}
/* update state */
return (DDI_SUCCESS);
return (DDI_FAILURE);
} /* oce_start */
void
oce_m_stop(void *arg)
{
/* disable interrupts */
return;
}
}
void
{
/* disable interrupts */
(void) oce_teardown_intr(dev);
/* complete the pending Tx */
/* Release all the locks */
} /* oce_stop */
int
{
struct ether_addr *mca_drv_list;
int ret;
int i;
/* check the address */
if ((mca[0] & 0x1) == 0) {
return (EINVAL);
}
/* Allocate the local array for holding the addresses temporarily */
if (add) {
/* check if we exceeded hw max supported */
/* copy entire dev mca to the mbx */
bcopy((void*)mca_drv_list,
(void*)mca_hw_list,
/* Append the new one to local list */
sizeof (struct ether_addr));
}
} else {
/* copy only if it does not match */
hwlistp++;
}
}
}
goto finish;
}
} else {
}
if (ret != 0) {
return (EIO);
}
/*
* Copy the local structure to dev structure
*/
new_mcnt * sizeof (struct ether_addr));
}
return (0);
} /* oce_m_multicast */
int
{
int ret;
return (DDI_SUCCESS);
}
/* Delete previous one and add new one */
if (ret != DDI_SUCCESS) {
return (EIO);
}
/* Set the New MAC addr earlier is no longer valid */
if (ret != DDI_SUCCESS) {
return (EIO);
}
return (ret);
} /* oce_m_unicast */
mblk_t *
{
return (NULL);
}
/* Save the Pointer since mp will be freed in case of copy */
/* Hardcode wq since we have only one */
/* reschedule Tx */
/* restore the chain */
break;
}
}
return (rmp);
} /* oce_send */
{
switch (cap) {
case MAC_CAPAB_HCKSUM: {
*csum_flags = HCKSUM_ENABLE |
break;
}
case MAC_CAPAB_LSO: {
if (dev->lso_capable) {
} else {
}
break;
}
default:
break;
}
return (ret);
} /* oce_m_getcap */
int
{
int ret = 0;
switch (id) {
case MAC_PROP_MTU: {
ret = 0;
break;
}
break;
}
if (0 == ret) {
break;
}
break;
}
case MAC_PROP_FLOWCTRL: {
switch (flowctrl) {
case LINK_FLOWCTRL_NONE:
fc = 0;
break;
case LINK_FLOWCTRL_RX:
break;
case LINK_FLOWCTRL_TX:
break;
case LINK_FLOWCTRL_BI:
break;
default:
break;
} /* switch flowctrl */
if (ret)
break;
break;
break;
}
/* call to set flow control */
/* store the new fc setting on success */
if (ret == 0) {
}
break;
}
case MAC_PROP_PRIVATE:
break;
default:
break;
} /* switch id */
return (ret);
} /* oce_m_setprop */
int
{
switch (id) {
case MAC_PROP_ADV_10GFDX_CAP:
case MAC_PROP_EN_10GFDX_CAP:
break;
case MAC_PROP_DUPLEX: {
*mode = LINK_DUPLEX_FULL;
else
break;
}
case MAC_PROP_SPEED: {
*speed = 0;
}
break;
}
case MAC_PROP_FLOWCTRL: {
*fc = LINK_FLOWCTRL_BI;
*fc = LINK_FLOWCTRL_TX;
*fc = LINK_FLOWCTRL_RX;
else if (dev->flow_control == 0)
*fc = LINK_FLOWCTRL_NONE;
else
break;
}
case MAC_PROP_PRIVATE:
break;
default:
break;
} /* switch id */
return (ret);
} /* oce_m_getprop */
void
{
switch (pr_num) {
case MAC_PROP_AUTONEG:
case MAC_PROP_EN_AUTONEG:
case MAC_PROP_ADV_1000FDX_CAP:
case MAC_PROP_EN_1000FDX_CAP:
case MAC_PROP_ADV_1000HDX_CAP:
case MAC_PROP_EN_1000HDX_CAP:
case MAC_PROP_ADV_100FDX_CAP:
case MAC_PROP_EN_100FDX_CAP:
case MAC_PROP_ADV_100HDX_CAP:
case MAC_PROP_EN_100HDX_CAP:
case MAC_PROP_ADV_10FDX_CAP:
case MAC_PROP_EN_10FDX_CAP:
case MAC_PROP_ADV_10HDX_CAP:
case MAC_PROP_EN_10HDX_CAP:
case MAC_PROP_ADV_100T4_CAP:
case MAC_PROP_EN_100T4_CAP:
case MAC_PROP_ADV_10GFDX_CAP:
case MAC_PROP_EN_10GFDX_CAP:
case MAC_PROP_SPEED:
case MAC_PROP_DUPLEX:
break;
case MAC_PROP_MTU:
break;
case MAC_PROP_PRIVATE: {
char valstr[64];
int value;
} else {
return;
}
break;
}
}
} /* oce_m_propinfo */
/*
* function to handle dlpi streams message from GLDv3 mac layer
*/
void
{
int cmd;
int ret;
return;
}
switch (cmd) {
case OCE_ISSUE_MBOX: {
if (ret != 0) {
} else {
}
break;
}
default:
break;
}
} /* oce_m_ioctl */
int
{
int ret = 0;
return (ret);
}
/* remember the setting */
return (ret);
}
if (ret == DDI_SUCCESS)
return (ret);
} /* oce_m_promiscuous */
static int
oce_power10(int power)
{
int ret = 1;
while (power) {
ret *= 10;
power--;
}
return (ret);
}
/*
* function to set a private property.
* Called from the set_prop GLD entry point
*
* dev - sofware handle to the device
* name - string containing the property name
* size - length of the string in name
* val - pointer to a location where the value to set is stored
*
* return EINVAL => invalid value in val 0 => success
*/
static int
{
long result;
return (ret);
}
if (result <= OCE_WQ_BUF_SIZE) {
ret = 0;
} else {
}
}
if (result <= OCE_RQ_BUF_SIZE) {
ret = 0;
} else {
}
}
return (ret);
} /* oce_set_priv_prop */
/*
* function to get the value of a private property. Called from get_prop
*
* dev - software handle to the device
* name - string containing the property name
* size - length of the string contained name
* val - [OUT] pointer to the location where the result is returned
*
* return EINVAL => invalid request 0 => success
*/
static int
{
int value;
} else {
return (ENOTSUP);
}
return (0);
} /* oce_get_priv_prop */