/*
* 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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Xen inter-domain backend - GLDv3 driver edition.
*
* A traditional GLDv3 driver used to communicate with a guest
* domain. This driver is typically plumbed underneath the IP stack
* or a software ethernet bridge.
*/
#include "xnb.h"
#include <sys/mac_provider.h>
#include <sys/mac_ether.h>
/* Required driver entry points for GLDv3 */
static int xnbu_m_start(void *);
static void xnbu_m_stop(void *);
static int xnbu_m_set_mac_addr(void *, const uint8_t *);
static int xnbu_m_set_promiscuous(void *, boolean_t);
typedef struct xnbu {
} xnbu_t;
NULL,
NULL,
};
static void
{
/*
* If a transmit attempt failed because we ran out of ring
* space and there is now some space, re-enable the transmit
* path.
*/
if (xnbup->u_need_sched &&
}
if (sched)
}
static mblk_t *
{
/*
* Take a conservative approach - if the checksum is blank
* then we fill it in.
*
* If the consumer of the packet is IP then we might actually
* only need fill it in if the data is not validated, but how
* do we know who might end up with the packet?
*/
if ((flags & NETTXF_csum_blank) != 0) {
/*
* The checksum is blank. We must fill it in here.
*/
/*
* Because we calculated the checksum ourselves we
* know that it must be good, so we assert this.
*/
}
if ((flags & NETTXF_data_validated) != 0) {
/*
* The checksum is asserted valid.
*/
}
return (mp);
}
static uint16_t
{
uint16_t r = 0;
/*
* If the protocol stack has requested checksum
* offload, inform the peer that we have not
* calculated the checksum.
*/
if ((pflags & HCK_FULLCKSUM) != 0)
r |= NETRXF_csum_blank;
return (r);
}
static boolean_t
{
/*
* We are able to send packets now - bring them on.
*/
return (B_TRUE);
}
static boolean_t
{
return (B_TRUE);
}
static void
{
}
/*ARGSUSED*/
static boolean_t
{
return (B_TRUE);
}
static mblk_t *
{
/*
* If we consumed all of the mblk_t's offered, perhaps we need
* to indicate that we can accept more. Otherwise we are full
* and need to wait for space.
*/
} else {
}
/*
* If a previous transmit attempt failed because the ring
* was full, try again now.
*/
if (sched)
return (mp);
}
/*
* xnbu_m_set_mac_addr() -- set the physical network address on the board
*/
/* ARGSUSED */
static int
{
return (0);
}
/*
* xnbu_m_set_multicast() -- set (enable) or disable a multicast address
*/
/*ARGSUSED*/
static int
{
/*
* We always accept all packets from the peer, so nothing to
* do for enable or disable.
*/
return (0);
}
/*
* xnbu_m_set_promiscuous() -- set or reset promiscuous mode on the board
*/
/* ARGSUSED */
static int
{
/*
* We always accept all packets from the peer, so nothing to
* do for enable or disable.
*/
return (0);
}
/*
* xnbu_m_start() -- start the board receiving and enable interrupts.
*/
/*ARGSUSED*/
static int
{
return (0);
}
/*
* xnbu_m_stop() - disable hardware
*/
/*ARGSUSED*/
static void
{
}
static int
{
#define map_stat(q, r) \
case (MAC_STAT_##q): \
break
switch (stat) {
default:
return (ENOTSUP);
}
return (0);
}
static boolean_t
{
switch (cap) {
case MAC_CAPAB_HCKSUM: {
break;
}
default:
return (B_FALSE);
}
return (B_TRUE);
}
/*
* All packets are passed to the peer, so adding and removing
* multicast addresses is meaningless.
*/
static boolean_t
{
return (B_TRUE);
}
static boolean_t
{
return (B_TRUE);
}
static int
{
};
int err;
switch (cmd) {
case DDI_ATTACH:
break;
case DDI_RESUME:
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
return (DDI_FAILURE);
}
return (DDI_FAILURE);
}
/*
* Initialize pointers to device specific functions which will be
* used by the generic layer.
*/
/*
* xnbu is a virtual device, and it is not associated with any
* physical device. Its margin size is determined by the maximum
* packet size it can handle, which is PAGESIZE.
*/
/*
* Register ourselves with the GLDv3 interface.
*/
if (err != 0) {
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
/*ARGSUSED*/
int
{
switch (cmd) {
case DDI_DETACH:
break;
case DDI_SUSPEND:
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
(xnbp->xnb_tx_buf_count > 0)) {
return (DDI_FAILURE);
}
/*
* Attempt to unregister the mac.
*/
return (DDI_FAILURE);
return (DDI_SUCCESS);
}
};
};
int
_init(void)
{
int i;
i = mod_install(&modlinkage);
if (i != DDI_SUCCESS)
mac_fini_ops(&ops);
return (i);
}
int
_fini(void)
{
int i;
i = mod_remove(&modlinkage);
if (i == DDI_SUCCESS)
mac_fini_ops(&ops);
return (i);
}
int
{
}