mirror of https://gitee.com/openkylin/linux.git
net: ethernet: Use DIV_ROUND_UP instead of reimplementing its function
DIV_ROUND_UP has implemented the code-opened function. Therefore, just replace the implementation with DIV_ROUND_UP. Signed-off-by: zhong jiang <zhongjiang@huawei.com> Acked-by: Tariq Toukan <tariqt@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
db3df242bc
commit
f8a1988f65
|
@ -156,7 +156,7 @@ enum sbmac_state {
|
|||
(d)->sbdma_dscrtable : (d)->f+1)
|
||||
|
||||
|
||||
#define NUMCACHEBLKS(x) (((x)+SMP_CACHE_BYTES-1)/SMP_CACHE_BYTES)
|
||||
#define NUMCACHEBLKS(x) DIV_ROUND_UP(x, SMP_CACHE_BYTES)
|
||||
|
||||
#define SBMAC_MAX_TXDESCR 256
|
||||
#define SBMAC_MAX_RXDESCR 256
|
||||
|
|
|
@ -526,7 +526,7 @@ int octeon_retry_droq_refill(struct octeon_droq *droq)
|
|||
static inline u32
|
||||
octeon_droq_get_bufcount(u32 buf_size, u32 total_len)
|
||||
{
|
||||
return ((total_len + buf_size - 1) / buf_size);
|
||||
return DIV_ROUND_UP(total_len, buf_size);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -230,7 +230,7 @@ static unsigned int gfar_usecs2ticks(struct gfar_private *priv,
|
|||
|
||||
/* Make sure we return a number greater than 0
|
||||
* if usecs > 0 */
|
||||
return (usecs * 1000 + count - 1) / count;
|
||||
return DIV_ROUND_UP(usecs * 1000, count);
|
||||
}
|
||||
|
||||
/* Convert ethernet clock ticks to microseconds */
|
||||
|
|
|
@ -136,7 +136,7 @@ static inline int mal_rx_size(int len)
|
|||
|
||||
static inline int mal_tx_chunks(int len)
|
||||
{
|
||||
return (len + MAL_MAX_TX_SIZE - 1) / MAL_MAX_TX_SIZE;
|
||||
return DIV_ROUND_UP(len, MAL_MAX_TX_SIZE);
|
||||
}
|
||||
|
||||
#define MAL_CHAN_MASK(n) (0x80000000 >> (n))
|
||||
|
|
|
@ -614,7 +614,7 @@ int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct,
|
|||
int i;
|
||||
|
||||
buf->direct.buf = NULL;
|
||||
buf->nbufs = (size + PAGE_SIZE - 1) / PAGE_SIZE;
|
||||
buf->nbufs = DIV_ROUND_UP(size, PAGE_SIZE);
|
||||
buf->npages = buf->nbufs;
|
||||
buf->page_shift = PAGE_SHIFT;
|
||||
buf->page_list = kcalloc(buf->nbufs, sizeof(*buf->page_list),
|
||||
|
|
|
@ -406,7 +406,7 @@ int mlx4_init_icm_table(struct mlx4_dev *dev, struct mlx4_icm_table *table,
|
|||
obj_per_chunk = MLX4_TABLE_CHUNK_SIZE / obj_size;
|
||||
if (WARN_ON(!obj_per_chunk))
|
||||
return -EINVAL;
|
||||
num_icm = (nobj + obj_per_chunk - 1) / obj_per_chunk;
|
||||
num_icm = DIV_ROUND_UP(nobj, obj_per_chunk);
|
||||
|
||||
table->icm = kvcalloc(num_icm, sizeof(*table->icm), GFP_KERNEL);
|
||||
if (!table->icm)
|
||||
|
|
|
@ -73,7 +73,7 @@ static int get_pas_size(struct mlx5_srq_attr *in)
|
|||
u32 rq_sz = 1 << (log_srq_size + 4 + log_rq_stride);
|
||||
u32 page_size = 1 << log_page_size;
|
||||
u32 rq_sz_po = rq_sz + (page_offset * po_quanta);
|
||||
u32 rq_num_pas = (rq_sz_po + page_size - 1) / page_size;
|
||||
u32 rq_num_pas = DIV_ROUND_UP(rq_sz_po, page_size);
|
||||
|
||||
return rq_num_pas * sizeof(u64);
|
||||
}
|
||||
|
|
|
@ -491,7 +491,7 @@ static struct pci_driver s2io_driver = {
|
|||
};
|
||||
|
||||
/* A simplifier macro used both by init and free shared_mem Fns(). */
|
||||
#define TXD_MEM_PAGE_CNT(len, per_each) ((len+per_each - 1) / per_each)
|
||||
#define TXD_MEM_PAGE_CNT(len, per_each) DIV_ROUND_UP(len, per_each)
|
||||
|
||||
/* netqueue manipulation helper functions */
|
||||
static inline void s2io_stop_all_tx_queue(struct s2io_nic *sp)
|
||||
|
|
Loading…
Reference in New Issue