Commit 55aa6985 authored by Bruce Allan's avatar Bruce Allan Committed by Jeff Kirsher

e1000e: pass pointer to ring struct instead of adapter struct

For ring-specific functions, pass a pointer to the ring struct instead of a
pointer to the adapter struct.
Signed-off-by: default avatarBruce Allan <bruce.w.allan@intel.com>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent c5083cf6
......@@ -234,6 +234,7 @@ struct e1000_buffer {
};
struct e1000_ring {
struct e1000_adapter *adapter; /* back pointer to adapter */
void *desc; /* pointer to ring memory */
dma_addr_t dma; /* phys address of ring */
unsigned int size; /* length of ring in bytes */
......@@ -334,11 +335,10 @@ struct e1000_adapter {
/*
* Rx
*/
bool (*clean_rx) (struct e1000_adapter *adapter,
int *work_done, int work_to_do)
____cacheline_aligned_in_smp;
void (*alloc_rx_buf) (struct e1000_adapter *adapter,
int cleaned_count, gfp_t gfp);
bool (*clean_rx) (struct e1000_ring *ring, int *work_done,
int work_to_do) ____cacheline_aligned_in_smp;
void (*alloc_rx_buf) (struct e1000_ring *ring, int cleaned_count,
gfp_t gfp);
struct e1000_ring *rx_ring;
u32 rx_int_delay;
......@@ -398,6 +398,9 @@ struct e1000_adapter {
bool idle_check;
int phy_hang_count;
u16 tx_ring_count;
u16 rx_ring_count;
};
struct e1000_info {
......@@ -492,10 +495,10 @@ extern void e1000e_down(struct e1000_adapter *adapter);
extern void e1000e_reinit_locked(struct e1000_adapter *adapter);
extern void e1000e_reset(struct e1000_adapter *adapter);
extern void e1000e_power_up_phy(struct e1000_adapter *adapter);
extern int e1000e_setup_rx_resources(struct e1000_adapter *adapter);
extern int e1000e_setup_tx_resources(struct e1000_adapter *adapter);
extern void e1000e_free_rx_resources(struct e1000_adapter *adapter);
extern void e1000e_free_tx_resources(struct e1000_adapter *adapter);
extern int e1000e_setup_rx_resources(struct e1000_ring *ring);
extern int e1000e_setup_tx_resources(struct e1000_ring *ring);
extern void e1000e_free_rx_resources(struct e1000_ring *ring);
extern void e1000e_free_tx_resources(struct e1000_ring *ring);
extern struct rtnl_link_stats64 *e1000e_get_stats64(struct net_device *netdev,
struct rtnl_link_stats64
*stats);
......
......@@ -656,10 +656,10 @@ static int e1000_set_ringparam(struct net_device *netdev,
if (netif_running(adapter->netdev)) {
/* Try to get new resources before deleting old */
err = e1000e_setup_rx_resources(adapter);
err = e1000e_setup_rx_resources(rx_ring);
if (err)
goto err_setup_rx;
err = e1000e_setup_tx_resources(adapter);
err = e1000e_setup_tx_resources(tx_ring);
if (err)
goto err_setup_tx;
......@@ -669,8 +669,8 @@ static int e1000_set_ringparam(struct net_device *netdev,
*/
adapter->rx_ring = rx_old;
adapter->tx_ring = tx_old;
e1000e_free_rx_resources(adapter);
e1000e_free_tx_resources(adapter);
e1000e_free_rx_resources(adapter->rx_ring);
e1000e_free_tx_resources(adapter->tx_ring);
kfree(tx_old);
kfree(rx_old);
adapter->rx_ring = rx_ring;
......@@ -683,7 +683,7 @@ static int e1000_set_ringparam(struct net_device *netdev,
clear_bit(__E1000_RESETTING, &adapter->state);
return 0;
err_setup_tx:
e1000e_free_rx_resources(adapter);
e1000e_free_rx_resources(rx_ring);
err_setup_rx:
adapter->rx_ring = rx_old;
adapter->tx_ring = tx_old;
......
This diff is collapsed.
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