common/cnxk: support setting channel mask for SDP interfaces
authorSatheesh Paul <psatheesh@marvell.com>
Tue, 9 Nov 2021 09:42:03 +0000 (15:12 +0530)
committerJerin Jacob <jerinj@marvell.com>
Tue, 21 Dec 2021 10:18:39 +0000 (11:18 +0100)
ROC changes to support setting channel mask for SDP interfaces.

Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
drivers/common/cnxk/roc_npc.c
drivers/common/cnxk/roc_npc.h
drivers/common/cnxk/roc_npc_mcam.c
drivers/common/cnxk/roc_npc_priv.h

index 503c747..d18dfd4 100644 (file)
@@ -1152,6 +1152,19 @@ roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
        int rc;
 
        npc->channel = roc_npc->channel;
+       npc->is_sdp_link = roc_nix_is_sdp(roc_npc->roc_nix);
+       if (npc->is_sdp_link) {
+               if (roc_npc->is_sdp_mask_set) {
+                       npc->sdp_channel = roc_npc->sdp_channel;
+                       npc->sdp_channel_mask = roc_npc->sdp_channel_mask;
+               } else {
+                       /* By default set the channel and mask to cover
+                        * the whole SDP channel range.
+                        */
+                       npc->sdp_channel = (uint16_t)NIX_CHAN_SDP_CH_START;
+                       npc->sdp_channel_mask = (uint16_t)NIX_CHAN_SDP_CH_START;
+               }
+       }
 
        flow = plt_zmalloc(sizeof(*flow), 0);
        if (flow == NULL) {
index e13d557..8c24126 100644 (file)
@@ -195,6 +195,9 @@ struct roc_npc {
        uint64_t rx_parse_nibble;
        /* Parsed RSS Flowkey cfg for current flow being created */
        uint32_t flowkey_cfg_state;
+       bool is_sdp_mask_set;
+       uint16_t sdp_channel;
+       uint16_t sdp_channel_mask;
 
 #define ROC_NPC_MEM_SZ (5 * 1024)
        uint8_t reserved[ROC_NPC_MEM_SZ];
index 82014a2..7ed1fd3 100644 (file)
@@ -575,6 +575,16 @@ npc_mcam_alloc_and_write(struct npc *npc, struct roc_npc_flow *flow,
                        flow->npc_action |= (uint64_t)pf_func << 4;
                        flow->mcam_data[0] |= (uint64_t)inl_dev->channel;
                        flow->mcam_mask[0] |= (uint64_t)inl_dev->chan_mask;
+               } else if (npc->is_sdp_link) {
+                       req->entry_data.kw[0] &= ~(GENMASK(11, 0));
+                       req->entry_data.kw_mask[0] &= ~(GENMASK(11, 0));
+                       req->entry_data.kw[0] |= (uint64_t)npc->sdp_channel;
+                       req->entry_data.kw_mask[0] |=
+                               (uint64_t)npc->sdp_channel_mask;
+                       flow->mcam_data[0] &= ~(GENMASK(11, 0));
+                       flow->mcam_mask[0] &= ~(GENMASK(11, 0));
+                       flow->mcam_data[0] |= (uint64_t)npc->sdp_channel;
+                       flow->mcam_mask[0] |= (uint64_t)npc->sdp_channel_mask;
                } else {
                        req->entry_data.kw[0] |= (uint64_t)npc->channel;
                        req->entry_data.kw_mask[0] |= (BIT_ULL(12) - 1);
index 74e0fb2..a503d47 100644 (file)
@@ -360,6 +360,9 @@ struct npc {
        uint32_t keyw[NPC_MAX_INTF];            /* max key + data len bits */
        uint32_t mcam_entries;                  /* mcam entries supported */
        uint16_t channel;                       /* RX Channel number */
+       bool is_sdp_link;
+       uint16_t sdp_channel;
+       uint16_t sdp_channel_mask;
        uint32_t rss_grps;                      /* rss groups supported */
        uint16_t flow_prealloc_size;            /* Pre allocated mcam size */
        uint16_t flow_max_priority;             /* Max priority for flow */