• Home
  • Raw
  • Download

Lines Matching refs:mac

361 static int mac_intr_handler(struct cmac *mac)  in mac_intr_handler()  argument
366 static int mac_intr_enable(struct cmac *mac) in mac_intr_enable() argument
371 static int mac_intr_disable(struct cmac *mac) in mac_intr_disable() argument
376 static int mac_intr_clear(struct cmac *mac) in mac_intr_clear() argument
382 static int mac_set_address(struct cmac* mac, const u8 addr[6]) in mac_set_address() argument
385 int port = mac->instance->index; in mac_set_address()
387 vsc_write(mac->adapter, REG_MAC_LOW_ADDR(port), in mac_set_address()
389 vsc_write(mac->adapter, REG_MAC_HIGH_ADDR(port), in mac_set_address()
392 vsc_read(mac->adapter, REG_ING_FFILT_UM_EN, &val); in mac_set_address()
394 vsc_write(mac->adapter, REG_ING_FFILT_UM_EN, val | (port << 28)); in mac_set_address()
396 vsc_write(mac->adapter, REG_ING_FFILT_MASK0, in mac_set_address()
398 vsc_write(mac->adapter, REG_ING_FFILT_MASK1, in mac_set_address()
400 vsc_write(mac->adapter, REG_ING_FFILT_MASK2, in mac_set_address()
405 static int mac_get_address(struct cmac *mac, u8 addr[6]) in mac_get_address() argument
408 int port = mac->instance->index; in mac_get_address()
410 vsc_read(mac->adapter, REG_MAC_LOW_ADDR(port), &addr_lo); in mac_get_address()
411 vsc_read(mac->adapter, REG_MAC_HIGH_ADDR(port), &addr_hi); in mac_get_address()
423 static int mac_reset(struct cmac *mac) in mac_reset() argument
425 int index = mac->instance->index; in mac_reset()
427 run_table(mac->adapter, vsc7326_portinit[index], in mac_reset()
433 static int mac_set_rx_mode(struct cmac *mac, struct t1_rx_mode *rm) in mac_set_rx_mode() argument
436 int port = mac->instance->index; in mac_set_rx_mode()
438 vsc_read(mac->adapter, REG_ING_FFILT_UM_EN, &v); in mac_set_rx_mode()
446 vsc_write(mac->adapter, REG_ING_FFILT_UM_EN, v); in mac_set_rx_mode()
450 static int mac_set_mtu(struct cmac *mac, int mtu) in mac_set_mtu() argument
452 int port = mac->instance->index; in mac_set_mtu()
455 vsc_write(mac->adapter, REG_MAX_LEN(port), mtu + 14 + 4); in mac_set_mtu()
459 static int mac_set_speed_duplex_fc(struct cmac *mac, int speed, int duplex, in mac_set_speed_duplex_fc() argument
463 int enable, port = mac->instance->index; in mac_set_speed_duplex_fc()
472 vsc_read(mac->adapter, REG_MODE_CFG(port), &v); in mac_set_speed_duplex_fc()
479 vsc_write(mac->adapter, REG_MODE_CFG(port), v); in mac_set_speed_duplex_fc()
487 vsc_write(mac->adapter, REG_DEV_SETUP(port), v | 1); /* reset */ in mac_set_speed_duplex_fc()
488 vsc_write(mac->adapter, REG_DEV_SETUP(port), v); in mac_set_speed_duplex_fc()
489 vsc_read(mac->adapter, REG_DBG(port), &v); in mac_set_speed_duplex_fc()
497 vsc_write(mac->adapter, REG_DBG(port), v); in mac_set_speed_duplex_fc()
499 vsc_write(mac->adapter, REG_TX_IFG(port), in mac_set_speed_duplex_fc()
511 vsc_write(mac->adapter, REG_MODE_CFG(port), enable); in mac_set_speed_duplex_fc()
515 vsc_read(mac->adapter, REG_PAUSE_CFG(port), &v); in mac_set_speed_duplex_fc()
524 vsc_write(mac->adapter, REG_PAUSE_CFG(port), v); in mac_set_speed_duplex_fc()
528 static int mac_enable(struct cmac *mac, int which) in mac_enable() argument
531 int port = mac->instance->index; in mac_enable()
534 vsc_write(mac->adapter, REG_HIGH_LOW_WM(1,port), WM_ENABLE); in mac_enable()
536 vsc_read(mac->adapter, REG_MODE_CFG(port), &val); in mac_enable()
541 vsc_write(mac->adapter, REG_MODE_CFG(port), val); in mac_enable()
545 static int mac_disable(struct cmac *mac, int which) in mac_disable() argument
548 int i, port = mac->instance->index; in mac_disable()
551 mac_reset(mac); in mac_disable()
553 vsc_read(mac->adapter, REG_MODE_CFG(port), &val); in mac_disable()
558 vsc_write(mac->adapter, REG_MODE_CFG(port), val); in mac_disable()
559 vsc_read(mac->adapter, REG_MODE_CFG(port), &val); in mac_disable()
563 vsc_write(mac->adapter, CRA(4, port, i), 0); in mac_disable()
566 memset(&mac->stats, 0, sizeof(struct cmac_statistics)); in mac_disable()
571 static void rmon_update(struct cmac *mac, unsigned int addr, u64 *stat) in rmon_update() argument
575 vsc_read(mac->adapter, addr, &v); in rmon_update()
586 static void port_stats_update(struct cmac *mac) in port_stats_update() argument
618 unsigned int port = mac->instance->index; in port_stats_update()
619 u64 *stats = (u64 *)&mac->stats; in port_stats_update()
623 rmon_update(mac, CRA(0x4, port, p->reg), stats + p->offset); in port_stats_update()
625 rmon_update(mac, REG_TX_OK_BYTES(port), &mac->stats.TxOctetsOK); in port_stats_update()
626 rmon_update(mac, REG_RX_OK_BYTES(port), &mac->stats.RxOctetsOK); in port_stats_update()
627 rmon_update(mac, REG_RX_BAD_BYTES(port), &mac->stats.RxOctetsBad); in port_stats_update()
639 static const struct cmac_statistics *mac_update_statistics(struct cmac *mac, in mac_update_statistics() argument
643 mac->instance->ticks >= MAJOR_UPDATE_TICKS) { in mac_update_statistics()
644 port_stats_update(mac); in mac_update_statistics()
645 mac->instance->ticks = 0; in mac_update_statistics()
647 int port = mac->instance->index; in mac_update_statistics()
649 rmon_update(mac, REG_RX_OK_BYTES(port), in mac_update_statistics()
650 &mac->stats.RxOctetsOK); in mac_update_statistics()
651 rmon_update(mac, REG_RX_BAD_BYTES(port), in mac_update_statistics()
652 &mac->stats.RxOctetsBad); in mac_update_statistics()
653 rmon_update(mac, REG_TX_OK_BYTES(port), in mac_update_statistics()
654 &mac->stats.TxOctetsOK); in mac_update_statistics()
655 mac->instance->ticks++; in mac_update_statistics()
657 return &mac->stats; in mac_update_statistics()
660 static void mac_destroy(struct cmac *mac) in mac_destroy() argument
662 kfree(mac); in mac_destroy()
684 struct cmac *mac; in vsc7326_mac_create() local
688 mac = kzalloc(sizeof(*mac) + sizeof(cmac_instance), GFP_KERNEL); in vsc7326_mac_create()
689 if (!mac) in vsc7326_mac_create()
692 mac->ops = &vsc7326_ops; in vsc7326_mac_create()
693 mac->instance = (cmac_instance *)(mac + 1); in vsc7326_mac_create()
694 mac->adapter = adapter; in vsc7326_mac_create()
696 mac->instance->index = index; in vsc7326_mac_create()
697 mac->instance->ticks = 0; in vsc7326_mac_create()
711 return mac; in vsc7326_mac_create()