[PATCH v2 4/7] net: thunderx: add new messages for handle ndo_set_rx_mode callback

2018-03-30 Thread Vadim Lomovtsev
From: Vadim Lomovtsev 

The kernel calls ndo_set_rx_mode() callback supplying it will all necessary
info, such as device state flags, multicast mac addresses list and so on.
Since we have only 128 bits to communicate with PF we need to initiate
several requests to PF with small/short operation each based on input data.

So this commit implements following PF messages codes along with new
data structures for them:
NIC_MBOX_MSG_RESET_XCAST to flush all filters configured for this
  particular network interface (VF)
NIC_MBOX_MSG_ADD_MCAST   to add new MAC address to DMAC filter registers
  for this particular network interface (VF)
NIC_MBOX_MSG_SET_XCAST   to apply filtering configuration to filter control
  register

Signed-off-by: Vadim Lomovtsev 
---
 drivers/net/ethernet/cavium/thunder/nic.h | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/ethernet/cavium/thunder/nic.h 
b/drivers/net/ethernet/cavium/thunder/nic.h
index 4cacce5d2b16..069289b4f968 100644
--- a/drivers/net/ethernet/cavium/thunder/nic.h
+++ b/drivers/net/ethernet/cavium/thunder/nic.h
@@ -403,6 +403,9 @@ struct nicvf {
 #defineNIC_MBOX_MSG_PTP_CFG0x19/* HW packet timestamp 
*/
 #defineNIC_MBOX_MSG_CFG_DONE   0xF0/* VF configuration 
done */
 #defineNIC_MBOX_MSG_SHUTDOWN   0xF1/* VF is being shutdown 
*/
+#defineNIC_MBOX_MSG_RESET_XCAST0xF2/* Reset DCAM filtering 
mode */
+#defineNIC_MBOX_MSG_ADD_MCAST  0xF3/* Add MAC to DCAM 
filters */
+#defineNIC_MBOX_MSG_SET_XCAST  0xF4/* Set MCAST/BCAST RX 
mode */
 
 struct nic_cfg_msg {
u8msg;
@@ -556,6 +559,14 @@ struct set_ptp {
bool  enable;
 };
 
+struct xcast {
+   u8msg;
+   union {
+   u8mode;
+   u64   mac;
+   } data;
+};
+
 /* 128 bit shared memory between PF and each VF */
 union nic_mbx {
struct { u8 msg; }  msg;
@@ -576,6 +587,7 @@ union nic_mbx {
struct reset_stat_cfg   reset_stat;
struct pfc  pfc;
struct set_ptp  ptp;
+   struct xcastxcast;
 };
 
 #define NIC_NODE_ID_MASK   0x03
-- 
2.14.3



[PATCH v2 4/7] net: thunderx: add new messages for handle ndo_set_rx_mode callback

2018-03-30 Thread Vadim Lomovtsev
From: Vadim Lomovtsev 

The kernel calls ndo_set_rx_mode() callback supplying it will all necessary
info, such as device state flags, multicast mac addresses list and so on.
Since we have only 128 bits to communicate with PF we need to initiate
several requests to PF with small/short operation each based on input data.

So this commit implements following PF messages codes along with new
data structures for them:
NIC_MBOX_MSG_RESET_XCAST to flush all filters configured for this
  particular network interface (VF)
NIC_MBOX_MSG_ADD_MCAST   to add new MAC address to DMAC filter registers
  for this particular network interface (VF)
NIC_MBOX_MSG_SET_XCAST   to apply filtering configuration to filter control
  register

Signed-off-by: Vadim Lomovtsev 
---
 drivers/net/ethernet/cavium/thunder/nic.h | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/ethernet/cavium/thunder/nic.h 
b/drivers/net/ethernet/cavium/thunder/nic.h
index 4cacce5d2b16..069289b4f968 100644
--- a/drivers/net/ethernet/cavium/thunder/nic.h
+++ b/drivers/net/ethernet/cavium/thunder/nic.h
@@ -403,6 +403,9 @@ struct nicvf {
 #defineNIC_MBOX_MSG_PTP_CFG0x19/* HW packet timestamp 
*/
 #defineNIC_MBOX_MSG_CFG_DONE   0xF0/* VF configuration 
done */
 #defineNIC_MBOX_MSG_SHUTDOWN   0xF1/* VF is being shutdown 
*/
+#defineNIC_MBOX_MSG_RESET_XCAST0xF2/* Reset DCAM filtering 
mode */
+#defineNIC_MBOX_MSG_ADD_MCAST  0xF3/* Add MAC to DCAM 
filters */
+#defineNIC_MBOX_MSG_SET_XCAST  0xF4/* Set MCAST/BCAST RX 
mode */
 
 struct nic_cfg_msg {
u8msg;
@@ -556,6 +559,14 @@ struct set_ptp {
bool  enable;
 };
 
+struct xcast {
+   u8msg;
+   union {
+   u8mode;
+   u64   mac;
+   } data;
+};
+
 /* 128 bit shared memory between PF and each VF */
 union nic_mbx {
struct { u8 msg; }  msg;
@@ -576,6 +587,7 @@ union nic_mbx {
struct reset_stat_cfg   reset_stat;
struct pfc  pfc;
struct set_ptp  ptp;
+   struct xcastxcast;
 };
 
 #define NIC_NODE_ID_MASK   0x03
-- 
2.14.3