| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | | - * Copyright (c) 2014-2017 Broadcom |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 5 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 6 | | - * published by the Free Software Foundation. |
|---|
| 3 | + * Copyright (c) 2014-2020 Broadcom |
|---|
| 7 | 4 | */ |
|---|
| 8 | 5 | |
|---|
| 9 | 6 | #ifndef __BCMGENET_H__ |
|---|
| .. | .. |
|---|
| 16 | 13 | #include <linux/mii.h> |
|---|
| 17 | 14 | #include <linux/if_vlan.h> |
|---|
| 18 | 15 | #include <linux/phy.h> |
|---|
| 19 | | -#include <linux/net_dim.h> |
|---|
| 16 | +#include <linux/dim.h> |
|---|
| 17 | +#include <linux/ethtool.h> |
|---|
| 20 | 18 | |
|---|
| 21 | 19 | /* total number of Buffer Descriptors, same for Rx/Tx */ |
|---|
| 22 | 20 | #define TOTAL_DESC 256 |
|---|
| .. | .. |
|---|
| 34 | 32 | #define DMA_MAX_BURST_LENGTH 0x10 |
|---|
| 35 | 33 | |
|---|
| 36 | 34 | /* misc. configuration */ |
|---|
| 35 | +#define MAX_NUM_OF_FS_RULES 16 |
|---|
| 37 | 36 | #define CLEAR_ALL_HFB 0xFF |
|---|
| 38 | 37 | #define DMA_FC_THRESH_HI (TOTAL_DESC >> 4) |
|---|
| 39 | 38 | #define DMA_FC_THRESH_LO 5 |
|---|
| .. | .. |
|---|
| 147 | 146 | u32 alloc_rx_buff_failed; |
|---|
| 148 | 147 | u32 rx_dma_failed; |
|---|
| 149 | 148 | u32 tx_dma_failed; |
|---|
| 149 | + u32 tx_realloc_tsb; |
|---|
| 150 | + u32 tx_realloc_tsb_failed; |
|---|
| 150 | 151 | }; |
|---|
| 151 | 152 | |
|---|
| 152 | 153 | #define UMAC_HD_BKP_CTRL 0x004 |
|---|
| .. | .. |
|---|
| 254 | 255 | #define RBUF_CHK_CTRL 0x14 |
|---|
| 255 | 256 | #define RBUF_RXCHK_EN (1 << 0) |
|---|
| 256 | 257 | #define RBUF_SKIP_FCS (1 << 4) |
|---|
| 258 | +#define RBUF_L3_PARSE_DIS (1 << 5) |
|---|
| 257 | 259 | |
|---|
| 258 | 260 | #define RBUF_ENERGY_CTRL 0x9c |
|---|
| 259 | 261 | #define RBUF_EEE_EN (1 << 0) |
|---|
| .. | .. |
|---|
| 273 | 275 | #define RBUF_FLTR_LEN_SHIFT 8 |
|---|
| 274 | 276 | |
|---|
| 275 | 277 | #define TBUF_CTRL 0x00 |
|---|
| 278 | +#define TBUF_64B_EN (1 << 0) |
|---|
| 276 | 279 | #define TBUF_BP_MC 0x0C |
|---|
| 277 | 280 | #define TBUF_ENERGY_CTRL 0x14 |
|---|
| 278 | 281 | #define TBUF_EEE_EN (1 << 0) |
|---|
| .. | .. |
|---|
| 309 | 312 | #define UMAC_IRQ_HFB_SM (1 << 10) |
|---|
| 310 | 313 | #define UMAC_IRQ_HFB_MM (1 << 11) |
|---|
| 311 | 314 | #define UMAC_IRQ_MPD_R (1 << 12) |
|---|
| 315 | +#define UMAC_IRQ_WAKE_EVENT (UMAC_IRQ_HFB_SM | UMAC_IRQ_HFB_MM | \ |
|---|
| 316 | + UMAC_IRQ_MPD_R) |
|---|
| 312 | 317 | #define UMAC_IRQ_RXDMA_MBDONE (1 << 13) |
|---|
| 313 | 318 | #define UMAC_IRQ_RXDMA_PDONE (1 << 14) |
|---|
| 314 | 319 | #define UMAC_IRQ_RXDMA_BDONE (1 << 15) |
|---|
| .. | .. |
|---|
| 582 | 587 | u16 event_ctr; |
|---|
| 583 | 588 | unsigned long packets; |
|---|
| 584 | 589 | unsigned long bytes; |
|---|
| 585 | | - struct net_dim dim; |
|---|
| 590 | + struct dim dim; |
|---|
| 586 | 591 | }; |
|---|
| 587 | 592 | |
|---|
| 588 | 593 | struct bcmgenet_rx_ring { |
|---|
| .. | .. |
|---|
| 607 | 612 | struct bcmgenet_priv *priv; |
|---|
| 608 | 613 | }; |
|---|
| 609 | 614 | |
|---|
| 615 | +enum bcmgenet_rxnfc_state { |
|---|
| 616 | + BCMGENET_RXNFC_STATE_UNUSED = 0, |
|---|
| 617 | + BCMGENET_RXNFC_STATE_DISABLED, |
|---|
| 618 | + BCMGENET_RXNFC_STATE_ENABLED |
|---|
| 619 | +}; |
|---|
| 620 | + |
|---|
| 621 | +struct bcmgenet_rxnfc_rule { |
|---|
| 622 | + struct list_head list; |
|---|
| 623 | + struct ethtool_rx_flow_spec fs; |
|---|
| 624 | + enum bcmgenet_rxnfc_state state; |
|---|
| 625 | +}; |
|---|
| 626 | + |
|---|
| 610 | 627 | /* device context */ |
|---|
| 611 | 628 | struct bcmgenet_priv { |
|---|
| 612 | 629 | void __iomem *base; |
|---|
| .. | .. |
|---|
| 625 | 642 | struct enet_cb *rx_cbs; |
|---|
| 626 | 643 | unsigned int num_rx_bds; |
|---|
| 627 | 644 | unsigned int rx_buf_len; |
|---|
| 645 | + struct bcmgenet_rxnfc_rule rxnfc_rules[MAX_NUM_OF_FS_RULES]; |
|---|
| 646 | + struct list_head rxnfc_list; |
|---|
| 628 | 647 | |
|---|
| 629 | 648 | struct bcmgenet_rx_ring rx_rings[DESC_INDEX + 1]; |
|---|
| 630 | 649 | |
|---|
| .. | .. |
|---|
| 662 | 681 | unsigned int irq0_stat; |
|---|
| 663 | 682 | |
|---|
| 664 | 683 | /* HW descriptors/checksum variables */ |
|---|
| 665 | | - bool desc_64b_en; |
|---|
| 666 | | - bool desc_rxchk_en; |
|---|
| 667 | 684 | bool crc_fwd_en; |
|---|
| 668 | 685 | |
|---|
| 669 | | - unsigned int dma_rx_chk_bit; |
|---|
| 686 | + u32 dma_max_burst_length; |
|---|
| 670 | 687 | |
|---|
| 671 | 688 | u32 msg_enable; |
|---|
| 672 | 689 | |
|---|
| .. | .. |
|---|
| 677 | 694 | /* WOL */ |
|---|
| 678 | 695 | struct clk *clk_wol; |
|---|
| 679 | 696 | u32 wolopts; |
|---|
| 697 | + u8 sopass[SOPASS_MAX]; |
|---|
| 698 | + bool wol_active; |
|---|
| 680 | 699 | |
|---|
| 681 | 700 | struct bcmgenet_mib_counters mib; |
|---|
| 682 | 701 | |
|---|