From b0c554c3a50b73bddfb059bd4bd8b85944efa265 Mon Sep 17 00:00:00 2001 From: Navdeep Parhar Date: Sat, 17 Sep 2016 22:13:03 +0000 Subject: [PATCH] cxgbe/t4_tom: The SMAC entry for a VI is at a different location in the T6. Sponsored by: Chelsio Communications --- sys/dev/cxgbe/adapter.h | 1 + sys/dev/cxgbe/common/t4_hw.c | 4 ++++ sys/dev/cxgbe/t4_main.c | 4 ++++ sys/dev/cxgbe/tom/t4_tom.c | 3 +-- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index b8ca1eb53bf3..1666bc781ddf 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -231,6 +231,7 @@ struct vi_info { int if_flags; uint16_t *rss, *nm_rss; + int smt_idx; /* for convenience */ uint16_t viid; int16_t xact_addr_filt;/* index of exact MAC address filter */ uint16_t rss_size; /* size of VI's RSS table slice */ diff --git a/sys/dev/cxgbe/common/t4_hw.c b/sys/dev/cxgbe/common/t4_hw.c index 976c9bbb5f7c..553993a66f2b 100644 --- a/sys/dev/cxgbe/common/t4_hw.c +++ b/sys/dev/cxgbe/common/t4_hw.c @@ -8100,6 +8100,10 @@ int t4_port_init(struct adapter *adap, int mbox, int pf, int vf, int port_id) return ret; p->vi[0].viid = ret; + if (chip_id(adap) <= CHELSIO_T5) + p->vi[0].smt_idx = (ret & 0x7f) << 1; + else + p->vi[0].smt_idx = (ret & 0x7f); p->tx_chan = j; p->rx_chan_map = t4_get_mps_bg_map(adap, j); p->lport = j; diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index f2635076e2f6..37d265a90c4f 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -2030,6 +2030,10 @@ vcxgbe_attach(device_t dev) return (-rc); } vi->viid = rc; + if (chip_id(sc) <= CHELSIO_T5) + vi->smt_idx = (rc & 0x7f) << 1; + else + vi->smt_idx = (rc & 0x7f); param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_RSSINFO) | diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index 04f9bcda423c..3df2313fa998 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -538,7 +538,6 @@ select_rcv_wscale(void) } extern int always_keepalive; -#define VIID_SMACIDX(v) (((unsigned int)(v) & 0x7f) << 1) /* * socket so could be a listening socket too. @@ -569,7 +568,7 @@ calc_opt0(struct socket *so, struct vi_info *vi, struct l2t_entry *e, opt0 |= V_L2T_IDX(e->idx); if (vi != NULL) { - opt0 |= V_SMAC_SEL(VIID_SMACIDX(vi->viid)); + opt0 |= V_SMAC_SEL(vi->smt_idx); opt0 |= V_TX_CHAN(vi->pi->tx_chan); }