aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc/nic.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/sfc/nic.h')
-rw-r--r--drivers/net/ethernet/sfc/nic.h251
1 files changed, 91 insertions, 160 deletions
diff --git a/drivers/net/ethernet/sfc/nic.h b/drivers/net/ethernet/sfc/nic.h
index 93d10cbbd1cf..31ff9084d9a4 100644
--- a/drivers/net/ethernet/sfc/nic.h
+++ b/drivers/net/ethernet/sfc/nic.h
@@ -381,6 +381,7 @@ enum {
381 * @efx: Pointer back to main interface structure 381 * @efx: Pointer back to main interface structure
382 * @wol_filter_id: Wake-on-LAN packet filter id 382 * @wol_filter_id: Wake-on-LAN packet filter id
383 * @stats: Hardware statistics 383 * @stats: Hardware statistics
384 * @vf: Array of &struct siena_vf objects
384 * @vf_buftbl_base: The zeroth buffer table index used to back VF queues. 385 * @vf_buftbl_base: The zeroth buffer table index used to back VF queues.
385 * @vfdi_status: Common VFDI status page to be dmad to VF address space. 386 * @vfdi_status: Common VFDI status page to be dmad to VF address space.
386 * @local_addr_list: List of local addresses. Protected by %local_lock. 387 * @local_addr_list: List of local addresses. Protected by %local_lock.
@@ -394,6 +395,7 @@ struct siena_nic_data {
394 int wol_filter_id; 395 int wol_filter_id;
395 u64 stats[SIENA_STAT_COUNT]; 396 u64 stats[SIENA_STAT_COUNT];
396#ifdef CONFIG_SFC_SRIOV 397#ifdef CONFIG_SFC_SRIOV
398 struct siena_vf *vf;
397 struct efx_channel *vfdi_channel; 399 struct efx_channel *vfdi_channel;
398 unsigned vf_buftbl_base; 400 unsigned vf_buftbl_base;
399 struct efx_buffer vfdi_status; 401 struct efx_buffer vfdi_status;
@@ -405,59 +407,77 @@ struct siena_nic_data {
405}; 407};
406 408
407enum { 409enum {
408 EF10_STAT_tx_bytes = GENERIC_STAT_COUNT, 410 EF10_STAT_port_tx_bytes = GENERIC_STAT_COUNT,
409 EF10_STAT_tx_packets, 411 EF10_STAT_port_tx_packets,
410 EF10_STAT_tx_pause, 412 EF10_STAT_port_tx_pause,
411 EF10_STAT_tx_control, 413 EF10_STAT_port_tx_control,
412 EF10_STAT_tx_unicast, 414 EF10_STAT_port_tx_unicast,
413 EF10_STAT_tx_multicast, 415 EF10_STAT_port_tx_multicast,
414 EF10_STAT_tx_broadcast, 416 EF10_STAT_port_tx_broadcast,
415 EF10_STAT_tx_lt64, 417 EF10_STAT_port_tx_lt64,
416 EF10_STAT_tx_64, 418 EF10_STAT_port_tx_64,
417 EF10_STAT_tx_65_to_127, 419 EF10_STAT_port_tx_65_to_127,
418 EF10_STAT_tx_128_to_255, 420 EF10_STAT_port_tx_128_to_255,
419 EF10_STAT_tx_256_to_511, 421 EF10_STAT_port_tx_256_to_511,
420 EF10_STAT_tx_512_to_1023, 422 EF10_STAT_port_tx_512_to_1023,
421 EF10_STAT_tx_1024_to_15xx, 423 EF10_STAT_port_tx_1024_to_15xx,
422 EF10_STAT_tx_15xx_to_jumbo, 424 EF10_STAT_port_tx_15xx_to_jumbo,
423 EF10_STAT_rx_bytes, 425 EF10_STAT_port_rx_bytes,
424 EF10_STAT_rx_bytes_minus_good_bytes, 426 EF10_STAT_port_rx_bytes_minus_good_bytes,
425 EF10_STAT_rx_good_bytes, 427 EF10_STAT_port_rx_good_bytes,
426 EF10_STAT_rx_bad_bytes, 428 EF10_STAT_port_rx_bad_bytes,
427 EF10_STAT_rx_packets, 429 EF10_STAT_port_rx_packets,
428 EF10_STAT_rx_good, 430 EF10_STAT_port_rx_good,
429 EF10_STAT_rx_bad, 431 EF10_STAT_port_rx_bad,
430 EF10_STAT_rx_pause, 432 EF10_STAT_port_rx_pause,
431 EF10_STAT_rx_control, 433 EF10_STAT_port_rx_control,
434 EF10_STAT_port_rx_unicast,
435 EF10_STAT_port_rx_multicast,
436 EF10_STAT_port_rx_broadcast,
437 EF10_STAT_port_rx_lt64,
438 EF10_STAT_port_rx_64,
439 EF10_STAT_port_rx_65_to_127,
440 EF10_STAT_port_rx_128_to_255,
441 EF10_STAT_port_rx_256_to_511,
442 EF10_STAT_port_rx_512_to_1023,
443 EF10_STAT_port_rx_1024_to_15xx,
444 EF10_STAT_port_rx_15xx_to_jumbo,
445 EF10_STAT_port_rx_gtjumbo,
446 EF10_STAT_port_rx_bad_gtjumbo,
447 EF10_STAT_port_rx_overflow,
448 EF10_STAT_port_rx_align_error,
449 EF10_STAT_port_rx_length_error,
450 EF10_STAT_port_rx_nodesc_drops,
451 EF10_STAT_port_rx_pm_trunc_bb_overflow,
452 EF10_STAT_port_rx_pm_discard_bb_overflow,
453 EF10_STAT_port_rx_pm_trunc_vfifo_full,
454 EF10_STAT_port_rx_pm_discard_vfifo_full,
455 EF10_STAT_port_rx_pm_trunc_qbb,
456 EF10_STAT_port_rx_pm_discard_qbb,
457 EF10_STAT_port_rx_pm_discard_mapping,
458 EF10_STAT_port_rx_dp_q_disabled_packets,
459 EF10_STAT_port_rx_dp_di_dropped_packets,
460 EF10_STAT_port_rx_dp_streaming_packets,
461 EF10_STAT_port_rx_dp_hlb_fetch,
462 EF10_STAT_port_rx_dp_hlb_wait,
432 EF10_STAT_rx_unicast, 463 EF10_STAT_rx_unicast,
464 EF10_STAT_rx_unicast_bytes,
433 EF10_STAT_rx_multicast, 465 EF10_STAT_rx_multicast,
466 EF10_STAT_rx_multicast_bytes,
434 EF10_STAT_rx_broadcast, 467 EF10_STAT_rx_broadcast,
435 EF10_STAT_rx_lt64, 468 EF10_STAT_rx_broadcast_bytes,
436 EF10_STAT_rx_64, 469 EF10_STAT_rx_bad,
437 EF10_STAT_rx_65_to_127, 470 EF10_STAT_rx_bad_bytes,
438 EF10_STAT_rx_128_to_255,
439 EF10_STAT_rx_256_to_511,
440 EF10_STAT_rx_512_to_1023,
441 EF10_STAT_rx_1024_to_15xx,
442 EF10_STAT_rx_15xx_to_jumbo,
443 EF10_STAT_rx_gtjumbo,
444 EF10_STAT_rx_bad_gtjumbo,
445 EF10_STAT_rx_overflow, 471 EF10_STAT_rx_overflow,
446 EF10_STAT_rx_align_error, 472 EF10_STAT_tx_unicast,
447 EF10_STAT_rx_length_error, 473 EF10_STAT_tx_unicast_bytes,
448 EF10_STAT_rx_nodesc_drops, 474 EF10_STAT_tx_multicast,
449 EF10_STAT_rx_pm_trunc_bb_overflow, 475 EF10_STAT_tx_multicast_bytes,
450 EF10_STAT_rx_pm_discard_bb_overflow, 476 EF10_STAT_tx_broadcast,
451 EF10_STAT_rx_pm_trunc_vfifo_full, 477 EF10_STAT_tx_broadcast_bytes,
452 EF10_STAT_rx_pm_discard_vfifo_full, 478 EF10_STAT_tx_bad,
453 EF10_STAT_rx_pm_trunc_qbb, 479 EF10_STAT_tx_bad_bytes,
454 EF10_STAT_rx_pm_discard_qbb, 480 EF10_STAT_tx_overflow,
455 EF10_STAT_rx_pm_discard_mapping,
456 EF10_STAT_rx_dp_q_disabled_packets,
457 EF10_STAT_rx_dp_di_dropped_packets,
458 EF10_STAT_rx_dp_streaming_packets,
459 EF10_STAT_rx_dp_hlb_fetch,
460 EF10_STAT_rx_dp_hlb_wait,
461 EF10_STAT_COUNT 481 EF10_STAT_COUNT
462}; 482};
463 483
@@ -483,12 +503,21 @@ enum {
483 * @must_restore_piobufs: Flag: PIO buffers have yet to be restored after MC 503 * @must_restore_piobufs: Flag: PIO buffers have yet to be restored after MC
484 * reboot 504 * reboot
485 * @rx_rss_context: Firmware handle for our RSS context 505 * @rx_rss_context: Firmware handle for our RSS context
506 * @rx_rss_context_exclusive: Whether our RSS context is exclusive or shared
486 * @stats: Hardware statistics 507 * @stats: Hardware statistics
487 * @workaround_35388: Flag: firmware supports workaround for bug 35388 508 * @workaround_35388: Flag: firmware supports workaround for bug 35388
488 * @must_check_datapath_caps: Flag: @datapath_caps needs to be revalidated 509 * @must_check_datapath_caps: Flag: @datapath_caps needs to be revalidated
489 * after MC reboot 510 * after MC reboot
490 * @datapath_caps: Capabilities of datapath firmware (FLAGS1 field of 511 * @datapath_caps: Capabilities of datapath firmware (FLAGS1 field of
491 * %MC_CMD_GET_CAPABILITIES response) 512 * %MC_CMD_GET_CAPABILITIES response)
513 * @rx_dpcpu_fw_id: Firmware ID of the RxDPCPU
514 * @tx_dpcpu_fw_id: Firmware ID of the TxDPCPU
515 * @vport_id: The function's vport ID, only relevant for PFs
516 * @must_probe_vswitching: Flag: vswitching has yet to be setup after MC reboot
517 * @pf_index: The number for this PF, or the parent PF if this is a VF
518#ifdef CONFIG_SFC_SRIOV
519 * @vf: Pointer to VF data structure
520#endif
492 */ 521 */
493struct efx_ef10_nic_data { 522struct efx_ef10_nic_data {
494 struct efx_buffer mcdi_buf; 523 struct efx_buffer mcdi_buf;
@@ -503,126 +532,27 @@ struct efx_ef10_nic_data {
503 unsigned int piobuf_handle[EF10_TX_PIOBUF_COUNT]; 532 unsigned int piobuf_handle[EF10_TX_PIOBUF_COUNT];
504 bool must_restore_piobufs; 533 bool must_restore_piobufs;
505 u32 rx_rss_context; 534 u32 rx_rss_context;
535 bool rx_rss_context_exclusive;
506 u64 stats[EF10_STAT_COUNT]; 536 u64 stats[EF10_STAT_COUNT];
507 bool workaround_35388; 537 bool workaround_35388;
508 bool must_check_datapath_caps; 538 bool must_check_datapath_caps;
509 u32 datapath_caps; 539 u32 datapath_caps;
510}; 540 unsigned int rx_dpcpu_fw_id;
511 541 unsigned int tx_dpcpu_fw_id;
512/* 542 unsigned int vport_id;
513 * On the SFC9000 family each port is associated with 1 PCI physical 543 bool must_probe_vswitching;
514 * function (PF) handled by sfc and a configurable number of virtual 544 unsigned int pf_index;
515 * functions (VFs) that may be handled by some other driver, often in 545 u8 port_id[ETH_ALEN];
516 * a VM guest. The queue pointer registers are mapped in both PF and
517 * VF BARs such that an 8K region provides access to a single RX, TX
518 * and event queue (collectively a Virtual Interface, VI or VNIC).
519 *
520 * The PF has access to all 1024 VIs while VFs are mapped to VIs
521 * according to VI_BASE and VI_SCALE: VF i has access to VIs numbered
522 * in range [VI_BASE + i << VI_SCALE, VI_BASE + i + 1 << VI_SCALE).
523 * The number of VIs and the VI_SCALE value are configurable but must
524 * be established at boot time by firmware.
525 */
526
527/* Maximum VI_SCALE parameter supported by Siena */
528#define EFX_VI_SCALE_MAX 6
529/* Base VI to use for SR-IOV. Must be aligned to (1 << EFX_VI_SCALE_MAX),
530 * so this is the smallest allowed value. */
531#define EFX_VI_BASE 128U
532/* Maximum number of VFs allowed */
533#define EFX_VF_COUNT_MAX 127
534/* Limit EVQs on VFs to be only 8k to reduce buffer table reservation */
535#define EFX_MAX_VF_EVQ_SIZE 8192UL
536/* The number of buffer table entries reserved for each VI on a VF */
537#define EFX_VF_BUFTBL_PER_VI \
538 ((EFX_MAX_VF_EVQ_SIZE + 2 * EFX_MAX_DMAQ_SIZE) * \
539 sizeof(efx_qword_t) / EFX_BUF_SIZE)
540
541#ifdef CONFIG_SFC_SRIOV 546#ifdef CONFIG_SFC_SRIOV
542 547 unsigned int vf_index;
543/* SIENA */ 548 struct ef10_vf *vf;
544static inline bool efx_siena_sriov_wanted(struct efx_nic *efx) 549#endif
545{ 550 u8 vport_mac[ETH_ALEN];
546 return efx->vf_count != 0; 551};
547}
548
549static inline bool efx_siena_sriov_enabled(struct efx_nic *efx)
550{
551 return efx->vf_init_count != 0;
552}
553
554static inline unsigned int efx_vf_size(struct efx_nic *efx)
555{
556 return 1 << efx->vi_scale;
557}
558 552
559int efx_init_sriov(void); 553int efx_init_sriov(void);
560void efx_siena_sriov_probe(struct efx_nic *efx);
561int efx_siena_sriov_init(struct efx_nic *efx);
562void efx_siena_sriov_mac_address_changed(struct efx_nic *efx);
563void efx_siena_sriov_tx_flush_done(struct efx_nic *efx, efx_qword_t *event);
564void efx_siena_sriov_rx_flush_done(struct efx_nic *efx, efx_qword_t *event);
565void efx_siena_sriov_event(struct efx_channel *channel, efx_qword_t *event);
566void efx_siena_sriov_desc_fetch_err(struct efx_nic *efx, unsigned dmaq);
567void efx_siena_sriov_flr(struct efx_nic *efx, unsigned flr);
568void efx_siena_sriov_reset(struct efx_nic *efx);
569void efx_siena_sriov_fini(struct efx_nic *efx);
570void efx_fini_sriov(void); 554void efx_fini_sriov(void);
571 555
572/* EF10 */
573static inline bool efx_ef10_sriov_wanted(struct efx_nic *efx) { return false; }
574static inline int efx_ef10_sriov_init(struct efx_nic *efx) { return -EOPNOTSUPP; }
575static inline void efx_ef10_sriov_mac_address_changed(struct efx_nic *efx) {}
576static inline void efx_ef10_sriov_reset(struct efx_nic *efx) {}
577static inline void efx_ef10_sriov_fini(struct efx_nic *efx) {}
578
579#else
580
581/* SIENA */
582static inline bool efx_siena_sriov_wanted(struct efx_nic *efx) { return false; }
583static inline bool efx_siena_sriov_enabled(struct efx_nic *efx) { return false; }
584static inline unsigned int efx_vf_size(struct efx_nic *efx) { return 0; }
585static inline int efx_init_sriov(void) { return 0; }
586static inline void efx_siena_sriov_probe(struct efx_nic *efx) {}
587static inline int efx_siena_sriov_init(struct efx_nic *efx) { return -EOPNOTSUPP; }
588static inline void efx_siena_sriov_mac_address_changed(struct efx_nic *efx) {}
589static inline void efx_siena_sriov_tx_flush_done(struct efx_nic *efx,
590 efx_qword_t *event) {}
591static inline void efx_siena_sriov_rx_flush_done(struct efx_nic *efx,
592 efx_qword_t *event) {}
593static inline void efx_siena_sriov_event(struct efx_channel *channel,
594 efx_qword_t *event) {}
595static inline void efx_siena_sriov_desc_fetch_err(struct efx_nic *efx,
596 unsigned dmaq) {}
597static inline void efx_siena_sriov_flr(struct efx_nic *efx, unsigned flr) {}
598static inline void efx_siena_sriov_reset(struct efx_nic *efx) {}
599static inline void efx_siena_sriov_fini(struct efx_nic *efx) {}
600static inline void efx_fini_sriov(void) {}
601
602/* EF10 */
603static inline bool efx_ef10_sriov_wanted(struct efx_nic *efx) { return false; }
604static inline int efx_ef10_sriov_init(struct efx_nic *efx) { return -EOPNOTSUPP; }
605static inline void efx_ef10_sriov_mac_address_changed(struct efx_nic *efx) {}
606static inline void efx_ef10_sriov_reset(struct efx_nic *efx) {}
607static inline void efx_ef10_sriov_fini(struct efx_nic *efx) {}
608
609#endif
610
611/* FALCON */
612static inline bool efx_falcon_sriov_wanted(struct efx_nic *efx) { return false; }
613static inline int efx_falcon_sriov_init(struct efx_nic *efx) { return -EOPNOTSUPP; }
614static inline void efx_falcon_sriov_mac_address_changed(struct efx_nic *efx) {}
615static inline void efx_falcon_sriov_reset(struct efx_nic *efx) {}
616static inline void efx_falcon_sriov_fini(struct efx_nic *efx) {}
617
618int efx_siena_sriov_set_vf_mac(struct net_device *dev, int vf, u8 *mac);
619int efx_siena_sriov_set_vf_vlan(struct net_device *dev, int vf,
620 u16 vlan, u8 qos);
621int efx_siena_sriov_get_vf_config(struct net_device *dev, int vf,
622 struct ifla_vf_info *ivf);
623int efx_siena_sriov_set_vf_spoofchk(struct net_device *net_dev, int vf,
624 bool spoofchk);
625
626struct ethtool_ts_info; 556struct ethtool_ts_info;
627int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel); 557int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel);
628void efx_ptp_defer_probe_with_channel(struct efx_nic *efx); 558void efx_ptp_defer_probe_with_channel(struct efx_nic *efx);
@@ -654,6 +584,7 @@ extern const struct efx_nic_type falcon_a1_nic_type;
654extern const struct efx_nic_type falcon_b0_nic_type; 584extern const struct efx_nic_type falcon_b0_nic_type;
655extern const struct efx_nic_type siena_a0_nic_type; 585extern const struct efx_nic_type siena_a0_nic_type;
656extern const struct efx_nic_type efx_hunt_a0_nic_type; 586extern const struct efx_nic_type efx_hunt_a0_nic_type;
587extern const struct efx_nic_type efx_hunt_a0_vf_nic_type;
657 588
658/************************************************************************** 589/**************************************************************************
659 * 590 *