ltq-atm/ltq-ptm: re-enable/fix reset_ppe() functionality for VR9
[openwrt/staging/hauke.git] / package / kernel / lantiq / ltq-atm / src / ltq_atm.c
index f306d19364fdee8bcbacb9829b644097a50cffc1..6e6f4c66c7d7f4959bfb622b99004f49b7e9495d 100644 (file)
@@ -187,12 +187,9 @@ static inline void u64_add_u32(ppe_u64_t, unsigned int, ppe_u64_t *);
  */
 static inline struct sk_buff* alloc_skb_rx(void);
 static inline struct sk_buff* alloc_skb_tx(unsigned int);
-struct sk_buff* atm_alloc_tx(struct atm_vcc *, unsigned int);
 static inline void atm_free_tx_skb_vcc(struct sk_buff *, struct atm_vcc *);
 static inline struct sk_buff *get_skb_rx_pointer(unsigned int);
 static inline int get_tx_desc(unsigned int);
-static struct sk_buff* skb_duplicate(struct sk_buff *);
-static struct sk_buff* skb_break_away_from_protocol(struct sk_buff *);
 
 /*
  *  mailbox handler and signal function
@@ -263,8 +260,6 @@ EXPORT_SYMBOL(ifx_mei_atm_showtime_exit);
 
 #endif
 
-static struct sk_buff* (*ifx_atm_alloc_tx)(struct atm_vcc *, unsigned int) = NULL;
-
 static struct atm_priv_data g_atm_priv_data;
 
 static struct atmdev_ops g_ifx_atm_ops = {
@@ -432,8 +427,6 @@ static int ppe_open(struct atm_vcc *vcc)
 
        /*  enable irq  */
        if ( f_enable_irq ) {
-               ifx_atm_alloc_tx = atm_alloc_tx;
-
                *MBOX_IGU1_ISRC = (1 << RX_DMA_CH_AAL) | (1 << RX_DMA_CH_OAM);
                *MBOX_IGU1_IER  = (1 << RX_DMA_CH_AAL) | (1 << RX_DMA_CH_OAM);
 
@@ -482,10 +475,8 @@ static void ppe_close(struct atm_vcc *vcc)
        clear_bit(conn, &g_atm_priv_data.conn_table);
 
        /*  disable irq */
-       if ( g_atm_priv_data.conn_table == 0 ) {
+       if ( g_atm_priv_data.conn_table == 0 )
                disable_irq(PPE_MAILBOX_IGU1_INT);
-               ifx_atm_alloc_tx = NULL;
-       }
 
        /*  release bandwidth   */
        switch ( vcc->qos.txtp.traffic_class )
@@ -523,7 +514,6 @@ static int ppe_send(struct atm_vcc *vcc, struct sk_buff *skb)
        unsigned long flags;
        struct tx_descriptor reg_desc = {0};
        struct tx_inband_header *header;
-       struct sk_buff *new_skb;
 
        if ( vcc == NULL || skb == NULL )
                return -EINVAL;
@@ -788,38 +778,6 @@ static inline struct sk_buff* alloc_skb_tx(unsigned int size)
        return skb;
 }
 
-struct sk_buff* atm_alloc_tx(struct atm_vcc *vcc, unsigned int size)
-{
-       int conn;
-       struct sk_buff *skb;
-
-       /*  oversize packet */
-       if ( size > aal5s_max_packet_size ) {
-               pr_err("atm_alloc_tx: oversize packet\n");
-               return NULL;
-       }
-       /*  send buffer overflow    */
-       if ( sk_wmem_alloc_get(sk_atm(vcc)) && !atm_may_send(vcc, size) ) {
-               pr_err("atm_alloc_tx: send buffer overflow\n");
-               return NULL;
-       }
-       conn = find_vcc(vcc);
-       if ( conn < 0 ) {
-               pr_err("atm_alloc_tx: unknown VCC\n");
-               return NULL;
-       }
-
-       skb = dev_alloc_skb(size);
-       if ( skb == NULL ) {
-               pr_err("atm_alloc_tx: sk buffer is used up\n");
-               return NULL;
-       }
-
-       atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);
-
-       return skb;
-}
-
 static inline void atm_free_tx_skb_vcc(struct sk_buff *skb, struct atm_vcc *vcc)
 {
        if ( vcc->pop != NULL )
@@ -856,44 +814,6 @@ static inline int get_tx_desc(unsigned int conn)
        return desc_base;
 }
 
-static struct sk_buff* skb_duplicate(struct sk_buff *skb)
-{
-       struct sk_buff *new_skb;
-
-       new_skb = alloc_skb_tx(skb->len);
-       if ( new_skb == NULL )
-               return NULL;
-
-       skb_put(new_skb, skb->len);
-       memcpy(new_skb->data, skb->data, skb->len);
-
-       return new_skb;
-}
-
-static struct sk_buff* skb_break_away_from_protocol(struct sk_buff *skb)
-{
-       struct sk_buff *new_skb;
-
-       if ( skb_shared(skb) ) {
-               new_skb = skb_clone(skb, GFP_ATOMIC);
-               if ( new_skb == NULL )
-                       return NULL;
-       } else
-               new_skb = skb_get(skb);
-
-       skb_dst_drop(new_skb);
-#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
-       nf_conntrack_put(new_skb->nfct);
-       new_skb->nfct = NULL;
-  #ifdef CONFIG_BRIDGE_NETFILTER
-       nf_bridge_put(new_skb->nf_bridge);
-       new_skb->nf_bridge = NULL;
-  #endif
-#endif
-
-       return new_skb;
-}
-
 static void free_tx_ring(unsigned int queue)
 {
        unsigned long flags;
@@ -1857,7 +1777,7 @@ static int ltq_atm_probe(struct platform_device *pdev)
                goto INIT_PRIV_DATA_FAIL;
        }
 
-       ops->init();
+       ops->init(pdev);
        init_rx_tables();
        init_tx_tables();