Commit 03c82e80 authored by David S. Miller's avatar David S. Miller

Merge branch 'octeontx2-af-fixes'

Subbaraya Sundeep says:

====================
octeontx-af2: Fixes for CN10K and CN9xxx platforms

This patchset has consolidated fixes in Octeontx2 driver
handling CN10K and CN9xxx platforms. When testing the
new CN10K hardware some issues resurfaced like accessing
wrong register for CN10K and enabling loopback on not supported
interfaces. Some fixes are needed for CN9xxx platforms as well.

Below is the description of patches

Patch 1: AF sets RX RSS action for all the VFs when a VF is
brought up. But when a PF sets RX action for its VF like Drop/Direct
to a queue in ntuple filter it is not retained because of AF fixup.
This patch skips modifying VF RX RSS action if PF has already
set its action.

Patch 2: When configuring backpressure wrong register is being read for
LBKs hence fixed it.

Patch 3: Some RVU blocks may take longer time to reset but are guaranteed
to complete the reset. Hence wait till reset is complete.

Patch 4: For enabling LMAC CN10K needs another register compared
to CN9xxx platforms. Hence changed it.

Patch 5: Adds missing barrier before submitting memory pointer
to the aura hardware.

Patch 6: Increase polling time while link credit restore and also
return proper error code when timeout occurs.

Patch 7: Internal loopback not supported on LPCS interfaces like
SGMII/QSGMII so do not enable it.

Patch 8: When there is a error in message processing, AF sets the error
response and replies back to requestor. PF forwards a invalid message to
VF back if AF reply has error in it. This way VF lacks the actual error set
by AF for its message. This is changed such that PF simply forwards the
actual reply and let VF handle the error.

Patch 9: ntuple filter with "flow-type ether proto 0x8842 vlan 0x92e"
was not working since ethertype 0x8842 is NGIO protocol. Hardware
parser explicitly parses such NGIO packets and sets the packet as
NGIO and do not set it as tagged packet. Fix this by changing parser
such that it sets the packet as both NGIO and tagged by using
separate layer types.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 67ab5595 745166fc
...@@ -1570,6 +1570,8 @@ static struct mac_ops cgx_mac_ops = { ...@@ -1570,6 +1570,8 @@ static struct mac_ops cgx_mac_ops = {
.mac_enadis_pause_frm = cgx_lmac_enadis_pause_frm, .mac_enadis_pause_frm = cgx_lmac_enadis_pause_frm,
.mac_pause_frm_config = cgx_lmac_pause_frm_config, .mac_pause_frm_config = cgx_lmac_pause_frm_config,
.mac_enadis_ptp_config = cgx_lmac_ptp_config, .mac_enadis_ptp_config = cgx_lmac_ptp_config,
.mac_rx_tx_enable = cgx_lmac_rx_tx_enable,
.mac_tx_enable = cgx_lmac_tx_enable,
}; };
static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id) static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id)
......
...@@ -107,6 +107,9 @@ struct mac_ops { ...@@ -107,6 +107,9 @@ struct mac_ops {
void (*mac_enadis_ptp_config)(void *cgxd, void (*mac_enadis_ptp_config)(void *cgxd,
int lmac_id, int lmac_id,
bool enable); bool enable);
int (*mac_rx_tx_enable)(void *cgxd, int lmac_id, bool enable);
int (*mac_tx_enable)(void *cgxd, int lmac_id, bool enable);
}; };
struct cgx { struct cgx {
......
...@@ -732,6 +732,7 @@ enum nix_af_status { ...@@ -732,6 +732,7 @@ enum nix_af_status {
NIX_AF_ERR_BANDPROF_INVAL_REQ = -428, NIX_AF_ERR_BANDPROF_INVAL_REQ = -428,
NIX_AF_ERR_CQ_CTX_WRITE_ERR = -429, NIX_AF_ERR_CQ_CTX_WRITE_ERR = -429,
NIX_AF_ERR_AQ_CTX_RETRY_WRITE = -430, NIX_AF_ERR_AQ_CTX_RETRY_WRITE = -430,
NIX_AF_ERR_LINK_CREDITS = -431,
}; };
/* For NIX RX vtag action */ /* For NIX RX vtag action */
......
...@@ -185,7 +185,6 @@ enum npc_kpu_parser_state { ...@@ -185,7 +185,6 @@ enum npc_kpu_parser_state {
NPC_S_KPU2_QINQ, NPC_S_KPU2_QINQ,
NPC_S_KPU2_ETAG, NPC_S_KPU2_ETAG,
NPC_S_KPU2_EXDSA, NPC_S_KPU2_EXDSA,
NPC_S_KPU2_NGIO,
NPC_S_KPU2_CPT_CTAG, NPC_S_KPU2_CPT_CTAG,
NPC_S_KPU2_CPT_QINQ, NPC_S_KPU2_CPT_QINQ,
NPC_S_KPU3_CTAG, NPC_S_KPU3_CTAG,
...@@ -212,6 +211,7 @@ enum npc_kpu_parser_state { ...@@ -212,6 +211,7 @@ enum npc_kpu_parser_state {
NPC_S_KPU5_NSH, NPC_S_KPU5_NSH,
NPC_S_KPU5_CPT_IP, NPC_S_KPU5_CPT_IP,
NPC_S_KPU5_CPT_IP6, NPC_S_KPU5_CPT_IP6,
NPC_S_KPU5_NGIO,
NPC_S_KPU6_IP6_EXT, NPC_S_KPU6_IP6_EXT,
NPC_S_KPU6_IP6_HOP_DEST, NPC_S_KPU6_IP6_HOP_DEST,
NPC_S_KPU6_IP6_ROUT, NPC_S_KPU6_IP6_ROUT,
...@@ -1120,15 +1120,6 @@ static struct npc_kpu_profile_cam kpu1_cam_entries[] = { ...@@ -1120,15 +1120,6 @@ static struct npc_kpu_profile_cam kpu1_cam_entries[] = {
0x0000, 0x0000,
0x0000, 0x0000,
}, },
{
NPC_S_KPU1_ETHER, 0xff,
NPC_ETYPE_CTAG,
0xffff,
NPC_ETYPE_NGIO,
0xffff,
0x0000,
0x0000,
},
{ {
NPC_S_KPU1_ETHER, 0xff, NPC_S_KPU1_ETHER, 0xff,
NPC_ETYPE_CTAG, NPC_ETYPE_CTAG,
...@@ -1966,6 +1957,15 @@ static struct npc_kpu_profile_cam kpu2_cam_entries[] = { ...@@ -1966,6 +1957,15 @@ static struct npc_kpu_profile_cam kpu2_cam_entries[] = {
0x0000, 0x0000,
0x0000, 0x0000,
}, },
{
NPC_S_KPU2_CTAG, 0xff,
NPC_ETYPE_NGIO,
0xffff,
0x0000,
0x0000,
0x0000,
0x0000,
},
{ {
NPC_S_KPU2_CTAG, 0xff, NPC_S_KPU2_CTAG, 0xff,
NPC_ETYPE_PPPOE, NPC_ETYPE_PPPOE,
...@@ -2749,15 +2749,6 @@ static struct npc_kpu_profile_cam kpu2_cam_entries[] = { ...@@ -2749,15 +2749,6 @@ static struct npc_kpu_profile_cam kpu2_cam_entries[] = {
0x0000, 0x0000,
0x0000, 0x0000,
}, },
{
NPC_S_KPU2_NGIO, 0xff,
0x0000,
0x0000,
0x0000,
0x0000,
0x0000,
0x0000,
},
{ {
NPC_S_KPU2_CPT_CTAG, 0xff, NPC_S_KPU2_CPT_CTAG, 0xff,
NPC_ETYPE_IP, NPC_ETYPE_IP,
...@@ -5089,6 +5080,15 @@ static struct npc_kpu_profile_cam kpu5_cam_entries[] = { ...@@ -5089,6 +5080,15 @@ static struct npc_kpu_profile_cam kpu5_cam_entries[] = {
0x0000, 0x0000,
0x0000, 0x0000,
}, },
{
NPC_S_KPU5_NGIO, 0xff,
0x0000,
0x0000,
0x0000,
0x0000,
0x0000,
0x0000,
},
{ {
NPC_S_NA, 0X00, NPC_S_NA, 0X00,
0x0000, 0x0000,
...@@ -8422,14 +8422,6 @@ static struct npc_kpu_profile_action kpu1_action_entries[] = { ...@@ -8422,14 +8422,6 @@ static struct npc_kpu_profile_action kpu1_action_entries[] = {
0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
}, },
{
NPC_ERRLEV_RE, NPC_EC_NOERR,
8, 12, 0, 0, 0,
NPC_S_KPU2_NGIO, 12, 1,
NPC_LID_LA, NPC_LT_LA_ETHER,
0,
0, 0, 0, 0,
},
{ {
NPC_ERRLEV_RE, NPC_EC_NOERR, NPC_ERRLEV_RE, NPC_EC_NOERR,
8, 12, 0, 0, 0, 8, 12, 0, 0, 0,
...@@ -9194,6 +9186,14 @@ static struct npc_kpu_profile_action kpu2_action_entries[] = { ...@@ -9194,6 +9186,14 @@ static struct npc_kpu_profile_action kpu2_action_entries[] = {
0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
}, },
{
NPC_ERRLEV_RE, NPC_EC_NOERR,
0, 0, 0, 2, 0,
NPC_S_KPU5_NGIO, 6, 1,
NPC_LID_LB, NPC_LT_LB_CTAG,
0,
0, 0, 0, 0,
},
{ {
NPC_ERRLEV_RE, NPC_EC_NOERR, NPC_ERRLEV_RE, NPC_EC_NOERR,
8, 0, 6, 2, 0, 8, 0, 6, 2, 0,
...@@ -9890,14 +9890,6 @@ static struct npc_kpu_profile_action kpu2_action_entries[] = { ...@@ -9890,14 +9890,6 @@ static struct npc_kpu_profile_action kpu2_action_entries[] = {
NPC_F_LB_U_UNK_ETYPE | NPC_F_LB_L_EXDSA, NPC_F_LB_U_UNK_ETYPE | NPC_F_LB_L_EXDSA,
0, 0, 0, 0, 0, 0, 0, 0,
}, },
{
NPC_ERRLEV_RE, NPC_EC_NOERR,
0, 0, 0, 0, 1,
NPC_S_NA, 0, 1,
NPC_LID_LC, NPC_LT_LC_NGIO,
0,
0, 0, 0, 0,
},
{ {
NPC_ERRLEV_RE, NPC_EC_NOERR, NPC_ERRLEV_RE, NPC_EC_NOERR,
8, 0, 6, 2, 0, 8, 0, 6, 2, 0,
...@@ -11973,6 +11965,14 @@ static struct npc_kpu_profile_action kpu5_action_entries[] = { ...@@ -11973,6 +11965,14 @@ static struct npc_kpu_profile_action kpu5_action_entries[] = {
0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
}, },
{
NPC_ERRLEV_RE, NPC_EC_NOERR,
0, 0, 0, 0, 1,
NPC_S_NA, 0, 1,
NPC_LID_LC, NPC_LT_LC_NGIO,
0,
0, 0, 0, 0,
},
{ {
NPC_ERRLEV_LC, NPC_EC_UNK, NPC_ERRLEV_LC, NPC_EC_UNK,
0, 0, 0, 0, 1, 0, 0, 0, 0, 1,
......
...@@ -30,6 +30,8 @@ static struct mac_ops rpm_mac_ops = { ...@@ -30,6 +30,8 @@ static struct mac_ops rpm_mac_ops = {
.mac_enadis_pause_frm = rpm_lmac_enadis_pause_frm, .mac_enadis_pause_frm = rpm_lmac_enadis_pause_frm,
.mac_pause_frm_config = rpm_lmac_pause_frm_config, .mac_pause_frm_config = rpm_lmac_pause_frm_config,
.mac_enadis_ptp_config = rpm_lmac_ptp_config, .mac_enadis_ptp_config = rpm_lmac_ptp_config,
.mac_rx_tx_enable = rpm_lmac_rx_tx_enable,
.mac_tx_enable = rpm_lmac_tx_enable,
}; };
struct mac_ops *rpm_get_mac_ops(void) struct mac_ops *rpm_get_mac_ops(void)
...@@ -54,6 +56,43 @@ int rpm_get_nr_lmacs(void *rpmd) ...@@ -54,6 +56,43 @@ int rpm_get_nr_lmacs(void *rpmd)
return hweight8(rpm_read(rpm, 0, CGXX_CMRX_RX_LMACS) & 0xFULL); return hweight8(rpm_read(rpm, 0, CGXX_CMRX_RX_LMACS) & 0xFULL);
} }
int rpm_lmac_tx_enable(void *rpmd, int lmac_id, bool enable)
{
rpm_t *rpm = rpmd;
u64 cfg, last;
if (!is_lmac_valid(rpm, lmac_id))
return -ENODEV;
cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG);
last = cfg;
if (enable)
cfg |= RPM_TX_EN;
else
cfg &= ~(RPM_TX_EN);
if (cfg != last)
rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg);
return !!(last & RPM_TX_EN);
}
int rpm_lmac_rx_tx_enable(void *rpmd, int lmac_id, bool enable)
{
rpm_t *rpm = rpmd;
u64 cfg;
if (!is_lmac_valid(rpm, lmac_id))
return -ENODEV;
cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG);
if (enable)
cfg |= RPM_RX_EN | RPM_TX_EN;
else
cfg &= ~(RPM_RX_EN | RPM_TX_EN);
rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg);
return 0;
}
void rpm_lmac_enadis_rx_pause_fwding(void *rpmd, int lmac_id, bool enable) void rpm_lmac_enadis_rx_pause_fwding(void *rpmd, int lmac_id, bool enable)
{ {
rpm_t *rpm = rpmd; rpm_t *rpm = rpmd;
...@@ -252,7 +291,12 @@ int rpm_lmac_internal_loopback(void *rpmd, int lmac_id, bool enable) ...@@ -252,7 +291,12 @@ int rpm_lmac_internal_loopback(void *rpmd, int lmac_id, bool enable)
if (!rpm || lmac_id >= rpm->lmac_count) if (!rpm || lmac_id >= rpm->lmac_count)
return -ENODEV; return -ENODEV;
lmac_type = rpm->mac_ops->get_lmac_type(rpm, lmac_id); lmac_type = rpm->mac_ops->get_lmac_type(rpm, lmac_id);
if (lmac_type == LMAC_MODE_100G_R) {
if (lmac_type == LMAC_MODE_QSGMII || lmac_type == LMAC_MODE_SGMII) {
dev_err(&rpm->pdev->dev, "loopback not supported for LPC mode\n");
return 0;
}
cfg = rpm_read(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1); cfg = rpm_read(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1);
if (enable) if (enable)
...@@ -260,14 +304,6 @@ int rpm_lmac_internal_loopback(void *rpmd, int lmac_id, bool enable) ...@@ -260,14 +304,6 @@ int rpm_lmac_internal_loopback(void *rpmd, int lmac_id, bool enable)
else else
cfg &= ~RPMX_MTI_PCS_LBK; cfg &= ~RPMX_MTI_PCS_LBK;
rpm_write(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1, cfg); rpm_write(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1, cfg);
} else {
cfg = rpm_read(rpm, lmac_id, RPMX_MTI_LPCSX_CONTROL1);
if (enable)
cfg |= RPMX_MTI_PCS_LBK;
else
cfg &= ~RPMX_MTI_PCS_LBK;
rpm_write(rpm, lmac_id, RPMX_MTI_LPCSX_CONTROL1, cfg);
}
return 0; return 0;
} }
......
...@@ -43,6 +43,8 @@ ...@@ -43,6 +43,8 @@
#define RPMX_MTI_STAT_DATA_HI_CDC 0x10038 #define RPMX_MTI_STAT_DATA_HI_CDC 0x10038
#define RPM_LMAC_FWI 0xa #define RPM_LMAC_FWI 0xa
#define RPM_TX_EN BIT_ULL(0)
#define RPM_RX_EN BIT_ULL(1)
/* Function Declarations */ /* Function Declarations */
int rpm_get_nr_lmacs(void *rpmd); int rpm_get_nr_lmacs(void *rpmd);
...@@ -57,4 +59,6 @@ int rpm_lmac_enadis_pause_frm(void *rpmd, int lmac_id, u8 tx_pause, ...@@ -57,4 +59,6 @@ int rpm_lmac_enadis_pause_frm(void *rpmd, int lmac_id, u8 tx_pause,
int rpm_get_tx_stats(void *rpmd, int lmac_id, int idx, u64 *tx_stat); int rpm_get_tx_stats(void *rpmd, int lmac_id, int idx, u64 *tx_stat);
int rpm_get_rx_stats(void *rpmd, int lmac_id, int idx, u64 *rx_stat); int rpm_get_rx_stats(void *rpmd, int lmac_id, int idx, u64 *rx_stat);
void rpm_lmac_ptp_config(void *rpmd, int lmac_id, bool enable); void rpm_lmac_ptp_config(void *rpmd, int lmac_id, bool enable);
int rpm_lmac_rx_tx_enable(void *rpmd, int lmac_id, bool enable);
int rpm_lmac_tx_enable(void *rpmd, int lmac_id, bool enable);
#endif /* RPM_H */ #endif /* RPM_H */
...@@ -520,8 +520,11 @@ static void rvu_block_reset(struct rvu *rvu, int blkaddr, u64 rst_reg) ...@@ -520,8 +520,11 @@ static void rvu_block_reset(struct rvu *rvu, int blkaddr, u64 rst_reg)
rvu_write64(rvu, blkaddr, rst_reg, BIT_ULL(0)); rvu_write64(rvu, blkaddr, rst_reg, BIT_ULL(0));
err = rvu_poll_reg(rvu, blkaddr, rst_reg, BIT_ULL(63), true); err = rvu_poll_reg(rvu, blkaddr, rst_reg, BIT_ULL(63), true);
if (err) if (err) {
dev_err(rvu->dev, "HW block:%d reset failed\n", blkaddr); dev_err(rvu->dev, "HW block:%d reset timeout retrying again\n", blkaddr);
while (rvu_poll_reg(rvu, blkaddr, rst_reg, BIT_ULL(63), true) == -EBUSY)
;
}
} }
static void rvu_reset_all_blocks(struct rvu *rvu) static void rvu_reset_all_blocks(struct rvu *rvu)
......
...@@ -806,6 +806,7 @@ bool is_mac_feature_supported(struct rvu *rvu, int pf, int feature); ...@@ -806,6 +806,7 @@ bool is_mac_feature_supported(struct rvu *rvu, int pf, int feature);
u32 rvu_cgx_get_fifolen(struct rvu *rvu); u32 rvu_cgx_get_fifolen(struct rvu *rvu);
void *rvu_first_cgx_pdata(struct rvu *rvu); void *rvu_first_cgx_pdata(struct rvu *rvu);
int cgxlmac_to_pf(struct rvu *rvu, int cgx_id, int lmac_id); int cgxlmac_to_pf(struct rvu *rvu, int cgx_id, int lmac_id);
int rvu_cgx_config_tx(void *cgxd, int lmac_id, bool enable);
int npc_get_nixlf_mcam_index(struct npc_mcam *mcam, u16 pcifunc, int nixlf, int npc_get_nixlf_mcam_index(struct npc_mcam *mcam, u16 pcifunc, int nixlf,
int type); int type);
......
...@@ -441,16 +441,26 @@ void rvu_cgx_enadis_rx_bp(struct rvu *rvu, int pf, bool enable) ...@@ -441,16 +441,26 @@ void rvu_cgx_enadis_rx_bp(struct rvu *rvu, int pf, bool enable)
int rvu_cgx_config_rxtx(struct rvu *rvu, u16 pcifunc, bool start) int rvu_cgx_config_rxtx(struct rvu *rvu, u16 pcifunc, bool start)
{ {
int pf = rvu_get_pf(pcifunc); int pf = rvu_get_pf(pcifunc);
struct mac_ops *mac_ops;
u8 cgx_id, lmac_id; u8 cgx_id, lmac_id;
void *cgxd;
if (!is_cgx_config_permitted(rvu, pcifunc)) if (!is_cgx_config_permitted(rvu, pcifunc))
return LMAC_AF_ERR_PERM_DENIED; return LMAC_AF_ERR_PERM_DENIED;
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id); rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
cgxd = rvu_cgx_pdata(cgx_id, rvu);
mac_ops = get_mac_ops(cgxd);
return mac_ops->mac_rx_tx_enable(cgxd, lmac_id, start);
}
cgx_lmac_rx_tx_enable(rvu_cgx_pdata(cgx_id, rvu), lmac_id, start); int rvu_cgx_config_tx(void *cgxd, int lmac_id, bool enable)
{
struct mac_ops *mac_ops;
return 0; mac_ops = get_mac_ops(cgxd);
return mac_ops->mac_tx_enable(cgxd, lmac_id, enable);
} }
void rvu_cgx_disable_dmac_entries(struct rvu *rvu, u16 pcifunc) void rvu_cgx_disable_dmac_entries(struct rvu *rvu, u16 pcifunc)
......
...@@ -1224,6 +1224,8 @@ static void print_nix_cn10k_sq_ctx(struct seq_file *m, ...@@ -1224,6 +1224,8 @@ static void print_nix_cn10k_sq_ctx(struct seq_file *m,
seq_printf(m, "W3: head_offset\t\t\t%d\nW3: smenq_next_sqb_vld\t\t%d\n\n", seq_printf(m, "W3: head_offset\t\t\t%d\nW3: smenq_next_sqb_vld\t\t%d\n\n",
sq_ctx->head_offset, sq_ctx->smenq_next_sqb_vld); sq_ctx->head_offset, sq_ctx->smenq_next_sqb_vld);
seq_printf(m, "W3: smq_next_sq_vld\t\t%d\nW3: smq_pend\t\t\t%d\n",
sq_ctx->smq_next_sq_vld, sq_ctx->smq_pend);
seq_printf(m, "W4: next_sqb \t\t\t%llx\n\n", sq_ctx->next_sqb); seq_printf(m, "W4: next_sqb \t\t\t%llx\n\n", sq_ctx->next_sqb);
seq_printf(m, "W5: tail_sqb \t\t\t%llx\n\n", sq_ctx->tail_sqb); seq_printf(m, "W5: tail_sqb \t\t\t%llx\n\n", sq_ctx->tail_sqb);
seq_printf(m, "W6: smenq_sqb \t\t\t%llx\n\n", sq_ctx->smenq_sqb); seq_printf(m, "W6: smenq_sqb \t\t\t%llx\n\n", sq_ctx->smenq_sqb);
......
...@@ -512,11 +512,11 @@ static int rvu_nix_get_bpid(struct rvu *rvu, struct nix_bp_cfg_req *req, ...@@ -512,11 +512,11 @@ static int rvu_nix_get_bpid(struct rvu *rvu, struct nix_bp_cfg_req *req,
cfg = rvu_read64(rvu, blkaddr, NIX_AF_CONST); cfg = rvu_read64(rvu, blkaddr, NIX_AF_CONST);
lmac_chan_cnt = cfg & 0xFF; lmac_chan_cnt = cfg & 0xFF;
cfg = rvu_read64(rvu, blkaddr, NIX_AF_CONST1);
sdp_chan_cnt = cfg & 0xFFF;
cgx_bpid_cnt = hw->cgx_links * lmac_chan_cnt; cgx_bpid_cnt = hw->cgx_links * lmac_chan_cnt;
lbk_bpid_cnt = hw->lbk_links * ((cfg >> 16) & 0xFF); lbk_bpid_cnt = hw->lbk_links * ((cfg >> 16) & 0xFF);
cfg = rvu_read64(rvu, blkaddr, NIX_AF_CONST1);
sdp_chan_cnt = cfg & 0xFFF;
sdp_bpid_cnt = hw->sdp_links * sdp_chan_cnt; sdp_bpid_cnt = hw->sdp_links * sdp_chan_cnt;
pfvf = rvu_get_pfvf(rvu, req->hdr.pcifunc); pfvf = rvu_get_pfvf(rvu, req->hdr.pcifunc);
...@@ -2068,7 +2068,7 @@ static int nix_smq_flush(struct rvu *rvu, int blkaddr, ...@@ -2068,7 +2068,7 @@ static int nix_smq_flush(struct rvu *rvu, int blkaddr,
/* enable cgx tx if disabled */ /* enable cgx tx if disabled */
if (is_pf_cgxmapped(rvu, pf)) { if (is_pf_cgxmapped(rvu, pf)) {
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id); rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
restore_tx_en = !cgx_lmac_tx_enable(rvu_cgx_pdata(cgx_id, rvu), restore_tx_en = !rvu_cgx_config_tx(rvu_cgx_pdata(cgx_id, rvu),
lmac_id, true); lmac_id, true);
} }
...@@ -2092,7 +2092,7 @@ static int nix_smq_flush(struct rvu *rvu, int blkaddr, ...@@ -2092,7 +2092,7 @@ static int nix_smq_flush(struct rvu *rvu, int blkaddr,
rvu_cgx_enadis_rx_bp(rvu, pf, true); rvu_cgx_enadis_rx_bp(rvu, pf, true);
/* restore cgx tx state */ /* restore cgx tx state */
if (restore_tx_en) if (restore_tx_en)
cgx_lmac_tx_enable(rvu_cgx_pdata(cgx_id, rvu), lmac_id, false); rvu_cgx_config_tx(rvu_cgx_pdata(cgx_id, rvu), lmac_id, false);
return err; return err;
} }
...@@ -3878,7 +3878,7 @@ nix_config_link_credits(struct rvu *rvu, int blkaddr, int link, ...@@ -3878,7 +3878,7 @@ nix_config_link_credits(struct rvu *rvu, int blkaddr, int link,
/* Enable cgx tx if disabled for credits to be back */ /* Enable cgx tx if disabled for credits to be back */
if (is_pf_cgxmapped(rvu, pf)) { if (is_pf_cgxmapped(rvu, pf)) {
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id); rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
restore_tx_en = !cgx_lmac_tx_enable(rvu_cgx_pdata(cgx_id, rvu), restore_tx_en = !rvu_cgx_config_tx(rvu_cgx_pdata(cgx_id, rvu),
lmac_id, true); lmac_id, true);
} }
...@@ -3891,8 +3891,8 @@ nix_config_link_credits(struct rvu *rvu, int blkaddr, int link, ...@@ -3891,8 +3891,8 @@ nix_config_link_credits(struct rvu *rvu, int blkaddr, int link,
NIX_AF_TL1X_SW_XOFF(schq), BIT_ULL(0)); NIX_AF_TL1X_SW_XOFF(schq), BIT_ULL(0));
} }
rc = -EBUSY; rc = NIX_AF_ERR_LINK_CREDITS;
poll_tmo = jiffies + usecs_to_jiffies(10000); poll_tmo = jiffies + usecs_to_jiffies(200000);
/* Wait for credits to return */ /* Wait for credits to return */
do { do {
if (time_after(jiffies, poll_tmo)) if (time_after(jiffies, poll_tmo))
...@@ -3918,7 +3918,7 @@ nix_config_link_credits(struct rvu *rvu, int blkaddr, int link, ...@@ -3918,7 +3918,7 @@ nix_config_link_credits(struct rvu *rvu, int blkaddr, int link,
/* Restore state of cgx tx */ /* Restore state of cgx tx */
if (restore_tx_en) if (restore_tx_en)
cgx_lmac_tx_enable(rvu_cgx_pdata(cgx_id, rvu), lmac_id, false); rvu_cgx_config_tx(rvu_cgx_pdata(cgx_id, rvu), lmac_id, false);
mutex_unlock(&rvu->rsrc_lock); mutex_unlock(&rvu->rsrc_lock);
return rc; return rc;
......
...@@ -402,6 +402,7 @@ static void npc_fixup_vf_rule(struct rvu *rvu, struct npc_mcam *mcam, ...@@ -402,6 +402,7 @@ static void npc_fixup_vf_rule(struct rvu *rvu, struct npc_mcam *mcam,
int blkaddr, int index, struct mcam_entry *entry, int blkaddr, int index, struct mcam_entry *entry,
bool *enable) bool *enable)
{ {
struct rvu_npc_mcam_rule *rule;
u16 owner, target_func; u16 owner, target_func;
struct rvu_pfvf *pfvf; struct rvu_pfvf *pfvf;
u64 rx_action; u64 rx_action;
...@@ -423,6 +424,12 @@ static void npc_fixup_vf_rule(struct rvu *rvu, struct npc_mcam *mcam, ...@@ -423,6 +424,12 @@ static void npc_fixup_vf_rule(struct rvu *rvu, struct npc_mcam *mcam,
test_bit(NIXLF_INITIALIZED, &pfvf->flags))) test_bit(NIXLF_INITIALIZED, &pfvf->flags)))
*enable = false; *enable = false;
/* fix up not needed for the rules added by user(ntuple filters) */
list_for_each_entry(rule, &mcam->mcam_rules, list) {
if (rule->entry == index)
return;
}
/* copy VF default entry action to the VF mcam entry */ /* copy VF default entry action to the VF mcam entry */
rx_action = npc_get_default_entry_action(rvu, mcam, blkaddr, rx_action = npc_get_default_entry_action(rvu, mcam, blkaddr,
target_func); target_func);
...@@ -489,8 +496,8 @@ static void npc_config_mcam_entry(struct rvu *rvu, struct npc_mcam *mcam, ...@@ -489,8 +496,8 @@ static void npc_config_mcam_entry(struct rvu *rvu, struct npc_mcam *mcam,
} }
/* PF installing VF rule */ /* PF installing VF rule */
if (intf == NIX_INTF_RX && actindex < mcam->bmap_entries) if (is_npc_intf_rx(intf) && actindex < mcam->bmap_entries)
npc_fixup_vf_rule(rvu, mcam, blkaddr, index, entry, &enable); npc_fixup_vf_rule(rvu, mcam, blkaddr, actindex, entry, &enable);
/* Set 'action' */ /* Set 'action' */
rvu_write64(rvu, blkaddr, rvu_write64(rvu, blkaddr,
...@@ -916,7 +923,8 @@ static void npc_update_vf_flow_entry(struct rvu *rvu, struct npc_mcam *mcam, ...@@ -916,7 +923,8 @@ static void npc_update_vf_flow_entry(struct rvu *rvu, struct npc_mcam *mcam,
int blkaddr, u16 pcifunc, u64 rx_action) int blkaddr, u16 pcifunc, u64 rx_action)
{ {
int actindex, index, bank, entry; int actindex, index, bank, entry;
bool enable; struct rvu_npc_mcam_rule *rule;
bool enable, update;
if (!(pcifunc & RVU_PFVF_FUNC_MASK)) if (!(pcifunc & RVU_PFVF_FUNC_MASK))
return; return;
...@@ -924,6 +932,14 @@ static void npc_update_vf_flow_entry(struct rvu *rvu, struct npc_mcam *mcam, ...@@ -924,6 +932,14 @@ static void npc_update_vf_flow_entry(struct rvu *rvu, struct npc_mcam *mcam,
mutex_lock(&mcam->lock); mutex_lock(&mcam->lock);
for (index = 0; index < mcam->bmap_entries; index++) { for (index = 0; index < mcam->bmap_entries; index++) {
if (mcam->entry2target_pffunc[index] == pcifunc) { if (mcam->entry2target_pffunc[index] == pcifunc) {
update = true;
/* update not needed for the rules added via ntuple filters */
list_for_each_entry(rule, &mcam->mcam_rules, list) {
if (rule->entry == index)
update = false;
}
if (!update)
continue;
bank = npc_get_bank(mcam, index); bank = npc_get_bank(mcam, index);
actindex = index; actindex = index;
entry = index & (mcam->banksize - 1); entry = index & (mcam->banksize - 1);
......
...@@ -1098,14 +1098,6 @@ static int npc_install_flow(struct rvu *rvu, int blkaddr, u16 target, ...@@ -1098,14 +1098,6 @@ static int npc_install_flow(struct rvu *rvu, int blkaddr, u16 target,
write_req.cntr = rule->cntr; write_req.cntr = rule->cntr;
} }
err = rvu_mbox_handler_npc_mcam_write_entry(rvu, &write_req,
&write_rsp);
if (err) {
rvu_mcam_remove_counter_from_rule(rvu, owner, rule);
if (new)
kfree(rule);
return err;
}
/* update rule */ /* update rule */
memcpy(&rule->packet, &dummy.packet, sizeof(rule->packet)); memcpy(&rule->packet, &dummy.packet, sizeof(rule->packet));
memcpy(&rule->mask, &dummy.mask, sizeof(rule->mask)); memcpy(&rule->mask, &dummy.mask, sizeof(rule->mask));
...@@ -1132,6 +1124,18 @@ static int npc_install_flow(struct rvu *rvu, int blkaddr, u16 target, ...@@ -1132,6 +1124,18 @@ static int npc_install_flow(struct rvu *rvu, int blkaddr, u16 target,
if (req->default_rule) if (req->default_rule)
pfvf->def_ucast_rule = rule; pfvf->def_ucast_rule = rule;
/* write to mcam entry registers */
err = rvu_mbox_handler_npc_mcam_write_entry(rvu, &write_req,
&write_rsp);
if (err) {
rvu_mcam_remove_counter_from_rule(rvu, owner, rule);
if (new) {
list_del(&rule->list);
kfree(rule);
}
return err;
}
/* VF's MAC address is being changed via PF */ /* VF's MAC address is being changed via PF */
if (pf_set_vfs_mac) { if (pf_set_vfs_mac) {
ether_addr_copy(pfvf->default_mac, req->packet.dmac); ether_addr_copy(pfvf->default_mac, req->packet.dmac);
......
...@@ -603,6 +603,7 @@ static inline void __cn10k_aura_freeptr(struct otx2_nic *pfvf, u64 aura, ...@@ -603,6 +603,7 @@ static inline void __cn10k_aura_freeptr(struct otx2_nic *pfvf, u64 aura,
size++; size++;
tar_addr |= ((size - 1) & 0x7) << 4; tar_addr |= ((size - 1) & 0x7) << 4;
} }
dma_wmb();
memcpy((u64 *)lmt_info->lmt_addr, ptrs, sizeof(u64) * num_ptrs); memcpy((u64 *)lmt_info->lmt_addr, ptrs, sizeof(u64) * num_ptrs);
/* Perform LMTST flush */ /* Perform LMTST flush */
cn10k_lmt_flush(val, tar_addr); cn10k_lmt_flush(val, tar_addr);
......
...@@ -394,7 +394,12 @@ static int otx2_forward_vf_mbox_msgs(struct otx2_nic *pf, ...@@ -394,7 +394,12 @@ static int otx2_forward_vf_mbox_msgs(struct otx2_nic *pf,
dst_mdev->msg_size = mbox_hdr->msg_size; dst_mdev->msg_size = mbox_hdr->msg_size;
dst_mdev->num_msgs = num_msgs; dst_mdev->num_msgs = num_msgs;
err = otx2_sync_mbox_msg(dst_mbox); err = otx2_sync_mbox_msg(dst_mbox);
if (err) { /* Error code -EIO indicate there is a communication failure
* to the AF. Rest of the error codes indicate that AF processed
* VF messages and set the error codes in response messages
* (if any) so simply forward responses to VF.
*/
if (err == -EIO) {
dev_warn(pf->dev, dev_warn(pf->dev,
"AF not responding to VF%d messages\n", vf); "AF not responding to VF%d messages\n", vf);
/* restore PF mbase and exit */ /* restore PF mbase and exit */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment