| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Broadcom BCM7xxx System Port Ethernet MAC driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2014 Broadcom Corporation |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 8 | | - * published by the Free Software Foundation. |
|---|
| 9 | 6 | */ |
|---|
| 10 | 7 | |
|---|
| 11 | 8 | #ifndef __BCM_SYSPORT_H |
|---|
| .. | .. |
|---|
| 14 | 11 | #include <linux/bitmap.h> |
|---|
| 15 | 12 | #include <linux/ethtool.h> |
|---|
| 16 | 13 | #include <linux/if_vlan.h> |
|---|
| 17 | | -#include <linux/net_dim.h> |
|---|
| 14 | +#include <linux/dim.h> |
|---|
| 18 | 15 | |
|---|
| 19 | 16 | /* Receive/transmit descriptor format */ |
|---|
| 20 | 17 | #define DESC_ADDR_HI_STATUS_LEN 0x00 |
|---|
| .. | .. |
|---|
| 516 | 513 | |
|---|
| 517 | 514 | #define TDMA_DEBUG 0x64c |
|---|
| 518 | 515 | |
|---|
| 519 | | -/* Transmit/Receive descriptor */ |
|---|
| 520 | | -struct dma_desc { |
|---|
| 521 | | - u32 addr_status_len; |
|---|
| 522 | | - u32 addr_lo; |
|---|
| 523 | | -}; |
|---|
| 524 | | - |
|---|
| 525 | 516 | /* Number of Receive hardware descriptor words */ |
|---|
| 526 | 517 | #define SP_NUM_HW_RX_DESC_WORDS 1024 |
|---|
| 527 | 518 | #define SP_LT_NUM_HW_RX_DESC_WORDS 256 |
|---|
| .. | .. |
|---|
| 530 | 521 | #define SP_NUM_TX_DESC 1536 |
|---|
| 531 | 522 | #define SP_LT_NUM_TX_DESC 256 |
|---|
| 532 | 523 | |
|---|
| 533 | | -#define WORDS_PER_DESC (sizeof(struct dma_desc) / sizeof(u32)) |
|---|
| 524 | +#define WORDS_PER_DESC 2 |
|---|
| 534 | 525 | |
|---|
| 535 | 526 | /* Rx/Tx common counter group.*/ |
|---|
| 536 | 527 | struct bcm_sysport_pkt_counters { |
|---|
| .. | .. |
|---|
| 608 | 599 | u32 alloc_rx_buff_failed; |
|---|
| 609 | 600 | u32 rx_dma_failed; |
|---|
| 610 | 601 | u32 tx_dma_failed; |
|---|
| 602 | + u32 tx_realloc_tsb; |
|---|
| 603 | + u32 tx_realloc_tsb_failed; |
|---|
| 611 | 604 | }; |
|---|
| 612 | 605 | |
|---|
| 613 | 606 | /* HW maintains a large list of counters */ |
|---|
| .. | .. |
|---|
| 709 | 702 | u16 event_ctr; |
|---|
| 710 | 703 | unsigned long packets; |
|---|
| 711 | 704 | unsigned long bytes; |
|---|
| 712 | | - struct net_dim dim; |
|---|
| 705 | + struct dim dim; |
|---|
| 713 | 706 | }; |
|---|
| 714 | 707 | |
|---|
| 715 | 708 | /* Software view of the TX ring */ |
|---|
| 716 | 709 | struct bcm_sysport_tx_ring { |
|---|
| 717 | 710 | spinlock_t lock; /* Ring lock for tx reclaim/xmit */ |
|---|
| 718 | 711 | struct napi_struct napi; /* NAPI per tx queue */ |
|---|
| 719 | | - dma_addr_t desc_dma; /* DMA cookie */ |
|---|
| 720 | 712 | unsigned int index; /* Ring index */ |
|---|
| 721 | 713 | unsigned int size; /* Ring current size */ |
|---|
| 722 | 714 | unsigned int alloc_size; /* Ring one-time allocated size */ |
|---|
| .. | .. |
|---|
| 725 | 717 | unsigned int c_index; /* Last consumer index */ |
|---|
| 726 | 718 | unsigned int clean_index; /* Current clean index */ |
|---|
| 727 | 719 | struct bcm_sysport_cb *cbs; /* Transmit control blocks */ |
|---|
| 728 | | - struct dma_desc *desc_cpu; /* CPU view of the descriptor */ |
|---|
| 729 | 720 | struct bcm_sysport_priv *priv; /* private context backpointer */ |
|---|
| 730 | 721 | unsigned long packets; /* packets statistics */ |
|---|
| 731 | 722 | unsigned long bytes; /* bytes statistics */ |
|---|
| .. | .. |
|---|
| 780 | 771 | u32 wolopts; |
|---|
| 781 | 772 | u8 sopass[SOPASS_MAX]; |
|---|
| 782 | 773 | unsigned int wol_irq_disabled:1; |
|---|
| 774 | + struct clk *clk; |
|---|
| 775 | + struct clk *wol_clk; |
|---|
| 783 | 776 | |
|---|
| 784 | 777 | /* MIB related fields */ |
|---|
| 785 | 778 | struct bcm_sysport_mib mib; |
|---|
| .. | .. |
|---|
| 787 | 780 | /* Ethtool */ |
|---|
| 788 | 781 | u32 msg_enable; |
|---|
| 789 | 782 | DECLARE_BITMAP(filters, RXCHK_BRCM_TAG_MAX); |
|---|
| 783 | + u32 filters_loc[RXCHK_BRCM_TAG_MAX]; |
|---|
| 790 | 784 | |
|---|
| 791 | 785 | struct bcm_sysport_stats64 stats64; |
|---|
| 792 | 786 | |
|---|
| .. | .. |
|---|
| 796 | 790 | /* map information between switch port queues and local queues */ |
|---|
| 797 | 791 | struct notifier_block dsa_notifier; |
|---|
| 798 | 792 | unsigned int per_port_num_tx_queues; |
|---|
| 799 | | - unsigned long queue_bitmap; |
|---|
| 800 | 793 | struct bcm_sysport_tx_ring *ring_map[DSA_MAX_PORTS * 8]; |
|---|
| 801 | 794 | |
|---|
| 802 | 795 | }; |
|---|