diff options
author | Vipul Pandya <vipul@chelsio.com> | 2013-04-29 00:04:40 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-04-29 15:24:44 -0400 |
commit | b407a4a90800ff4a89b7280302602245806bf498 (patch) | |
tree | 6f70112f317703015ac9f5d2b400fc946e9c9b29 /drivers/net | |
parent | 9ef603a04121eee3e6b9bdaf95e18006a64cf2c4 (diff) |
cxgb4: Support CPL_SGE_EGR_UPDATEs encapsulated in a CPL_FW4_MSG
Newer firmware can post CPL_SGE_EGR_UPDATE message encapsulated in a
CPL_FW4_MSG as follows
flit0 rss_header (if DropRSS == 0 in IQ context)
flit1 CPL_FW4_MSG cpl
flit2 rss_header w/opcode CPL_SGE_EGR_UPDATE
flit3 CPL_SGE_EGR_UPDATE cpl
So FW4_MSG CPLs with a newly created type of FW_TYPE_RSSCPL have the
CPL_SGE_EGR_UPDATE CPL message in flit 2 of the FW4_MSG. Firmware can still
post regular CPL_SGE_EGR_UPDATE messages, so the drivers need to handle
both.
This patch also writes a new parameter to firmware requesting encapsulated
EGR_UPDATE. This allows firmware with this support to not break older drivers.
Signed-off-by: Vipul Pandya <vipul@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 31 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/t4_msg.h | 10 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h | 38 |
3 files changed, 76 insertions, 3 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 656f9340ae30..c59ec3ddaa66 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -645,6 +645,21 @@ static int fwevtq_handler(struct sge_rspq *q, const __be64 *rsp, | |||
645 | u8 opcode = ((const struct rss_header *)rsp)->opcode; | 645 | u8 opcode = ((const struct rss_header *)rsp)->opcode; |
646 | 646 | ||
647 | rsp++; /* skip RSS header */ | 647 | rsp++; /* skip RSS header */ |
648 | |||
649 | /* FW can send EGR_UPDATEs encapsulated in a CPL_FW4_MSG. | ||
650 | */ | ||
651 | if (unlikely(opcode == CPL_FW4_MSG && | ||
652 | ((const struct cpl_fw4_msg *)rsp)->type == FW_TYPE_RSSCPL)) { | ||
653 | rsp++; | ||
654 | opcode = ((const struct rss_header *)rsp)->opcode; | ||
655 | rsp++; | ||
656 | if (opcode != CPL_SGE_EGR_UPDATE) { | ||
657 | dev_err(q->adap->pdev_dev, "unexpected FW4/CPL %#x on FW event queue\n" | ||
658 | , opcode); | ||
659 | goto out; | ||
660 | } | ||
661 | } | ||
662 | |||
648 | if (likely(opcode == CPL_SGE_EGR_UPDATE)) { | 663 | if (likely(opcode == CPL_SGE_EGR_UPDATE)) { |
649 | const struct cpl_sge_egr_update *p = (void *)rsp; | 664 | const struct cpl_sge_egr_update *p = (void *)rsp; |
650 | unsigned int qid = EGR_QID(ntohl(p->opcode_qid)); | 665 | unsigned int qid = EGR_QID(ntohl(p->opcode_qid)); |
@@ -679,6 +694,7 @@ static int fwevtq_handler(struct sge_rspq *q, const __be64 *rsp, | |||
679 | } else | 694 | } else |
680 | dev_err(q->adap->pdev_dev, | 695 | dev_err(q->adap->pdev_dev, |
681 | "unexpected CPL %#x on FW event queue\n", opcode); | 696 | "unexpected CPL %#x on FW event queue\n", opcode); |
697 | out: | ||
682 | return 0; | 698 | return 0; |
683 | } | 699 | } |
684 | 700 | ||
@@ -696,6 +712,12 @@ static int uldrx_handler(struct sge_rspq *q, const __be64 *rsp, | |||
696 | { | 712 | { |
697 | struct sge_ofld_rxq *rxq = container_of(q, struct sge_ofld_rxq, rspq); | 713 | struct sge_ofld_rxq *rxq = container_of(q, struct sge_ofld_rxq, rspq); |
698 | 714 | ||
715 | /* FW can send CPLs encapsulated in a CPL_FW4_MSG. | ||
716 | */ | ||
717 | if (((const struct rss_header *)rsp)->opcode == CPL_FW4_MSG && | ||
718 | ((const struct cpl_fw4_msg *)(rsp + 1))->type == FW_TYPE_RSSCPL) | ||
719 | rsp += 2; | ||
720 | |||
699 | if (ulds[q->uld].rx_handler(q->adap->uld_handle[q->uld], rsp, gl)) { | 721 | if (ulds[q->uld].rx_handler(q->adap->uld_handle[q->uld], rsp, gl)) { |
700 | rxq->stats.nomem++; | 722 | rxq->stats.nomem++; |
701 | return -1; | 723 | return -1; |
@@ -4990,6 +5012,15 @@ static int adap_init0(struct adapter *adap) | |||
4990 | adap->tids.aftid_end = val[1]; | 5012 | adap->tids.aftid_end = val[1]; |
4991 | } | 5013 | } |
4992 | 5014 | ||
5015 | /* If we're running on newer firmware, let it know that we're | ||
5016 | * prepared to deal with encapsulated CPL messages. Older | ||
5017 | * firmware won't understand this and we'll just get | ||
5018 | * unencapsulated messages ... | ||
5019 | */ | ||
5020 | params[0] = FW_PARAM_PFVF(CPLFW4MSG_ENCAP); | ||
5021 | val[0] = 1; | ||
5022 | (void) t4_set_params(adap, adap->mbox, adap->fn, 0, 1, params, val); | ||
5023 | |||
4993 | /* | 5024 | /* |
4994 | * Get device capabilities so we can determine what resources we need | 5025 | * Get device capabilities so we can determine what resources we need |
4995 | * to manage. | 5026 | * to manage. |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h b/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h index 47656ac1ac25..357e297df1ab 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h | |||
@@ -688,6 +688,15 @@ struct cpl_sge_egr_update { | |||
688 | __be16 pidx; | 688 | __be16 pidx; |
689 | }; | 689 | }; |
690 | 690 | ||
691 | /* cpl_fw*.type values */ | ||
692 | enum { | ||
693 | FW_TYPE_CMD_RPL = 0, | ||
694 | FW_TYPE_WR_RPL = 1, | ||
695 | FW_TYPE_CQE = 2, | ||
696 | FW_TYPE_OFLD_CONNECTION_WR_RPL = 3, | ||
697 | FW_TYPE_RSSCPL = 4, | ||
698 | }; | ||
699 | |||
691 | struct cpl_fw4_pld { | 700 | struct cpl_fw4_pld { |
692 | u8 opcode; | 701 | u8 opcode; |
693 | u8 rsvd0[3]; | 702 | u8 rsvd0[3]; |
@@ -737,6 +746,7 @@ enum { | |||
737 | FW6_TYPE_WR_RPL = 1, | 746 | FW6_TYPE_WR_RPL = 1, |
738 | FW6_TYPE_CQE = 2, | 747 | FW6_TYPE_CQE = 2, |
739 | FW6_TYPE_OFLD_CONNECTION_WR_RPL = 3, | 748 | FW6_TYPE_OFLD_CONNECTION_WR_RPL = 3, |
749 | FW6_TYPE_RSSCPL = FW_TYPE_RSSCPL, | ||
740 | }; | 750 | }; |
741 | 751 | ||
742 | struct cpl_fw6_msg_ofld_connection_wr_rpl { | 752 | struct cpl_fw6_msg_ofld_connection_wr_rpl { |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h b/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h index 93444325b1e8..d1c755f78aaf 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h | |||
@@ -973,7 +973,9 @@ enum fw_params_param_pfvf { | |||
973 | FW_PARAMS_PARAM_PFVF_EQ_START = 0x2B, | 973 | FW_PARAMS_PARAM_PFVF_EQ_START = 0x2B, |
974 | FW_PARAMS_PARAM_PFVF_EQ_END = 0x2C, | 974 | FW_PARAMS_PARAM_PFVF_EQ_END = 0x2C, |
975 | FW_PARAMS_PARAM_PFVF_ACTIVE_FILTER_START = 0x2D, | 975 | FW_PARAMS_PARAM_PFVF_ACTIVE_FILTER_START = 0x2D, |
976 | FW_PARAMS_PARAM_PFVF_ACTIVE_FILTER_END = 0x2E | 976 | FW_PARAMS_PARAM_PFVF_ACTIVE_FILTER_END = 0x2E, |
977 | FW_PARAMS_PARAM_PFVF_ETHOFLD_END = 0x30, | ||
978 | FW_PARAMS_PARAM_PFVF_CPLFW4MSG_ENCAP = 0x31 | ||
977 | }; | 979 | }; |
978 | 980 | ||
979 | /* | 981 | /* |
@@ -1758,6 +1760,25 @@ enum fw_port_module_type { | |||
1758 | FW_PORT_MOD_TYPE_NONE = FW_PORT_CMD_MODTYPE_MASK | 1760 | FW_PORT_MOD_TYPE_NONE = FW_PORT_CMD_MODTYPE_MASK |
1759 | }; | 1761 | }; |
1760 | 1762 | ||
1763 | enum fw_port_mod_sub_type { | ||
1764 | FW_PORT_MOD_SUB_TYPE_NA, | ||
1765 | FW_PORT_MOD_SUB_TYPE_MV88E114X = 0x1, | ||
1766 | FW_PORT_MOD_SUB_TYPE_TN8022 = 0x2, | ||
1767 | FW_PORT_MOD_SUB_TYPE_AQ1202 = 0x3, | ||
1768 | FW_PORT_MOD_SUB_TYPE_88x3120 = 0x4, | ||
1769 | FW_PORT_MOD_SUB_TYPE_BCM84834 = 0x5, | ||
1770 | FW_PORT_MOD_SUB_TYPE_BT_VSC8634 = 0x8, | ||
1771 | |||
1772 | /* The following will never been in the VPD. They are TWINAX cable | ||
1773 | * lengths decoded from SFP+ module i2c PROMs. These should | ||
1774 | * almost certainly go somewhere else ... | ||
1775 | */ | ||
1776 | FW_PORT_MOD_SUB_TYPE_TWINAX_1 = 0x9, | ||
1777 | FW_PORT_MOD_SUB_TYPE_TWINAX_3 = 0xA, | ||
1778 | FW_PORT_MOD_SUB_TYPE_TWINAX_5 = 0xB, | ||
1779 | FW_PORT_MOD_SUB_TYPE_TWINAX_7 = 0xC, | ||
1780 | }; | ||
1781 | |||
1761 | /* port stats */ | 1782 | /* port stats */ |
1762 | #define FW_NUM_PORT_STATS 50 | 1783 | #define FW_NUM_PORT_STATS 50 |
1763 | #define FW_NUM_PORT_TX_STATS 23 | 1784 | #define FW_NUM_PORT_TX_STATS 23 |
@@ -2123,11 +2144,11 @@ struct fw_hdr { | |||
2123 | u8 intfver_ri; | 2144 | u8 intfver_ri; |
2124 | u8 intfver_iscsipdu; | 2145 | u8 intfver_iscsipdu; |
2125 | u8 intfver_iscsi; | 2146 | u8 intfver_iscsi; |
2147 | u8 intfver_fcoepdu; | ||
2126 | u8 intfver_fcoe; | 2148 | u8 intfver_fcoe; |
2127 | u8 reserved2; | 2149 | __u32 reserved2; |
2128 | __u32 reserved3; | 2150 | __u32 reserved3; |
2129 | __u32 reserved4; | 2151 | __u32 reserved4; |
2130 | __u32 reserved5; | ||
2131 | __be32 flags; | 2152 | __be32 flags; |
2132 | __be32 reserved6[23]; | 2153 | __be32 reserved6[23]; |
2133 | }; | 2154 | }; |
@@ -2137,6 +2158,17 @@ struct fw_hdr { | |||
2137 | #define FW_HDR_FW_VER_MICRO_GET(x) (((x) >> 8) & 0xff) | 2158 | #define FW_HDR_FW_VER_MICRO_GET(x) (((x) >> 8) & 0xff) |
2138 | #define FW_HDR_FW_VER_BUILD_GET(x) (((x) >> 0) & 0xff) | 2159 | #define FW_HDR_FW_VER_BUILD_GET(x) (((x) >> 0) & 0xff) |
2139 | 2160 | ||
2161 | enum fw_hdr_intfver { | ||
2162 | FW_HDR_INTFVER_NIC = 0x00, | ||
2163 | FW_HDR_INTFVER_VNIC = 0x00, | ||
2164 | FW_HDR_INTFVER_OFLD = 0x00, | ||
2165 | FW_HDR_INTFVER_RI = 0x00, | ||
2166 | FW_HDR_INTFVER_ISCSIPDU = 0x00, | ||
2167 | FW_HDR_INTFVER_ISCSI = 0x00, | ||
2168 | FW_HDR_INTFVER_FCOEPDU = 0x00, | ||
2169 | FW_HDR_INTFVER_FCOE = 0x00, | ||
2170 | }; | ||
2171 | |||
2140 | enum fw_hdr_flags { | 2172 | enum fw_hdr_flags { |
2141 | FW_HDR_FLAGS_RESET_HALT = 0x00000001, | 2173 | FW_HDR_FLAGS_RESET_HALT = 0x00000001, |
2142 | }; | 2174 | }; |