oce_gld.c revision 3abb112f8485b33b6b9b52b340bede0a333c10bf
/*
* 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 © 2003-2011 Emulex. All rights reserved. */
/*
* 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",
};
extern int pow10[];
/* ---[ static function declarations ]----------------------------------- */
/* ---[ GLD entry points ]----------------------------------------------- */
int
oce_m_start(void *arg)
{
int ret;
return (0);
}
return (EIO);
}
if (ret != DDI_SUCCESS) {
return (EIO);
}
return (DDI_SUCCESS);
}
int
{
int qidx = 0;
struct link_status link = {0};
/* get link status */
}
}
/* enable interrupts */
/* arm the eqs */
}
/* TODO update state */
return (DDI_SUCCESS);
} /* oce_start */
void
oce_m_stop(void *arg)
{
/* disable interrupts */
return;
}
}
void
{
int qidx;
/* disable interrupts */
}
/* 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 */
if (new_mcnt < OCE_MAX_MCA) {
/* 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));
}
new_mcnt++;
} else {
/* copy only if it does not match */
hwlistp++;
} else {
new_mcnt--;
}
}
}
goto finish;
}
if (new_mcnt > OCE_MAX_MCA) {
} else {
}
if (ret != 0) {
return (EIO);
}
/*
* Copy the local structure to dev structure
*/
new_mcnt * sizeof (struct ether_addr));
}
"mcast %s, addr=%02x:%02x:%02x:%02x:%02x:%02x, num_mca=%d",
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 */
/*
* Hashing policy for load balancing over the set of TX rings
* available to the driver.
*/
mblk_t *
{
return (NULL);
}
/*
* Hash to pick a wq
*/
/* 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: {
struct link_status link = {0};
*speed = 0;
if (dev->link_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: {
break;
}
case OCE_QUERY_DRIVER_DATA: {
struct oce_driver_query *drv_query =
/* if the driver version does not match bail */
"One Connect version mismatch");
break;
}
/* fill the return values */
(sizeof (OCE_MOD_NAME) > 32) ?
31 : sizeof (OCE_MOD_NAME));
sizeof (OCE_VERSION));
} else {
}
payload_length = sizeof (struct oce_driver_query);
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 */
/*
* 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 */