Commit 0b1b7137 authored by Ioana Ciornei's avatar Ioana Ciornei Committed by David S. Miller

staging: dpaa2-switch: handle Rx path on control interface

The dpaa2-ethsw supports only one Rx queue that is shared by all switch
ports. This means that information about which port was the ingress port
for a specific frame needs to be passed in metadata. In our case, the
Flow Context (FLC) field from the frame descriptor holds this
information. Besides the interface ID of the ingress port we also
receive the virtual QDID of the port. Below is a visual description of
the 64 bits of FLC.

63           47           31           15           0
+---------------------------------------------------+
|            |            |            |            |
|  RESERVED  |    IF_ID   |  RESERVED  |  IF QDID   |
|            |            |            |            |
+---------------------------------------------------+

Because all switch ports share the same Rx and Tx conf queues, NAPI
management takes into consideration when there is at least one switch
interface open to enable the NAPI instance.

The Rx path is common, for the most part, for both Rx and Tx conf with
the mention that each of them has its own consume function of a frame
descriptor. Dequeueing from a FQ, consuming dequeued store and also the
NAPI poll function is common between both queues.
Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 04abc97d
This diff is collapsed.
...@@ -53,6 +53,19 @@ ...@@ -53,6 +53,19 @@
#define DPAA2_SWITCH_STORE_SIZE 16 #define DPAA2_SWITCH_STORE_SIZE 16
/* Buffer management */
#define BUFS_PER_CMD 7
#define DPAA2_ETHSW_NUM_BUFS (1024 * BUFS_PER_CMD)
#define DPAA2_ETHSW_REFILL_THRESH (DPAA2_ETHSW_NUM_BUFS * 5 / 6)
/* Number of times to retry DPIO portal operations while waiting
* for portal to finish executing current command and become
* available. We want to avoid being stuck in a while loop in case
* hardware becomes unresponsive, but not give up too easily if
* the portal really is busy for valid reasons
*/
#define DPAA2_SWITCH_SWP_BUSY_RETRIES 1000
extern const struct ethtool_ops dpaa2_switch_port_ethtool_ops; extern const struct ethtool_ops dpaa2_switch_port_ethtool_ops;
struct ethsw_core; struct ethsw_core;
...@@ -62,6 +75,7 @@ struct dpaa2_switch_fq { ...@@ -62,6 +75,7 @@ struct dpaa2_switch_fq {
enum dpsw_queue_type type; enum dpsw_queue_type type;
struct dpaa2_io_store *store; struct dpaa2_io_store *store;
struct dpaa2_io_notification_ctx nctx; struct dpaa2_io_notification_ctx nctx;
struct napi_struct napi;
u32 fqid; u32 fqid;
}; };
...@@ -89,6 +103,7 @@ struct ethsw_core { ...@@ -89,6 +103,7 @@ struct ethsw_core {
unsigned long features; unsigned long features;
int dev_id; int dev_id;
struct ethsw_port_priv **ports; struct ethsw_port_priv **ports;
struct iommu_domain *iommu_domain;
u8 vlans[VLAN_VID_MASK + 1]; u8 vlans[VLAN_VID_MASK + 1];
...@@ -99,7 +114,9 @@ struct ethsw_core { ...@@ -99,7 +114,9 @@ struct ethsw_core {
struct dpaa2_switch_fq fq[DPAA2_SWITCH_RX_NUM_FQS]; struct dpaa2_switch_fq fq[DPAA2_SWITCH_RX_NUM_FQS];
struct fsl_mc_device *dpbp_dev; struct fsl_mc_device *dpbp_dev;
int buf_count;
u16 bpid; u16 bpid;
int napi_users;
}; };
static inline bool dpaa2_switch_supports_cpu_traffic(struct ethsw_core *ethsw) static inline bool dpaa2_switch_supports_cpu_traffic(struct ethsw_core *ethsw)
......
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