/* * linux/drivers/acorn/net/etherh.c * * Copyright (C) 2000-2002 Russell King * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * NS8390 I-cubed EtherH and ANT EtherM specific driver * Thanks to I-Cubed for information on their cards. * EtherM conversion (C) 1999 Chris Kemp and Tim Watterton * EtherM integration (C) 2000 Aleph One Ltd (Tak-Shing Chan) * EtherM integration re-engineered by Russell King. * * Changelog: * 08-12-1996 RMK 1.00 Created * RMK 1.03 Added support for EtherLan500 cards * 23-11-1997 RMK 1.04 Added media autodetection * 16-04-1998 RMK 1.05 Improved media autodetection * 10-02-2000 RMK 1.06 Updated for 2.3.43 * 13-05-2000 RMK 1.07 Updated for 2.3.99-pre8 * 12-10-1999 CK/TEW EtherM driver first release * 21-12-2000 TTC EtherH/EtherM integration * 25-12-2000 RMK 1.08 Clean integration of EtherM into this driver. * 03-01-2002 RMK 1.09 Always enable IRQs if we're in the nic slot. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define EI_SHIFT(x) (ei_local->reg_offset[x]) #define ei_inb(_p) readb((void __iomem *)_p) #define ei_outb(_v,_p) writeb(_v,(void __iomem *)_p) #define ei_inb_p(_p) readb((void __iomem *)_p) #define ei_outb_p(_v,_p) writeb(_v,(void __iomem *)_p) #define DRV_NAME "etherh" #define DRV_VERSION "1.11" static char version[] = "EtherH/EtherM Driver (c) 2002-2004 Russell King " DRV_VERSION "\n"; #include "lib8390.c" static u32 etherh_msg_enable; struct etherh_priv { void __iomem *ioc_fast; void __iomem *memc; void __iomem *dma_base; unsigned int id; void __iomem *ctrl_port; unsigned char ctrl; u32 supported; }; struct etherh_data { unsigned long ns8390_offset; unsigned long dataport_offset; unsigned long ctrlport_offset; int ctrl_ioc; const char name[16]; u32 supported; unsigned char tx_start_page; unsigned char stop_page; }; MODULE_AUTHOR("Russell King"); MODULE_DESCRIPTION("EtherH/EtherM driver"); MODULE_LICENSE("GPL"); #define ETHERH500_DATAPORT 0x800 /* MEMC */ #define ETHERH500_NS8390 0x000 /* MEMC */ #define ETHERH500_CTRLPORT 0x800 /* IOC */ #define ETHERH600_DATAPORT 0x040 /* MEMC */ #define ETHERH600_NS8390 0x800 /* MEMC */ #define ETHERH600_CTRLPORT 0x200 /* MEMC */ #define ETHERH_CP_IE 1 #define ETHERH_CP_IF 2 #define ETHERH_CP_HEARTBEAT 2 #define ETHERH_TX_START_PAGE 1 #define ETHERH_STOP_PAGE 127 /* * These came from CK/TEW */ #define ETHERM_DATAPORT 0x200 /* MEMC */ #define ETHERM_NS8390 0x800 /* MEMC */ #define ETHERM_CTRLPORT 0x23c /* MEMC */ #define ETHERM_TX_START_PAGE 64 #define ETHERM_STOP_PAGE 127 /* ------------------------------------------------------------------------ */ #define etherh_priv(dev) \ ((struct etherh_priv *)(((char *)netdev_priv(dev)) + sizeof(struct ei_device))) static inline void etherh_set_ctrl(struct etherh_priv *eh, unsigned char mask) { unsigned char ctrl = eh->ctrl | mask; eh->ctrl = ctrl; writeb(ctrl, eh->ctrl_port); } static inline void etherh_clr_ctrl(struct etherh_priv *eh, unsigned char mask) { unsigned char ctrl = eh->ctrl & ~mask; eh->ctrl = ctrl; writeb(ctrl, eh->ctrl_port); } static inline unsigned int etherh_get_stat(struct etherh_priv *eh) { return readb(eh->ctrl_port); } static void etherh_irq_enable(ecard_t *ec, int irqnr) { struct etherh_priv *eh = ec->irq_data; etherh_set_ctrl(eh, ETHERH_CP_IE); } static void etherh_irq_disable(ecard_t *ec, int irqnr) { struct etherh_priv *eh = ec->irq_data; etherh_clr_ctrl(eh, ETHERH_CP_IE); } static expansioncard_ops_t etherh_ops = { .irqenable = etherh_irq_enable, .irqdisable = etherh_irq_disable, }; static void etherh_setif(struct net_device *dev) { struct ei_device *ei_local = netdev_priv(dev); unsigned long flags; void __iomem *addr; local_irq_save(flags); /* set the interface type */ switch (etherh_priv(dev)->id) { case PROD_I3_ETHERLAN600: case PROD_I3_ETHERLAN600A: addr = (void __iomem *)dev->base_addr + EN0_RCNTHI; switch (dev->if_port) { case IF_PORT_10BASE2: writeb((readb(addr) & 0xf8) | 1, addr); break; case IF_PORT_10BASET: writeb((readb(addr) & 0xf8), addr); break; } break; case PROD_I3_ETHERLAN500: switch (dev->if_port) { case IF_PORT_10BASE2: etherh_clr_ctrl(etherh_priv(dev), ETHERH_CP_IF); break; case IF_PORT_10BASET: etherh_set_ctrl(etherh_priv(dev), ETHERH_CP_IF); break; } break; default: break; } local_irq_restore(flags); } static int etherh_getifstat(struct net_device *dev) { struct ei_device *ei_local = netdev_priv(dev); void __iomem *addr; int stat = 0; switch (etherh_priv(dev)->id) { case PROD_I3_ETHERLAN600: case PROD_I3_ETHERLAN600A: addr = (void __iomem *)dev->base_addr + EN0_RCNTHI; switch (dev->if_port) { case IF_PORT_10BASE2: stat = 1; break; case IF_PORT_10BASET: stat = readb(addr) & 4; break; } break; case PROD_I3_ETHERLAN500: switch (dev->if_port) { case IF_PORT_10BASE2: stat = 1; break; case IF_PORT_10BASET: stat = etherh_get_stat(etherh_priv(dev)) & ETHERH_CP
---
# Yardstick TC042 config file
# Measure network latency using testpmd and pktgen-dpdk

schema: "yardstick:task:0.1"

scenarios:
-
  type: PktgenDPDKLatency
  options:
    packetsize: 64
    rate: 100

  host: demeter.yardstick-TC042
  target: poseidon.yardstick-TC042

  runner:
    type: Iteration
    iterations: 1
    interval: 1

  sla:
    max_latency: 100
    action: monitor

context:
  name: yardstick-TC042
  image: yardstick-image-pktgen-ready
  flavor: yardstick-pktgen-dpdk.flavor
  user: ubuntu

  placement_groups:
    pgrp1:
      policy: "availability"

  servers:
    demeter:
      floating_ip: true
      placement: "pgrp1"
    poseidon:
      floating_ip: true
      placement: "pgrp1"

  networks:
    test:
      cidr: '10.0.1.0/24'
    test2:
      cidr: '10.0.2.0/24'
    test3:
      cidr: '10.0.3.0/24'
ETHERH_TX_START_PAGE, .stop_page = ETHERH_STOP_PAGE, }; static struct etherh_data etherlan600a_data = { .ns8390_offset = ETHERH600_NS8390, .dataport_offset = ETHERH600_NS8390 + ETHERH600_DATAPORT, .ctrlport_offset = ETHERH600_NS8390 + ETHERH600_CTRLPORT, .name = "i3 EtherH 600A", .supported = SUPPORTED_10baseT_Half | SUPPORTED_TP | SUPPORTED_BNC | SUPPORTED_Autoneg, .tx_start_page = ETHERH_TX_START_PAGE, .stop_page = ETHERH_STOP_PAGE, }; static const struct ecard_id etherh_ids[] = { { MANU_ANT, PROD_ANT_ETHERM, ðerm_data }, { MANU_I3, PROD_I3_ETHERLAN500, ðerlan500_data }, { MANU_I3, PROD_I3_ETHERLAN600, ðerlan600_data }, { MANU_I3, PROD_I3_ETHERLAN600A, ðerlan600a_data }, { 0xffff, 0xffff } }; static struct ecard_driver etherh_driver = { .probe = etherh_probe, .remove = etherh_remove, .id_table = etherh_ids, .drv = { .name = DRV_NAME, }, }; static int __init etherh_init(void) { int i; for (i = 0; i < 16; i++) { etherh_regoffsets[i] = i << 2; etherm_regoffsets[i] = i << 5; } return ecard_register_driver(ðerh_driver); } static void __exit etherh_exit(void) { ecard_remove_driver(ðerh_driver); } module_init(etherh_init); module_exit(etherh_exit);