]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
net: sparx5: add sparx5 context pointer to a few functions
authorDaniel Machon <daniel.machon@microchip.com>
Wed, 23 Oct 2024 22:01:23 +0000 (00:01 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 31 Oct 2024 01:08:05 +0000 (18:08 -0700)
In preparation for lan969x, add the sparx5 context pointer to certain
IFH (Internal Frame Header) functions. This is required, as the
is_sparx5() function will be used here in a subsequent patch.

Reviewed-by: Steen Hegelund <Steen.Hegelund@microchip.com>
Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
Link: https://patch.msgid.link/20241024-sparx5-lan969x-switch-driver-2-v2-4-a0b5fae88a0f@microchip.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/microchip/sparx5/sparx5_fdma.c
drivers/net/ethernet/microchip/sparx5/sparx5_main.h
drivers/net/ethernet/microchip/sparx5/sparx5_netdev.c
drivers/net/ethernet/microchip/sparx5/sparx5_packet.c

index 88f7509f09807bf4a237365a1b2f2646089afeb1..0027144a2af241bde79364dbf088b7028383baf6 100644 (file)
@@ -154,7 +154,7 @@ static bool sparx5_fdma_rx_get_frame(struct sparx5 *sparx5, struct sparx5_rx *rx
        skb = rx->skb[fdma->dcb_index][fdma->db_index];
        skb_put(skb, fdma_db_len_get(db_hw));
        /* Now do the normal processing of the skb */
-       sparx5_ifh_parse((u32 *)skb->data, &fi);
+       sparx5_ifh_parse(sparx5, (u32 *)skb->data, &fi);
        /* Map to port netdev */
        port = fi.src_port < sparx5->data->consts->n_ports ?
                       sparx5->ports[fi.src_port] :
index 2a3b4e855590b8acb92f0df5ef452ba9b17beb2c..15f5d38776c4e8634012f73376b41d928df43781 100644 (file)
@@ -401,7 +401,7 @@ struct frame_info {
 };
 
 void sparx5_xtr_flush(struct sparx5 *sparx5, u8 grp);
-void sparx5_ifh_parse(u32 *ifh, struct frame_info *info);
+void sparx5_ifh_parse(struct sparx5 *sparx5, u32 *ifh, struct frame_info *info);
 irqreturn_t sparx5_xtr_handler(int irq, void *_priv);
 netdev_tx_t sparx5_port_xmit_impl(struct sk_buff *skb, struct net_device *dev);
 int sparx5_manual_injection_mode(struct sparx5 *sparx5);
@@ -469,10 +469,13 @@ static inline int sparx5_dcb_init(struct sparx5 *sparx5)
 #endif
 
 /* sparx5_netdev.c */
-void sparx5_set_port_ifh_timestamp(void *ifh_hdr, u64 timestamp);
+void sparx5_set_port_ifh_timestamp(struct sparx5 *sparx5, void *ifh_hdr,
+                                  u64 timestamp);
 void sparx5_set_port_ifh_rew_op(void *ifh_hdr, u32 rew_op);
-void sparx5_set_port_ifh_pdu_type(void *ifh_hdr, u32 pdu_type);
-void sparx5_set_port_ifh_pdu_w16_offset(void *ifh_hdr, u32 pdu_w16_offset);
+void sparx5_set_port_ifh_pdu_type(struct sparx5 *sparx5, void *ifh_hdr,
+                                 u32 pdu_type);
+void sparx5_set_port_ifh_pdu_w16_offset(struct sparx5 *sparx5, void *ifh_hdr,
+                                       u32 pdu_w16_offset);
 void sparx5_set_port_ifh(struct sparx5 *sparx5, void *ifh_hdr, u16 portno);
 bool sparx5_netdevice_check(const struct net_device *dev);
 struct net_device *sparx5_create_netdev(struct sparx5 *sparx5, u32 portno);
index d4e9986ef16a9e67f223181a86796abdfd121e7f..a94d9a540bd3f54bbf03fa78d08e0ad33878cc6e 100644 (file)
@@ -81,17 +81,20 @@ void sparx5_set_port_ifh_rew_op(void *ifh_hdr, u32 rew_op)
        ifh_encode_bitfield(ifh_hdr, rew_op, VSTAX + 32,  10);
 }
 
-void sparx5_set_port_ifh_pdu_type(void *ifh_hdr, u32 pdu_type)
+void sparx5_set_port_ifh_pdu_type(struct sparx5 *sparx5, void *ifh_hdr,
+                                 u32 pdu_type)
 {
        ifh_encode_bitfield(ifh_hdr, pdu_type, 191, 4);
 }
 
-void sparx5_set_port_ifh_pdu_w16_offset(void *ifh_hdr, u32 pdu_w16_offset)
+void sparx5_set_port_ifh_pdu_w16_offset(struct sparx5 *sparx5, void *ifh_hdr,
+                                       u32 pdu_w16_offset)
 {
        ifh_encode_bitfield(ifh_hdr, pdu_w16_offset, 195, 6);
 }
 
-void sparx5_set_port_ifh_timestamp(void *ifh_hdr, u64 timestamp)
+void sparx5_set_port_ifh_timestamp(struct sparx5 *sparx5, void *ifh_hdr,
+                                  u64 timestamp)
 {
        ifh_encode_bitfield(ifh_hdr, timestamp, 232,  40);
 }
index 5bfa86a71ac87101ff1c10eca162b6195c1bddfc..57fa9ff9dfcee2289574ba3ec4d82691d29a427f 100644 (file)
@@ -32,7 +32,7 @@ void sparx5_xtr_flush(struct sparx5 *sparx5, u8 grp)
        spx5_wr(0, sparx5, QS_XTR_FLUSH);
 }
 
-void sparx5_ifh_parse(u32 *ifh, struct frame_info *info)
+void sparx5_ifh_parse(struct sparx5 *sparx5, u32 *ifh, struct frame_info *info)
 {
        u8 *xtr_hdr = (u8 *)ifh;
 
@@ -72,7 +72,7 @@ static void sparx5_xtr_grp(struct sparx5 *sparx5, u8 grp, bool byte_swap)
                ifh[i] = spx5_rd(sparx5, QS_XTR_RD(grp));
 
        /* Decode IFH (what's needed) */
-       sparx5_ifh_parse(ifh, &fi);
+       sparx5_ifh_parse(sparx5, ifh, &fi);
 
        /* Map to port netdev */
        port = fi.src_port < sparx5->data->consts->n_ports ?
@@ -242,9 +242,12 @@ netdev_tx_t sparx5_port_xmit_impl(struct sk_buff *skb, struct net_device *dev)
                        return NETDEV_TX_BUSY;
 
                sparx5_set_port_ifh_rew_op(ifh, SPARX5_SKB_CB(skb)->rew_op);
-               sparx5_set_port_ifh_pdu_type(ifh, SPARX5_SKB_CB(skb)->pdu_type);
-               sparx5_set_port_ifh_pdu_w16_offset(ifh, SPARX5_SKB_CB(skb)->pdu_w16_offset);
-               sparx5_set_port_ifh_timestamp(ifh, SPARX5_SKB_CB(skb)->ts_id);
+               sparx5_set_port_ifh_pdu_type(sparx5, ifh,
+                                            SPARX5_SKB_CB(skb)->pdu_type);
+               sparx5_set_port_ifh_pdu_w16_offset(sparx5, ifh,
+                                                  SPARX5_SKB_CB(skb)->pdu_w16_offset);
+               sparx5_set_port_ifh_timestamp(sparx5, ifh,
+                                             SPARX5_SKB_CB(skb)->ts_id);
        }
 
        skb_tx_timestamp(skb);