mirror of
https://github.com/opnsense/src.git
synced 2026-06-04 22:32:43 -04:00
mana: fix tso parameters and set hwassist bits
The parameters for tso on mana were not set correctly. Also the hwassist bits were not set. These two cause tso on mana not work. Fixed the issues and make tso working on mana. Tested by: whu MFC after: 3 days Sponsored by: Microsoft
This commit is contained in:
parent
3afe6b5253
commit
643fd7b4bc
2 changed files with 14 additions and 3 deletions
|
|
@ -186,6 +186,7 @@ struct mana_txq {
|
|||
*/
|
||||
#define MAX_MBUF_FRAGS 30
|
||||
#define MANA_TSO_MAXSEG_SZ PAGE_SIZE
|
||||
#define MANA_TSO_MAX_SZ IP_MAXPACKET
|
||||
|
||||
/* mbuf data and frags dma mappings */
|
||||
struct mana_mbuf_head {
|
||||
|
|
|
|||
|
|
@ -798,8 +798,7 @@ mana_init_port_context(struct mana_port_context *apc)
|
|||
uint32_t tso_maxsize;
|
||||
int err;
|
||||
|
||||
tso_maxsize = MAX_MBUF_FRAGS * MANA_TSO_MAXSEG_SZ -
|
||||
(ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN);
|
||||
tso_maxsize = MANA_TSO_MAX_SZ;
|
||||
|
||||
/* Create DMA tag for tx bufs */
|
||||
err = bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */
|
||||
|
|
@ -2712,6 +2711,7 @@ mana_probe_port(struct mana_context *ac, int port_idx,
|
|||
{
|
||||
struct gdma_context *gc = ac->gdma_dev->gdma_context;
|
||||
struct mana_port_context *apc;
|
||||
uint32_t hwassist;
|
||||
if_t ndev;
|
||||
int err;
|
||||
|
||||
|
|
@ -2774,11 +2774,21 @@ mana_probe_port(struct mana_context *ac, int port_idx,
|
|||
if_setcapenable(ndev, if_getcapabilities(ndev));
|
||||
|
||||
/* TSO parameters */
|
||||
if_sethwtsomax(ndev, MAX_MBUF_FRAGS * MANA_TSO_MAXSEG_SZ -
|
||||
if_sethwtsomax(ndev, MANA_TSO_MAX_SZ -
|
||||
(ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN));
|
||||
if_sethwtsomaxsegcount(ndev, MAX_MBUF_FRAGS);
|
||||
if_sethwtsomaxsegsize(ndev, PAGE_SIZE);
|
||||
|
||||
hwassist = 0;
|
||||
if (if_getcapenable(ndev) & (IFCAP_TSO4 | IFCAP_TSO6))
|
||||
hwassist |= CSUM_TSO;
|
||||
if (if_getcapenable(ndev) & IFCAP_TXCSUM)
|
||||
hwassist |= (CSUM_TCP | CSUM_UDP | CSUM_IP);
|
||||
if (if_getcapenable(ndev) & IFCAP_TXCSUM_IPV6)
|
||||
hwassist |= (CSUM_UDP_IPV6 | CSUM_TCP_IPV6);
|
||||
mana_dbg(NULL, "set hwassist 0x%x\n", hwassist);
|
||||
if_sethwassist(ndev, hwassist);
|
||||
|
||||
ifmedia_init(&apc->media, IFM_IMASK,
|
||||
mana_ifmedia_change, mana_ifmedia_status);
|
||||
ifmedia_add(&apc->media, IFM_ETHER | IFM_AUTO, 0, NULL);
|
||||
|
|
|
|||
Loading…
Reference in a new issue