Chinaunix首页 | 论坛 | 博客
  • 博客访问: 192919
  • 博文数量: 60
  • 博客积分: 652
  • 博客等级: 上士
  • 技术积分: 460
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-15 14:26
文章分类
文章存档

2015年(4)

2014年(16)

2013年(16)

2011年(20)

2010年(4)

分类: 嵌入式

2010-05-17 15:57:11

由于上层交换机增加了vlan tag所以ap giga port需要更改以支持从上层交换机过来的1518大包
具体更改的是ethernet.c 中的cvm_oct_change_mtu(struct net_device *dev, int new_mtu)
/**
 * Change the link MTU. Unimplemented
 *
 * @param dev     Device to change
 * @param new_mtu The new MTU
 * @return Zero on success
 */
static int cvm_oct_change_mtu(struct net_device *dev, int new_mtu)
{
    cvm_oct_private_t* priv = (cvm_oct_private_t*)dev->priv;  
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 int vlan_bytes = 4;
#else
 int vlan_bytes = 0;
#endif
    int max_packet = new_mtu + 14 + 4 + vlan_bytes; /* Add ethernet header and FCS, and VLAN if configured. */
    /* Limit the MTU to make sure the ethernet packets are between 64 bytes
        and 65535 bytes */
    if ((max_packet < 64) || (max_packet > 65392))
    {
        printk("MTU must be between %d and %d.\n", 64-14-4-vlan_bytes, 65392-14-4-vlan_bytes);
        return -EINVAL;
    }
    dev->mtu = new_mtu;
    if (priv->isRGMII)
    {
        /* Set the hardware to truncate packets larger than the MTU. The jabber
            register must be set to a multiple of 8 bytes, so round up */
        int interface = INTERFACE(priv->port);
        int index = INDEX(priv->port);
       
        cvmx_write_csr(CVMX_GMXX_RXX_JABBER(index, interface), (max_packet + 7) & ~7u);
    }
    if (OCTEON_IS_MODEL(OCTEON_CN50XX))
    {
        cvmx_pip_frm_len_chkx_t pip_frm;
        pip_frm.u64 = cvmx_read_csr(CVMX_PIP_FRM_LEN_CHKX(0));
        pip_frm.cn50xx.maxlen = max_packet;
        cvmx_write_csr(CVMX_PIP_FRM_LEN_CHKX(0), pip_frm.u64);
    }
    if (octeon_is_pass1() && (new_mtu>CVMX_FPA_PACKET_POOL_SIZE - CVMX_HELPER_FIRST_MBUFF_SKIP - 32))
        printk("Warning: Octeon Pass 1 has problems with chained buffers. You may lose buffers with jumbo frames\n");
    return 0;
}
阅读(2334) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:nand bad block check

给主人留下些什么吧!~~