components/open-fabrics/libibverbs/patches/base.patch
changeset 4835 d5abd56e3fcf
parent 4661 353f8a998732
equal deleted inserted replaced
4834:22970ab7cd3a 4835:d5abd56e3fcf
     1 #This patch was developed in-house. We plan to submit it upstream, but do
     1 #This patch was developed both in-house and from outside. We plan to submit it
     2 # not yet have a target date for doing so
     2 #upstream, but do not yet have a target date for doing so
     3 #
     3 #
     4 diff -r -u /tmp/846623/libibverbs-1.1.4/Makefile.am libibverbs-1.1.4/Makefile.am
     4 diff -r -u /tmp/846623/libibverbs-1.1.4/Makefile.am libibverbs-1.1.4/Makefile.am
     5 --- /tmp/846623/libibverbs-1.1.4/Makefile.am	Thu Feb  3 01:53:17 2011
     5 --- /tmp/846623/libibverbs-1.1.4/Makefile.am	Thu Feb  3 01:53:17 2011
     6 +++ libibverbs-1.1.4/Makefile.am	Fri Feb 11 04:02:12 2011
     6 +++ libibverbs-1.1.4/Makefile.am	Fri Feb 11 04:02:12 2011
     7 @@ -4,13 +4,13 @@
     7 @@ -4,13 +4,13 @@
   557 +	(gids->raw[1] == 0x15)  || (gids->raw[1] == 0x18)))
   557 +	(gids->raw[1] == 0x15)  || (gids->raw[1] == 0x18)))
   558 +
   558 +
   559  int ibv_rate_to_mult(enum ibv_rate rate)
   559  int ibv_rate_to_mult(enum ibv_rate rate)
   560  {
   560  {
   561  	switch (rate) {
   561  	switch (rate) {
   562 @@ -93,6 +108,12 @@
   562 @@ -76,6 +91,54 @@
       
   563  	}
       
   564  }
       
   565  
       
   566 +int ibv_rate_to_mbps(enum ibv_rate rate)
       
   567 +{
       
   568 +	switch (rate) {
       
   569 +	case IBV_RATE_2_5_GBPS: return 2500;
       
   570 +	case IBV_RATE_5_GBPS:   return 5000;
       
   571 +	case IBV_RATE_10_GBPS:  return 10000;
       
   572 +	case IBV_RATE_20_GBPS:  return 20000;
       
   573 +	case IBV_RATE_30_GBPS:  return 30000;
       
   574 +	case IBV_RATE_40_GBPS:  return 40000;
       
   575 +	case IBV_RATE_60_GBPS:  return 60000;
       
   576 +	case IBV_RATE_80_GBPS:  return 80000;
       
   577 +	case IBV_RATE_120_GBPS: return 120000;
       
   578 +	case IBV_RATE_14_GBPS:  return 14062;
       
   579 +	case IBV_RATE_56_GBPS:  return 56250;
       
   580 +	case IBV_RATE_112_GBPS: return 112500;
       
   581 +	case IBV_RATE_168_GBPS: return 168750;
       
   582 +	case IBV_RATE_25_GBPS:  return 25781;
       
   583 +	case IBV_RATE_100_GBPS: return 103125;
       
   584 +	case IBV_RATE_200_GBPS: return 206250;
       
   585 +	case IBV_RATE_300_GBPS: return 309375;
       
   586 +	default:               return -1;
       
   587 +	}
       
   588 +}
       
   589 +
       
   590 +enum ibv_rate mbps_to_ibv_rate(int mbps)
       
   591 +{
       
   592 +	switch (mbps) {
       
   593 +	case 2500:   return IBV_RATE_2_5_GBPS;
       
   594 +	case 5000:   return IBV_RATE_5_GBPS;
       
   595 +	case 10000:  return IBV_RATE_10_GBPS;
       
   596 +	case 20000:  return IBV_RATE_20_GBPS;
       
   597 +	case 30000:  return IBV_RATE_30_GBPS;
       
   598 +	case 40000:  return IBV_RATE_40_GBPS;
       
   599 +	case 60000:  return IBV_RATE_60_GBPS;
       
   600 +	case 80000:  return IBV_RATE_80_GBPS;
       
   601 +	case 120000: return IBV_RATE_120_GBPS;
       
   602 +	case 14062:  return IBV_RATE_14_GBPS;
       
   603 +	case 56250:  return IBV_RATE_56_GBPS;
       
   604 +	case 112500: return IBV_RATE_112_GBPS;
       
   605 +	case 168750: return IBV_RATE_168_GBPS;
       
   606 +	case 25781:  return IBV_RATE_25_GBPS;
       
   607 +	case 103125: return IBV_RATE_100_GBPS;
       
   608 +	case 206250: return IBV_RATE_200_GBPS;
       
   609 +	case 309375: return IBV_RATE_300_GBPS;
       
   610 +	default:     return IBV_RATE_MAX;
       
   611 +	}
       
   612 +}
       
   613 +
       
   614  int __ibv_query_device(struct ibv_context *context,
       
   615  		       struct ibv_device_attr *device_attr)
       
   616  {
       
   617 @@ -93,6 +156,12 @@
   563  int __ibv_query_gid(struct ibv_context *context, uint8_t port_num,
   618  int __ibv_query_gid(struct ibv_context *context, uint8_t port_num,
   564  		    int index, union ibv_gid *gid)
   619  		    int index, union ibv_gid *gid)
   565  {
   620  {
   566 +#if defined(__SVR4) && defined(__sun)
   621 +#if defined(__SVR4) && defined(__sun)
   567 +	extern int sol_ibv_query_gid();
   622 +	extern int sol_ibv_query_gid();
   570 +
   625 +
   571 +#else
   626 +#else
   572  	char name[24];
   627  	char name[24];
   573  	char attr[41];
   628  	char attr[41];
   574  	uint16_t val;
   629  	uint16_t val;
   575 @@ -112,6 +133,7 @@
   630 @@ -112,6 +181,7 @@
   576  	}
   631  	}
   577  
   632  
   578  	return 0;
   633  	return 0;
   579 +#endif
   634 +#endif
   580  }
   635  }
   581  default_symver(__ibv_query_gid, ibv_query_gid);
   636  default_symver(__ibv_query_gid, ibv_query_gid);
   582  
   637  
   583 @@ -118,6 +140,12 @@
   638 @@ -118,6 +188,12 @@
   584  int __ibv_query_pkey(struct ibv_context *context, uint8_t port_num,
   639  int __ibv_query_pkey(struct ibv_context *context, uint8_t port_num,
   585  		     int index, uint16_t *pkey)
   640  		     int index, uint16_t *pkey)
   586  {
   641  {
   587 +#if defined(__SVR4) && defined(__sun)
   642 +#if defined(__SVR4) && defined(__sun)
   588 +	extern int sol_ibv_query_pkey();
   643 +	extern int sol_ibv_query_pkey();
   591 +
   646 +
   592 +#else
   647 +#else
   593  	char name[24];
   648  	char name[24];
   594  	char attr[8];
   649  	char attr[8];
   595  	uint16_t val;
   650  	uint16_t val;
   596 @@ -133,9 +161,159 @@
   651 @@ -133,9 +209,159 @@
   597  
   652  
   598  	*pkey = htons(val);
   653  	*pkey = htons(val);
   599  	return 0;
   654  	return 0;
   600 +#endif
   655 +#endif
   601  }
   656  }
   751 +}
   806 +}
   752 +
   807 +
   753  struct ibv_pd *__ibv_alloc_pd(struct ibv_context *context)
   808  struct ibv_pd *__ibv_alloc_pd(struct ibv_context *context)
   754  {
   809  {
   755  	struct ibv_pd *pd;
   810  	struct ibv_pd *pd;
   756 @@ -148,6 +326,27 @@
   811 @@ -148,6 +374,27 @@
   757  }
   812  }
   758  default_symver(__ibv_alloc_pd, ibv_alloc_pd);
   813  default_symver(__ibv_alloc_pd, ibv_alloc_pd);
   759  
   814  
   760 +struct ibv_shpd *__ibv_alloc_shpd(struct ibv_pd *pd, uint64_t share_key, struct ibv_shpd *shpd)
   815 +struct ibv_shpd *__ibv_alloc_shpd(struct ibv_pd *pd, uint64_t share_key, struct ibv_shpd *shpd)
   761 +{
   816 +{
   779 +default_symver(__ibv_share_pd, ibv_share_pd);
   834 +default_symver(__ibv_share_pd, ibv_share_pd);
   780 +
   835 +
   781  int __ibv_dealloc_pd(struct ibv_pd *pd)
   836  int __ibv_dealloc_pd(struct ibv_pd *pd)
   782  {
   837  {
   783  	return pd->context->ops.dealloc_pd(pd);
   838  	return pd->context->ops.dealloc_pd(pd);
   784 @@ -175,6 +374,27 @@
   839 @@ -175,6 +422,27 @@
   785  }
   840  }
   786  default_symver(__ibv_reg_mr, ibv_reg_mr);
   841  default_symver(__ibv_reg_mr, ibv_reg_mr);
   787  
   842  
   788 +struct ibv_mr *__ibv_reg_mr_relaxed(struct ibv_pd *pd, void *addr,
   843 +struct ibv_mr *__ibv_reg_mr_relaxed(struct ibv_pd *pd, void *addr,
   789 +			    size_t length, int access)
   844 +			    size_t length, int access)
   807 +default_symver(__ibv_reg_mr_relaxed, ibv_reg_mr_relaxed);
   862 +default_symver(__ibv_reg_mr_relaxed, ibv_reg_mr_relaxed);
   808 +
   863 +
   809  int __ibv_dereg_mr(struct ibv_mr *mr)
   864  int __ibv_dereg_mr(struct ibv_mr *mr)
   810  {
   865  {
   811  	int ret;
   866  	int ret;
   812 @@ -189,6 +409,26 @@
   867 @@ -189,6 +457,26 @@
   813  }
   868  }
   814  default_symver(__ibv_dereg_mr, ibv_dereg_mr);
   869  default_symver(__ibv_dereg_mr, ibv_dereg_mr);
   815  
   870  
   816 +int __ibv_dereg_mr_relaxed(struct ibv_mr *mr)
   871 +int __ibv_dereg_mr_relaxed(struct ibv_mr *mr)
   817 +{
   872 +{
   834 +default_symver(__ibv_flush_relaxed_mr, ibv_flush_relaxed_mr);
   889 +default_symver(__ibv_flush_relaxed_mr, ibv_flush_relaxed_mr);
   835 +
   890 +
   836  static struct ibv_comp_channel *ibv_create_comp_channel_v2(struct ibv_context *context)
   891  static struct ibv_comp_channel *ibv_create_comp_channel_v2(struct ibv_context *context)
   837  {
   892  {
   838  	struct ibv_abi_compat_v2 *t = context->abi_compat;
   893  	struct ibv_abi_compat_v2 *t = context->abi_compat;
   839 @@ -212,6 +452,10 @@
   894 @@ -212,6 +500,10 @@
   840  	struct ibv_comp_channel            *channel;
   895  	struct ibv_comp_channel            *channel;
   841  	struct ibv_create_comp_channel      cmd;
   896  	struct ibv_create_comp_channel      cmd;
   842  	struct ibv_create_comp_channel_resp resp;
   897  	struct ibv_create_comp_channel_resp resp;
   843 +#if defined(__SVR4) && defined(__sun)
   898 +#if defined(__SVR4) && defined(__sun)
   844 +	int		event_fd;
   899 +	int		event_fd;
   845 +	struct stat	fstat_buf;
   900 +	struct stat	fstat_buf;
   846 +#endif
   901 +#endif
   847  
   902  
   848  	if (abi_ver <= 2)
   903  	if (abi_ver <= 2)
   849  		return ibv_create_comp_channel_v2(context);
   904  		return ibv_create_comp_channel_v2(context);
   850 @@ -221,7 +465,23 @@
   905 @@ -221,7 +513,23 @@
   851  		return NULL;
   906  		return NULL;
   852  
   907  
   853  	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, CREATE_COMP_CHANNEL, &resp, sizeof resp);
   908  	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, CREATE_COMP_CHANNEL, &resp, sizeof resp);
   854 +#if defined(__SVR4) && defined(__sun)
   909 +#if defined(__SVR4) && defined(__sun)
   855 +	event_fd = open("/dev/infiniband/ofs/uverbs:event", O_RDWR);
   910 +	event_fd = open("/dev/infiniband/ofs/uverbs:event", O_RDWR);
   869 +		close(event_fd);
   924 +		close(event_fd);
   870 +#endif
   925 +#endif
   871  		free(channel);
   926  		free(channel);
   872  		return NULL;
   927  		return NULL;
   873  	}
   928  	}
   874 @@ -228,6 +488,9 @@
   929 @@ -228,6 +536,9 @@
   875  
   930  
   876  	VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
   931  	VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
   877  
   932  
   878 +#if defined(__SVR4) && defined(__sun)
   933 +#if defined(__SVR4) && defined(__sun)
   879 +	resp.fd = event_fd;
   934 +	resp.fd = event_fd;
  2326 +};
  2381 +};
  2327 +
  2382 +
  2328  enum ibv_rereg_mr_flags {
  2383  enum ibv_rereg_mr_flags {
  2329  	IBV_REREG_MR_CHANGE_TRANSLATION	= (1 << 0),
  2384  	IBV_REREG_MR_CHANGE_TRANSLATION	= (1 << 0),
  2330  	IBV_REREG_MR_CHANGE_PD		= (1 << 1),
  2385  	IBV_REREG_MR_CHANGE_PD		= (1 << 1),
  2331 @@ -425,6 +448,14 @@
  2386 @@ -360,7 +383,15 @@
       
  2387  	IBV_RATE_40_GBPS  = 7,
       
  2388  	IBV_RATE_60_GBPS  = 8,
       
  2389  	IBV_RATE_80_GBPS  = 9,
       
  2390 -	IBV_RATE_120_GBPS = 10
       
  2391 +	IBV_RATE_120_GBPS = 10,
       
  2392 +	IBV_RATE_14_GBPS  = 11,
       
  2393 +	IBV_RATE_56_GBPS  = 12,
       
  2394 +	IBV_RATE_112_GBPS = 13,
       
  2395 +	IBV_RATE_168_GBPS = 14,
       
  2396 +	IBV_RATE_25_GBPS  = 15,
       
  2397 +	IBV_RATE_100_GBPS = 16,
       
  2398 +	IBV_RATE_200_GBPS = 17,
       
  2399 +	IBV_RATE_300_GBPS = 18
       
  2400  };
       
  2401  
       
  2402  /**
       
  2403 @@ -377,6 +408,20 @@
       
  2404   */
       
  2405  enum ibv_rate mult_to_ibv_rate(int mult) __attribute_const;
       
  2406  
       
  2407 +/**
       
  2408 + * ibv_rate_to_mbps - Convert the IB rate enum to Mbit/sec.
       
  2409 + * For example, IBV_RATE_5_GBPS will return the value 5000.
       
  2410 + * @rate: rate to convert.
       
  2411 + */
       
  2412 +int ibv_rate_to_mbps(enum ibv_rate rate) __attribute_const;
       
  2413 +
       
  2414 +/**
       
  2415 + * mbps_to_ibv_rate - Convert a Mbit/sec value to an IB rate enum.
       
  2416 + * @mbps: value to convert.
       
  2417 + */
       
  2418 +enum ibv_rate mbps_to_ibv_rate(int mbps) __attribute_const;
       
  2419 +
       
  2420 +
       
  2421  struct ibv_ah_attr {
       
  2422  	struct ibv_global_route	grh;
       
  2423  	uint16_t		dlid;
       
  2424 @@ -425,6 +470,14 @@
  2332  	uint32_t		max_inline_data;
  2425  	uint32_t		max_inline_data;
  2333  };
  2426  };
  2334  
  2427  
  2335 +#if defined(__SVR4) && defined(__sun)
  2428 +#if defined(__SVR4) && defined(__sun)
  2336 +/*
  2429 +/*
  2341 +#endif
  2434 +#endif
  2342 +
  2435 +
  2343  struct ibv_qp_init_attr {
  2436  struct ibv_qp_init_attr {
  2344  	void		       *qp_context;
  2437  	void		       *qp_context;
  2345  	struct ibv_cq	       *send_cq;
  2438  	struct ibv_cq	       *send_cq;
  2346 @@ -659,6 +690,7 @@
  2439 @@ -659,6 +712,7 @@
  2347  	char			dev_path[IBV_SYSFS_PATH_MAX];
  2440  	char			dev_path[IBV_SYSFS_PATH_MAX];
  2348  	/* Path to infiniband class device in sysfs */
  2441  	/* Path to infiniband class device in sysfs */
  2349  	char			ibdev_path[IBV_SYSFS_PATH_MAX];
  2442  	char			ibdev_path[IBV_SYSFS_PATH_MAX];
  2350 +	uint                    blueflame_enabled;
  2443 +	uint                    blueflame_enabled;
  2351  };
  2444  };
  2352  
  2445  
  2353  struct ibv_more_ops {
  2446  struct ibv_more_ops {
  2354 @@ -743,6 +775,12 @@
  2447 @@ -743,6 +797,12 @@
  2355  	int			(*detach_mcast)(struct ibv_qp *qp, const union ibv_gid *gid,
  2448  	int			(*detach_mcast)(struct ibv_qp *qp, const union ibv_gid *gid,
  2356  						uint16_t lid);
  2449  						uint16_t lid);
  2357  	void			(*async_event)(struct ibv_async_event *event);
  2450  	void			(*async_event)(struct ibv_async_event *event);
  2358 +	struct ibv_mr *		(*reg_mr_relaxed)(struct ibv_pd *pd, void *addr, size_t length,
  2451 +	struct ibv_mr *		(*reg_mr_relaxed)(struct ibv_pd *pd, void *addr, size_t length,
  2359 +					  int access);
  2452 +					  int access);
  2362 +	struct ibv_shpd *	(*alloc_shpd)(struct ibv_pd *pd, uint64_t share_key, struct ibv_shpd *shpd);
  2455 +	struct ibv_shpd *	(*alloc_shpd)(struct ibv_pd *pd, uint64_t share_key, struct ibv_shpd *shpd);
  2363 +	struct ibv_pd *		(*share_pd)(struct ibv_context *context, struct ibv_shpd *shpd, uint64_t share_key);
  2456 +	struct ibv_pd *		(*share_pd)(struct ibv_context *context, struct ibv_shpd *shpd, uint64_t share_key);
  2364  };
  2457  };
  2365  
  2458  
  2366  struct ibv_context {
  2459  struct ibv_context {
  2367 @@ -749,6 +787,13 @@
  2460 @@ -749,6 +809,13 @@
  2368  	struct ibv_device      *device;
  2461  	struct ibv_device      *device;
  2369  	struct ibv_context_ops	ops;
  2462  	struct ibv_context_ops	ops;
  2370  	int			cmd_fd;
  2463  	int			cmd_fd;
  2371 +#if defined(__SVR4) && defined(__sun)
  2464 +#if defined(__SVR4) && defined(__sun)
  2372 +	/*
  2465 +	/*
  2376 +	int			mmap_fd;
  2469 +	int			mmap_fd;
  2377 +#endif
  2470 +#endif
  2378  	int			async_fd;
  2471  	int			async_fd;
  2379  	int			num_comp_vectors;
  2472  	int			num_comp_vectors;
  2380  	pthread_mutex_t		mutex;
  2473  	pthread_mutex_t		mutex;
  2381 @@ -797,6 +842,11 @@
  2474 @@ -797,6 +864,11 @@
  2382  uint64_t ibv_get_device_guid(struct ibv_device *device);
  2475  uint64_t ibv_get_device_guid(struct ibv_device *device);
  2383  
  2476  
  2384  /**
  2477  /**
  2385 + * ibv_get_device_guid_external - Return device's node external GUID
  2478 + * ibv_get_device_guid_external - Return device's node external GUID
  2386 + */
  2479 + */
  2388 +
  2481 +
  2389 +/**
  2482 +/**
  2390   * ibv_open_device - Initialize device for use
  2483   * ibv_open_device - Initialize device for use
  2391   */
  2484   */
  2392  struct ibv_context *ibv_open_device(struct ibv_device *device);
  2485  struct ibv_context *ibv_open_device(struct ibv_device *device);
  2393 @@ -853,11 +903,44 @@
  2486 @@ -853,11 +925,44 @@
  2394  		   int index, uint16_t *pkey);
  2487  		   int index, uint16_t *pkey);
  2395  
  2488  
  2396  /**
  2489  /**
  2397 + * ibv_register_sm_events - Register subnet event for GID change
  2490 + * ibv_register_sm_events - Register subnet event for GID change
  2398 + */
  2491 + */
  2433 +
  2526 +
  2434 +/**
  2527 +/**
  2435   * ibv_dealloc_pd - Free a protection domain
  2528   * ibv_dealloc_pd - Free a protection domain
  2436   */
  2529   */
  2437  int ibv_dealloc_pd(struct ibv_pd *pd);
  2530  int ibv_dealloc_pd(struct ibv_pd *pd);
  2438 @@ -869,11 +952,27 @@
  2531 @@ -869,11 +974,27 @@
  2439  			  size_t length, int access);
  2532  			  size_t length, int access);
  2440  
  2533  
  2441  /**
  2534  /**
  2442 + * ibv_reg_mr_relaxed - Register a memory region using FMR
  2535 + * ibv_reg_mr_relaxed - Register a memory region using FMR
  2443 + */
  2536 + */
  3174  #include <byteswap.h>
  3267  #include <byteswap.h>
  3175 +#endif
  3268 +#endif
  3176  
  3269  
  3177  #include <infiniband/verbs.h>
  3270  #include <infiniband/verbs.h>
  3178  #include <infiniband/driver.h>
  3271  #include <infiniband/driver.h>
       
  3272 @@ -140,6 +142,9 @@
       
  3273  	case 1:  return "2.5 Gbps";
       
  3274  	case 2:  return "5.0 Gbps";
       
  3275  	case 4:  return "10.0 Gbps";
       
  3276 +	case 8:  return "10.0 Gbps";
       
  3277 +	case 16: return "14.0 Gbps";
       
  3278 +	case 32: return "25.0 Gbps";
       
  3279  	default: return "invalid speed";
       
  3280  	}
       
  3281  }