Jumbo support
Jumbo support
- Subject: Jumbo support
- From: "Sandeep Kumar" <email@hidden>
- Date: 15 Feb 2011 10:53:59 -0000
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
Hi,
I need help to support Jumbo packet support for our ethernet driver. I implemented below
code for the same:
SInt32 IOEthernetInterface::performCommand(
kMCCI_CDC_DATA_DRIVER_CLASS_NAME *
ctr,
UInt32 cmd,
void * arg0,
void * arg1
)
{
SInt32 ret;
assert( arg0 == _arpcom );
if ( ctr == 0 )
return EINVAL;
switch (cmd)
{
case SIOCSIFMTU:
case SIOCGIFDEVMTU:
case SIOCGIFMTU:
ret = (int) ctr->executeCommand(
this, /* client */
(IONetworkController::Action)
&IOEthernetInterface::performGatedCommand,
this, /* target */
ctr, /* param0 */
(void *) cmd, /* param1 */
arg0, /* param2 */
arg1 ); /* param3 */
break;
default:
ret = super::performCommand(ctr,cmd,arg0,arg1);
break;
}
return ret;
}
int IOEthernetInterface::performGatedCommand(void * target,
void * arg1_ctr,
void * arg2_cmd,
void * arg3_0,
void * arg4_1)
)
{
IOEthernetInterface * self = (IOEthernetInterface *) target;
IONetworkController * ctr = (IONetworkController *) arg1_ctr;
struct ifreq * ifr = (struct ifreq *) arg4_1;
SInt ret = EOPNOTSUPP;
switch ( (UInt32) arg2_cmd )
{
case SIOCSIFMTU:
ret = self->syncSIOCSIFMTU( ctr, ifr );
break;
}
return ret;
}
int IOEthernetInterface::syncSIOCSIFMTU( IONetworkController * ctr,
struct ifreq * ifr )
{
#define MTU_TO_FRAMESIZE(x)
((x) + kIOEthernetCRCSize + sizeof(struct ether_header))
SInt32 error = 0;
UInt32 size;
UInt32 maxSize = kIOEthernetMaxPacketSize; // 1518
UInt32 ifrSize = MTU_TO_FRAMESIZE( ifr->ifr_mtu );
UInt32 ctrSize = MTU_TO_FRAMESIZE( getMaxTransferUnit() );
// If change is not necessary, return success without getting the
// controller involved.
if ( ctrSize == ifrSize )
return 0; // no change required
if ( ctr->getMaxPacketSize( &size ) == kIOReturnSuccess )
maxSize = max( size, kIOEthernetMaxPacketSize );
if ( ifrSize > maxSize )
return EINVAL; // MTU is too large for the controller.
// Message the controller if the new MTU requires a non standard
// frame size, or if the controller is currently programmed to
// support an extended frame size which is no longer required.
if ( max( ifrSize, ctrSize ) > kIOEthernetMaxPacketSize )
{
IOReturn ret;
ret = ctr->setMaxPacketSize( max(ifrSize, kIOEthernetMaxPacketSize) );
error = errnoFromReturn( ret );
}
if ( error == 0 )
{
// Success, update the MTU in ifnet.
setMaxTransferUnit( ifr->ifr_mtu );
}
return error;
}
Function performcommand() is calling for getting mtu value, and it is showing MTU value as
9000. But it is not calling cmd for setting MTU value with the command "sudo ifconfig enNN
MTU 2000"
in 10.4, 10.5, and 10.6 MAC OS X environment.
It is not invoking below case:
-----------------------------------------------------------------------
------
case SIOCSIFMTU:
ret = self->syncSIOCSIFMTU( ctr, ifr );
----------------------------------------------
Kindly help me, and guide what i m doing wrong or miss anything.
Thanks in advance,
Sandeep
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden