Changeset View
Standalone View
sys/dev/bnxt/bnxt_hwrm.c
Context not available. | |||||
} | } | ||||
int | int | ||||
bnxt_hwrm_port_qstats(struct bnxt_softc *softc) | |||||
{ | |||||
struct hwrm_port_qstats_input req = {0}; | |||||
int rc = 0; | |||||
bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_PORT_QSTATS); | |||||
req.port_id = htole16(softc->pf.port_id); | |||||
req.rx_stat_host_addr = htole64(softc->hw_rx_port_stats.idi_paddr); | |||||
req.tx_stat_host_addr = htole64(softc->hw_tx_port_stats.idi_paddr); | |||||
shurd: Why 512 here? Should this be a sizeof() or offsetof() or XXX - sizeof(struct rx_port_stats)… | |||||
Not Done Inline ActionsStephen, Those (additional 512 bytes on each struct) are intended for future expansion. Let me explain, newer firmware may add additional counters to these structures and the older driver may not have the new counters defined in bnxt_hsi.h. So having some extra room at the end of tx_port_stats and rx_port_stats will prevent any corruption.. Can I add a comment in code? bhargava.marreddy_broadcom.com: Stephen,
Those (additional 512 bytes on each struct) are intended for future expansion.
Let… | |||||
Not Done Inline ActionsSo why not have two separate allocations, each with a minimal padding amount then rounded up to the nearest page size? Combining them into one allocation seems like a needlessly awkward way to save 4k. If you do want to use a single allocation, you can create a structure for it: struct bnxt_port_stats { struct rx_port_stats rx; char rx_padding[512]; struct tx_port_stats tx; char tx_padding[512]; } And avoid most of the weird pointer math and casting (leaving just req.tx_stat_host_addr = req.rx_stat_host_addr + offsetof(struct bnxt_port_stats, tx); shurd: So why not have two separate allocations, each with a minimal padding amount then rounded up to… | |||||
BNXT_HWRM_LOCK(softc); | |||||
rc = _hwrm_send_message(softc, &req, sizeof(req)); | |||||
BNXT_HWRM_UNLOCK(softc); | |||||
return rc; | |||||
} | |||||
int | |||||
bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt_softc *softc, | bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt_softc *softc, | ||||
struct bnxt_vnic_info *vnic) | struct bnxt_vnic_info *vnic) | ||||
{ | { | ||||
Context not available. |
Why 512 here? Should this be a sizeof() or offsetof() or XXX - sizeof(struct rx_port_stats) instead?