|
164 | 164 | #define GEM_DCFG5 0x0290 /* Design Config 5 */
|
165 | 165 | #define GEM_DCFG6 0x0294 /* Design Config 6 */
|
166 | 166 | #define GEM_DCFG7 0x0298 /* Design Config 7 */
|
| 167 | +#define GEM_DCFG8 0x029C /* Design Config 8 */ |
167 | 168 |
|
168 | 169 | #define GEM_TXBDCTRL 0x04cc /* TX Buffer Descriptor control register */
|
169 | 170 | #define GEM_RXBDCTRL 0x04d0 /* RX Buffer Descriptor control register */
|
170 | 171 |
|
| 172 | +/* Screener Type 2 match registers */ |
| 173 | +#define GEM_SCRT2 0x540 |
| 174 | + |
| 175 | +/* EtherType registers */ |
| 176 | +#define GEM_ETHT 0x06E0 |
| 177 | + |
| 178 | +/* Type 2 compare registers */ |
| 179 | +#define GEM_T2CMPW0 0x0700 |
| 180 | +#define GEM_T2CMPW1 0x0704 |
| 181 | +#define T2CMP_OFST(t2idx) (t2idx * 2) |
| 182 | + |
| 183 | +/* type 2 compare registers |
| 184 | + * each location requires 3 compare regs |
| 185 | + */ |
| 186 | +#define GEM_IP4SRC_CMP(idx) (idx * 3) |
| 187 | +#define GEM_IP4DST_CMP(idx) (idx * 3 + 1) |
| 188 | +#define GEM_PORT_CMP(idx) (idx * 3 + 2) |
| 189 | + |
| 190 | +/* Which screening type 2 EtherType register will be used (0 - 7) */ |
| 191 | +#define SCRT2_ETHT 0 |
| 192 | + |
171 | 193 | #define GEM_ISR(hw_q) (0x0400 + ((hw_q) << 2))
|
172 | 194 | #define GEM_TBQP(hw_q) (0x0440 + ((hw_q) << 2))
|
173 | 195 | #define GEM_TBQPH(hw_q) (0x04C8)
|
|
457 | 479 | #define GEM_DAW64_OFFSET 23
|
458 | 480 | #define GEM_DAW64_SIZE 1
|
459 | 481 |
|
| 482 | +/* Bitfields in DCFG8. */ |
| 483 | +#define GEM_T1SCR_OFFSET 24 |
| 484 | +#define GEM_T1SCR_SIZE 8 |
| 485 | +#define GEM_T2SCR_OFFSET 16 |
| 486 | +#define GEM_T2SCR_SIZE 8 |
| 487 | +#define GEM_SCR2ETH_OFFSET 8 |
| 488 | +#define GEM_SCR2ETH_SIZE 8 |
| 489 | +#define GEM_SCR2CMP_OFFSET 0 |
| 490 | +#define GEM_SCR2CMP_SIZE 8 |
| 491 | + |
460 | 492 | /* Bitfields in TISUBN */
|
461 | 493 | #define GEM_SUBNSINCR_OFFSET 0
|
462 | 494 | #define GEM_SUBNSINCR_SIZE 16
|
|
485 | 517 | #define GEM_RXTSMODE_OFFSET 4 /* RX Descriptor Timestamp Insertion mode */
|
486 | 518 | #define GEM_RXTSMODE_SIZE 2
|
487 | 519 |
|
| 520 | +/* Bitfields in SCRT2 */ |
| 521 | +#define GEM_QUEUE_OFFSET 0 /* Queue Number */ |
| 522 | +#define GEM_QUEUE_SIZE 4 |
| 523 | +#define GEM_VLANPR_OFFSET 4 /* VLAN Priority */ |
| 524 | +#define GEM_VLANPR_SIZE 3 |
| 525 | +#define GEM_VLANEN_OFFSET 8 /* VLAN Enable */ |
| 526 | +#define GEM_VLANEN_SIZE 1 |
| 527 | +#define GEM_ETHT2IDX_OFFSET 9 /* Index to screener type 2 EtherType register */ |
| 528 | +#define GEM_ETHT2IDX_SIZE 3 |
| 529 | +#define GEM_ETHTEN_OFFSET 12 /* EtherType Enable */ |
| 530 | +#define GEM_ETHTEN_SIZE 1 |
| 531 | +#define GEM_CMPA_OFFSET 13 /* Compare A - Index to screener type 2 Compare register */ |
| 532 | +#define GEM_CMPA_SIZE 5 |
| 533 | +#define GEM_CMPAEN_OFFSET 18 /* Compare A Enable */ |
| 534 | +#define GEM_CMPAEN_SIZE 1 |
| 535 | +#define GEM_CMPB_OFFSET 19 /* Compare B - Index to screener type 2 Compare register */ |
| 536 | +#define GEM_CMPB_SIZE 5 |
| 537 | +#define GEM_CMPBEN_OFFSET 24 /* Compare B Enable */ |
| 538 | +#define GEM_CMPBEN_SIZE 1 |
| 539 | +#define GEM_CMPC_OFFSET 25 /* Compare C - Index to screener type 2 Compare register */ |
| 540 | +#define GEM_CMPC_SIZE 5 |
| 541 | +#define GEM_CMPCEN_OFFSET 30 /* Compare C Enable */ |
| 542 | +#define GEM_CMPCEN_SIZE 1 |
| 543 | + |
| 544 | +/* Bitfields in ETHT */ |
| 545 | +#define GEM_ETHTCMP_OFFSET 0 /* EtherType compare value */ |
| 546 | +#define GEM_ETHTCMP_SIZE 16 |
| 547 | + |
| 548 | +/* Bitfields in T2CMPW0 */ |
| 549 | +#define GEM_T2CMP_OFFSET 16 /* 0xFFFF0000 compare value */ |
| 550 | +#define GEM_T2CMP_SIZE 16 |
| 551 | +#define GEM_T2MASK_OFFSET 0 /* 0x0000FFFF compare value or mask */ |
| 552 | +#define GEM_T2MASK_SIZE 16 |
| 553 | + |
| 554 | +/* Bitfields in T2CMPW1 */ |
| 555 | +#define GEM_T2DISMSK_OFFSET 9 /* disable mask */ |
| 556 | +#define GEM_T2DISMSK_SIZE 1 |
| 557 | +#define GEM_T2CMPOFST_OFFSET 7 /* compare offset */ |
| 558 | +#define GEM_T2CMPOFST_SIZE 2 |
| 559 | +#define GEM_T2OFST_OFFSET 0 /* offset value */ |
| 560 | +#define GEM_T2OFST_SIZE 7 |
| 561 | + |
| 562 | +/* Offset for screener type 2 compare values (T2CMPOFST). |
| 563 | + * Note the offset is applied after the specified point, |
| 564 | + * e.g. GEM_T2COMPOFST_ETYPE denotes the EtherType field, so an offset |
| 565 | + * of 12 bytes from this would be the source IP address in an IP header |
| 566 | + */ |
| 567 | +#define GEM_T2COMPOFST_SOF 0 |
| 568 | +#define GEM_T2COMPOFST_ETYPE 1 |
| 569 | +#define GEM_T2COMPOFST_IPHDR 2 |
| 570 | +#define GEM_T2COMPOFST_TCPUDP 3 |
| 571 | + |
| 572 | +/* offset from EtherType to IP address */ |
| 573 | +#define ETYPE_SRCIP_OFFSET 12 |
| 574 | +#define ETYPE_DSTIP_OFFSET 16 |
| 575 | + |
| 576 | +/* offset from IP header to port */ |
| 577 | +#define IPHDR_SRCPORT_OFFSET 0 |
| 578 | +#define IPHDR_DSTPORT_OFFSET 2 |
| 579 | + |
488 | 580 | /* Transmit DMA buffer descriptor Word 1 */
|
489 | 581 | #define GEM_DMA_TXVALID_OFFSET 23 /* timestamp has been captured in the Buffer Descriptor */
|
490 | 582 | #define GEM_DMA_TXVALID_SIZE 1
|
|
585 | 677 | #define gem_writel(port, reg, value) (port)->macb_reg_writel((port), GEM_##reg, (value))
|
586 | 678 | #define queue_readl(queue, reg) (queue)->bp->macb_reg_readl((queue)->bp, (queue)->reg)
|
587 | 679 | #define queue_writel(queue, reg, value) (queue)->bp->macb_reg_writel((queue)->bp, (queue)->reg, (value))
|
| 680 | +#define gem_readl_n(port, reg, idx) (port)->macb_reg_readl((port), GEM_##reg + idx * 4) |
| 681 | +#define gem_writel_n(port, reg, idx, value) (port)->macb_reg_writel((port), GEM_##reg + idx * 4, (value)) |
588 | 682 |
|
589 | 683 | #define PTP_TS_BUFFER_SIZE 128 /* must be power of 2 */
|
590 | 684 |
|
@@ -1026,6 +1120,16 @@ struct macb_queue {
|
1026 | 1120 | #endif
|
1027 | 1121 | };
|
1028 | 1122 |
|
| 1123 | +struct ethtool_rx_fs_item { |
| 1124 | + struct ethtool_rx_flow_spec fs; |
| 1125 | + struct list_head list; |
| 1126 | +}; |
| 1127 | + |
| 1128 | +struct ethtool_rx_fs_list { |
| 1129 | + struct list_head list; |
| 1130 | + unsigned int count; |
| 1131 | +}; |
| 1132 | + |
1029 | 1133 | struct macb {
|
1030 | 1134 | void __iomem *regs;
|
1031 | 1135 | bool native_io;
|
@@ -1092,6 +1196,11 @@ struct macb {
|
1092 | 1196 | struct ptp_clock_info ptp_clock_info;
|
1093 | 1197 | struct tsu_incr tsu_incr;
|
1094 | 1198 | struct hwtstamp_config tstamp_config;
|
| 1199 | + |
| 1200 | + /* RX queue filer rule set*/ |
| 1201 | + struct ethtool_rx_fs_list rx_fs_list; |
| 1202 | + spinlock_t rx_fs_lock; |
| 1203 | + unsigned int max_tuples; |
1095 | 1204 | };
|
1096 | 1205 |
|
1097 | 1206 | #ifdef CONFIG_MACB_USE_HWSTAMP
|
|
0 commit comments